fixed bug where command would not work in text channels
This commit is contained in:
parent
df8c5c5ecd
commit
f7f9ddef68
1 changed files with 8 additions and 9 deletions
|
|
@ -18,12 +18,12 @@ class Waifu(commands.Cog):
|
||||||
resp_data = await resp.json()
|
resp_data = await resp.json()
|
||||||
try:
|
try:
|
||||||
image = resp_data['images'][0]
|
image = resp_data['images'][0]
|
||||||
return image['url'], image['is_nsfw']
|
return image['url']
|
||||||
except:
|
except:
|
||||||
if resp_data['detail'] == "No image found matching the criteria given.":
|
if resp_data['detail'] == "No image found matching the criteria given.":
|
||||||
return "No image found matching the criteria given.", "False"
|
return "No image found matching the criteria given."
|
||||||
else:
|
else:
|
||||||
return "Something went wrong", "False"
|
return "Something went wrong"
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def waifu(self, ctx, nsfw=""):
|
async def waifu(self, ctx, nsfw=""):
|
||||||
|
|
@ -31,15 +31,14 @@ class Waifu(commands.Cog):
|
||||||
tag = random.choice(["ero", "ass", "hentai", "milf", "oral", "paizuri", "ecchi"])
|
tag = random.choice(["ero", "ass", "hentai", "milf", "oral", "paizuri", "ecchi"])
|
||||||
else:
|
else:
|
||||||
tag = random.choice(["waifu", "maid", "selfies", "uniform"])
|
tag = random.choice(["waifu", "maid", "selfies", "uniform"])
|
||||||
image_url, nsfw = await self.get_waifu(tag)
|
image_url = await self.get_waifu(tag)
|
||||||
if ctx.channel.type == discord.ChannelType["private"]:
|
if ctx.channel.type == discord.ChannelType["private"]:
|
||||||
await ctx.send(image_url)
|
await ctx.send(image_url)
|
||||||
elif not ctx.channel.is_nsfw() and nsfw == "False":
|
elif not ctx.channel.is_nsfw() and nsfw.lower() == "nsfw":
|
||||||
await ctx.send(image_url)
|
|
||||||
elif ctx.channel.is_nsfw() and nsfw == "True":
|
|
||||||
await ctx.send(image_url)
|
|
||||||
else:
|
|
||||||
await ctx.send("Cannot post NSFW images in this channel.")
|
await ctx.send("Cannot post NSFW images in this channel.")
|
||||||
|
else:
|
||||||
|
await ctx.send(image_url)
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot):
|
async def setup(bot):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue