1
0
Fork 0
mirror of synced 2024-06-15 09:04:33 +12:00

Catch failures to send messages on exceptions

This commit is contained in:
Phxntxm 2017-04-08 21:52:10 -05:00
parent f99afec44f
commit 3f2f7e77a3

3
bot.py
View file

@ -91,6 +91,7 @@ async def on_command_error(error, ctx):
except AttributeError:
pass
try:
if isinstance(error, commands.BadArgument):
fmt = "Please provide a valid argument to pass to the command: {}".format(error)
await ctx.message.channel.send(fmt)
@ -118,6 +119,8 @@ async def on_command_error(error, ctx):
except:
traceback.print_tb(error.__traceback__, file=f)
print('{0.__class__.__name__}: {0}'.format(error), file=f)
except discord.HTTPException:
pass
if __name__ == '__main__':