Home > Software design >  discord.py exception for when bot doesn't have permission
discord.py exception for when bot doesn't have permission

Time:10-31

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

does not work and I'm guessing it's because I'm actually getting error discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions but I cannot find how to except it

I'm also doing it globally not per command

CodePudding user response:

@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")
  • Related