There are two ways: by a whitelist of roles using has_any_role
@bot.command(pass_context=True)
@commands.has_any_role("Big Cheese", "Medium Cheese")
async def admins_only_command(ctx, *, args):
'''do stuff'''
or by permission using has_permissions
@bot.command(pass_context=True)
@commands.has_permissions(administrator=True)
async def admins_only_command(ctx, *, args):
'''do stuff'''
Both of these decorators are Checks, and will raise some subclass of CommandError
for you to optionally handle if they fail.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…