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.