【问题标题】:discord.py exception for when bot doesn't have permission当 bot 没有权限时出现 discord.py 异常
【发布时间】:2021-12-15 05:59:01
【问题描述】:
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 但我找不到除此之外的方法

我也在全局范围内而不是按命令进行操作

【问题讨论】:

    标签: python exception discord discord.py


    【解决方案1】:
    @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")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-03
      • 2021-08-12
      • 2021-03-27
      • 2015-11-09
      • 2021-09-30
      • 1970-01-01
      • 2019-08-14
      • 2022-01-05
      相关资源
      最近更新 更多