Answer the question
In order to leave comments, you need to log in
How to check for a role?
Hello, how to check if the user who sent the message has a certain role.
For example, we enter the .role command and if this user has the desired role, then we display a message.
Answer the question
In order to leave comments, you need to log in
You need to check for the presence of a role object :
@commands.command()
async def role(ctx):
role = ctx.bot.get_role(719997201283022879) # Получаем объект роли по ID
if role in ctx.author.roles:
await ctx.send("\N{WHITE HEAVY CHECK MARK}"} # ✅
else:
await ctx.send("\N{CROSS MARK}") # ❌
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question