Issue
I Want My Discord.py Bot To Wait For 2 Reactions...
The Code:
def check(reaction, user):
return user == message.author and str(reaction.emoji) == '1️⃣'
def check(reaction, user):
return user == message.author and str(reaction.emoji) == '2️⃣'
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)
Solution
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
Answered By - Bagle Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.