Catch failures to send messages on exceptions
This commit is contained in:
parent
f99afec44f
commit
3f2f7e77a3
3
bot.py
3
bot.py
|
@ -91,6 +91,7 @@ async def on_command_error(error, ctx):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
if isinstance(error, commands.BadArgument):
|
if isinstance(error, commands.BadArgument):
|
||||||
fmt = "Please provide a valid argument to pass to the command: {}".format(error)
|
fmt = "Please provide a valid argument to pass to the command: {}".format(error)
|
||||||
await ctx.message.channel.send(fmt)
|
await ctx.message.channel.send(fmt)
|
||||||
|
@ -118,6 +119,8 @@ async def on_command_error(error, ctx):
|
||||||
except:
|
except:
|
||||||
traceback.print_tb(error.__traceback__, file=f)
|
traceback.print_tb(error.__traceback__, file=f)
|
||||||
print('{0.__class__.__name__}: {0}'.format(error), file=f)
|
print('{0.__class__.__name__}: {0}'.format(error), file=f)
|
||||||
|
except discord.HTTPException:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue