Added try/except commands

testing
sgoudham 5 years ago
parent 2f482b098e
commit 9295f632c6

@ -47,14 +47,15 @@ class Waifus(commands.Cog):
await asyncio.sleep(2.5)
# Delete the message
await message.delete()
except Exception as e:
print(f'{e}')
except FileNotFoundError as e:
print(e)
# Bot ~Toga command for Josh
@commands.command(aliases=['Toga'])
@cooldown(1, 0, BucketType.channel)
async def toga(self, ctx):
try:
with open('togaImages.txt') as file:
toga_array = file.readlines()
@ -69,14 +70,15 @@ class Waifus(commands.Cog):
await ctx.send(embed=embed)
else:
message = await ctx.send(error_function())
# Let the user read the message for 2.5 seconds
await asyncio.sleep(2.5)
# Delete the message
await message.delete()
file.close()
except FileNotFoundError as e:
print(e)
def error_function():

Loading…
Cancel
Save