Reputation: 11
I am making a reaction role system, but when I react with the emoji I put, it does nothing. The code is here:
@bot.event
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 757982178691776635:
guild_id = payload.guild_id
guild = bot.get_guild(guild_id)
if payload.emoji.name == 'white_check_mark':
print('Role')
I get no error in console and it does not print Role in console.
Upvotes: 0
Views: 217
Reputation: 3426
You can get the emoji charcter from here and then compare it.
I made it a little bit shorter for ease of read.
@bot.event
async def on_raw_reaction_add(payload):
if payload.message_id == 757982178691776635:
guild = bot.get_guild(payload.guild_id)
if payload.emoji.name == '✅':
print('Role')
Upvotes: 0
Reputation: 1356
Try printing the value of payload.emoji.name
, it is going to be the emoji itself usually. If you want to match based on the unicode name, I suggest using unicodedata.name
Upvotes: 1