discord.py 机器人没有权限时的异常

discord.py exception for when bot doesn't have permission

async def on_command_error(ctx, error):
    if isinstance(error, BotMissingPermissions):
        await ctx.send("I dont have the permission to do that")``

不起作用,我猜这是因为我实际上遇到了错误 discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions 但我找不到如何排除它

我也在全球范围内执行此操作,而不是按命令执行

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, discord.Forbidden):
        await ctx.send("I dont have the permission to do that")