I'm trying to make a selection screen with two options (two reactions) which the user can react to, and the bot will now what reaction did the user chose
I've tried comparing
reaction != "????" or reaction != "β"
Also tried:
reaction != u"\U0001F44C" or reaction != u"\u270B"
using the unicode.
Also tried the same code with reaction.emoji, str(reaction / reaction.emoji).
Also tried comparing the id of the emojis but reaction.emoji.id raise an exception saying that reaction.emoji is a str and strings doesn't have id
(because idk why it returns a str instead of a emoji object)
I've read the docs and it says it supports != operations but I don't know what to compare
@bot.event
async def on_reaction_add(reaction,user):
print(reaction) #It prints the two emojis on my console (???? and β)
if user.bot:
print('I am a bot')
return
if reaction != "????" or reaction != "β":
print('Did not found the emoji')
return
else:
print('Found the emoji')
#And then some code which will decide if the user that reacted is valid and what to do with it
#The embed the user have to react to if this helps
embed = discord.Embed(title = 'VS',color=0x00fff5)
embed.set_author(name = message.author.name,icon_url=message.author.avatar_url)
embed.set_footer(text = message.mentions[0].name , icon_url = mensaje.mentions[0].avatar_url)
response = await message.channel.send(embed = embed)
await response.add_reaction("????") #OK emoji
await response.add_reaction("β") #STOP emoji
I expect the bot to recognize the emojis but don't know how.
str(reaction.emoji) == 'π'
as you tried. I am wondering if this lineif str(reaction.emoji) != "π" or str(reaction.emoji) != "β":
can ever evaluate toFalse
though. Could you try something simpler likeif str(reaction.emoji) == "π": print("OK reaction found")
β kcontrClient.wait_for
instead ofon_reaction_add
β Patrick Haugh