1# Make sure you don't have a command called "commands"
2@client.command() # As usual
3@commands.has_permissions(administrator=True) # Making sure the person executing the command has the permissions
4async def foo(ctx):
5 await ctx.send("Hello")
6 #ect
1from discord import Member
2from discord.ext.commands import has_permissions, MissingPermissions
3
4@bot.command(name="kick", pass_context=True)
5@has_permissions(manage_roles=True, ban_members=True)
6async def _kick(ctx, member: Member):
7 await bot.kick(member)
8
9@_kick.error
10async def kick_error(error, ctx):
11 if isinstance(error, MissingPermissions):
12 text = "Sorry {}, you do not have permissions to do that!".format(ctx.message.author)
13 await bot.send_message(ctx.message.channel, text)
14