Skip to content Skip to sidebar Skip to footer

Admins Only Command

Only selected user id's should have permission to use this command. like below only user ids added in this list should get permission to use that command. def is_any_user(ids):

Solution 1:

You can write your own check that can decorate the command

defis_any_user(ids):
    defpredicate(ctx):
        return ctx.message.author.idin ids
    return commands.check(predicate)

LIST_OF_ADMINS = ['3557657657647676', '36567565756766767', '343657687786435432']

@bot.command(pass_context=True)@is_any_user(LIST_OF_ADMINS)asyncdefhello(ctx):
     await bot.say("Hello {}".format(ctx.message.author.mention))

You can read more about checks in the commands extension in the documentation

Post a Comment for "Admins Only Command"