discord.py: How to do Bot is missing permissions?

Viewed 53

UPDATE:

I found out the reason why, here is new working code:

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandInvokeError):
        return

Hope it works! <3

2 Answers

Use discord.Forbidden

Try:

if isinstance(error, discord.Forbidden):
     await ctx.send("Bot doesn't have permissions to do this **or** the bot can't do this. Please try again.")

You failed in code not

BotMissingPermissions

Try this code if isinstance(error, commands.CommandNotFound):

or if isinstance(error, commands.MissingPermissions):

Related