def on_command_error(self, ctx, error):
"""Error handling"""
error_msg = None
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send(error)
elif isinstance(error, commands.CommandNotFound):
pass
elif isinstance(error, commands.CommandInvokeError):
original = error.original
if isinstance(original, discord.Forbidden):
await ctx.send("I need to have the 'embed links' permission to send messages!")
return
elif isinstance(original, exceptions.Halt):
return
print('{0.created_at}: {0.author}: {0.content}'.format(ctx.message))
print(error)
embed = discord.Embed(title="An unexpected error occured :I", colour=0xCA0147,
description="If you feel like this shouldn't be happening [click here to join my support server](https://discord.gg/UP4TwFX).")
await ctx.send("", embed=embed)
else:
print('{0.created_at}: {0.author}: {0.content}'.format(ctx.message))
print(str(error))
评论列表
文章目录