'Having trouble with check = True using on_raw_reaction_add
I'm having trouble with my check = True. I can't seem to get identify the member making the reaction. Here is the code:
@bot.command()
async def buy(ctx):
reaction = await ctx.reply('Pick \U0001f44d')
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
def check(pl):
return pl == payload.member and str(payload.emoji) == '\U0001f44d'
try:
pl = await bot.wait_for('raw_reaction_add', timeout=3.0, check=check)
except asyncio.TimeoutError:
await channel.send("no one picked")
await payload.member.send("you")
else:
if payload.emoji == '\U0001f44d':
await channel.send("you picked 1")```
My I idea is to have someone call the command and then allowing more than one member to be able to react thus the bot.event. What am I doing wrong for my check to not = True?
Solution 1:[1]
Maybe you have an issue with the check I suggest to replace your check with this:
check = lambda payload: payload.message_id == msg.id and payload.channel_id == ctx.channel.id and str(payload.emoji) == '\U0001f44d'
payload = await client.wait_for('raw_reaction_add', check=check, timeout=30)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ali FGT |
