events.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:BlitzcrankBotV2 作者: SuperFrosty 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号