Thundo
Thundo

Reputation: 173

Getting the missing permission

How can i get the Missing permission? (api's "missing_perms")

elif isinstance(error, commands.MissingPermissions):
            await ctx.message.delete()
            error = discord.Embed(
                title = 'Error',
                description = 'Missing permission!',
                colour = discord.Colour.red()
            )
            error.set_footer(text=version)
            textMsg = await ctx.send(embed=error)
            await textMsg.delete(delay=4)

something like "manage_guild"

Upvotes: 0

Views: 81

Answers (1)

Patrick Haugh
Patrick Haugh

Reputation: 60944

The MissingPermissions object has an attribute missing_perms, which is a list of the missing permissions:

elif isinstance(error, commands.MissingPermissions):
            await ctx.message.delete()
            embed= discord.Embed(
                title = 'Error',
                description = f'Missing permissions: {error.missing_perms}',
                colour = discord.Colour.red()
            )
            embed.set_footer(text=version)
            textMsg = await ctx.send(embed=embed)
            await textMsg.delete(delay=4)

Upvotes: 1

Related Questions