Reputation: 9
how i can set kick command with a role use just that Moderator role will can use my kick command :
@client.command(pass_context = True)
async def kick(ctx, userName: discord.User):
"""Kick A User from server"""
await client.kick(userName)
await client.say("__**Successfully User Has Been Kicked!**__")
Upvotes: 1
Views: 8167
Reputation: 3205
You can use the commands.has_permissions
decorator to ensure the caller has a specific permission.
@client.command(...)
@commands.has_permissions(kick_members=True)
async def kick(ctx, ...):
pass
Just a word of warning though, according to the function docstring, it checks for the user having any required permission instead of all.
It is also recommended to add the bot_has_permissions
check too to make sure it can actually kick users too.
Upvotes: 1