Python
- 135 ответов
- 0 вопросов
83
Вклад в тег
@commands.has_any_role
discord.ext.commands.has_any_role(*items)
A check() that is added that checks if the member invoking the command has any of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.
Similar to has_role(), the names or IDs passed in must be exact.
This check raises one of two special exceptions, MissingAnyRole if the user is missing all roles, or NoPrivateMessage if it is used in a private message. Both inherit from CheckFailure.
Changed in version 1.1: Raise MissingAnyRole or NoPrivateMessage instead of generic CheckFailure
Parameters
items (List[Union[str, int]]) – An argument list of names or IDs to check that the member has roles wise.
Example
content_copy
@bot.command()
@commands.has_any_role('Library Devs', 'Moderators', 492212595072434186)
async def cool(ctx):
await ctx.send('You are cool indeed')