Added error handling for Invalid Commands
This commit is contained in:
parent
76db201274
commit
d79ef7281c
2
bot.py
2
bot.py
|
@ -49,6 +49,8 @@ async def on_member_remove(member):
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_command_error(error, ctx):
|
async def on_command_error(error, ctx):
|
||||||
|
if isinstance(error,discord.CommandNotFound):
|
||||||
|
await bot.send_message(ctx.message.channel,"That is not a valid command! If you need asistance on what command to use, please type '!help'")
|
||||||
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
|
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
|
||||||
await bot.send_message(ctx.message.channel,fmt.format(type(error).__name__, error))
|
await bot.send_message(ctx.message.channel,fmt.format(type(error).__name__, error))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue