Answers for "all permissions"


how to limit a command to a permission in

# Make sure you don't have a command called "commands"
@client.command() # As usual
@commands.has_permissions(administrator=True) # Making sure the person executing the command has the permissions
async def foo(ctx):
	await ctx.send("Hello")
Posted by: Guest on September-29-2020
3 how to use permissions

from discord import Member
from discord.ext.commands import has_permissions, MissingPermissions

@bot.command(name="kick", pass_context=True)
@has_permissions(manage_roles=True, ban_members=True)
async def _kick(ctx, member: Member):
    await bot.kick(member)

async def kick_error(error, ctx):
    if isinstance(error, MissingPermissions):
        text = "Sorry {}, you do not have permissions to do that!".format(
        await bot.send_message(, text)
Posted by: Guest on October-10-2020

Code answers related to "all permissions"

Python Answers by Framework

Browse Popular Code Answers by Language