I Want My Discord.py Bot To Wait For 2 Reactions...
The Code:
mm = await message.send(embed=embed1)
await mm.add_reaction("1️⃣")
await mm.add_reaction("2️⃣")
reaction, user = await bot.wait_for("reaction_add",check=check,timeout=180)
reaction, user = await bot.wait_for("reaction_add",check=check,timeout=180)
if reaction:
await mm.edit(embed=embed1)
elif reaction:
await mm.edit(embed=embed3)
The Check Function: def check(reaction, user): return user == message.author and str(reaction.emoji) == ['1️⃣', '2️⃣']
CodePudding user response:
Within your check
function, you can check if the user's reaction is one in a given list, or you can use an or statement
. In this example, I will use the former. Then, you can check which reaction it is, and continue from there. Do view the revised code below.
def check(reaction, user):
# Check if user is the author of the message
# AND if the reaction emoji is in a list of set reactions, 1️⃣ and 2️⃣
return user == ctx.author and str(reaction.emoji) in ["1️⃣","2️⃣"]
await mm.add_reaction("1️⃣")
await mm.add_reaction("2️⃣")
reaction, user = await bot.wait_for("reaction_add",check=check,timeout=180)
if str(reaction.emoji) == "1️⃣":
# do something
elif str(reaction.emoji) == "2️⃣":
# do something else