i am writing following command
@bot.command(pass_context=True)
async def admins_only_command(ctx, *, args):
'''do stuff
how can i restrict this command to admins only? I tried looking at ctx.author.roles.role
and it says @everyone
. How can i check if the given user is an admin
or not?
There are two ways: by a whitelist of roles using
has_any_role
or by permission using
has_permissions
Both of these decorators are Checks, and will raise some subclass of
CommandError
for you to optionally handle if they fail.