1
0
Fork 0
mirror of synced 2024-05-19 20:12:30 +12:00

Added error handling for trying to run a command without permissions

This commit is contained in:
phxntxm 2016-07-13 16:16:47 -05:00
parent 57c820d3c7
commit f37e094d13

3
bot.py
View file

@ -57,6 +57,9 @@ async def on_command_error(error, ctx):
elif isinstance(error, commands.BadArgument):
fmt = "Please provide a valid argument to pass to the command: {}".format(error)
await bot.send_message(ctx.message.channel, fmt)
elif isinstance(error, commands.CheckFailure):
fmt = "You do not have permissions to run that command!"
await bot.send_message(ctx.message.channel, fmt)
else:
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
await bot.send_message(ctx.message.channel, fmt.format(type(error).__name__, error))