问题
I need to make a command that can only be executed by someone that has a certain role. I searched around on google and youtube to find a answer but came up with nothing
回答1:
You can add a decorator on the command to restrict it to only members with specific roles or permissions. The documentation for it is here. It would look like this:
@bot.command()
@commands.has_role('RoleName')
async def command_name():
Keep in mind that the RoleName string you pass is case sensitive.
来源:https://stackoverflow.com/questions/49351509/discord-py-how-to-make-a-role-specific-command