Added error handling for trying to run a command without permissions
This commit is contained in:
parent
57c820d3c7
commit
f37e094d13
3
bot.py
3
bot.py
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue