1
votes

I'm making a command for my bot where it sends you this message:enter image description here

The two reactions (tick and cross) become pre-reacted by the bot to show the user what to do. I wan't my bot to wait a set period of time and check for what the user has reacted with, at the moment my bot counts its own reactions so the count is false.

How would I go about doing this, everything I have tried has failed and I can no longer Ctrl+Z to the point where I have a vaguely working code.

Thanks.

EDIT: I actually fixed my problem about half an hour ago after many attempts, here's what I used:

res1 = await client.wait_for_reaction(emoji="✅", message=message_1, timeout=10)
res2 = await client.wait_for_reaction(emoji="❌", message=message_1, timeout=10)
if not res1.user == None or not res2.user == None:
   if not res1.user.id == client.user or res2.user.id == client.user:
1
at the moment my bot counts its own reactions so the count is false. can you show us your code?Tristo

1 Answers

1
votes

The best way to do this is to add a check to you wait_for_reaction that just checks the reacting user against client.user. This has the benefit of also working in scenarios where you want to accept exactly one reaction, and can't do another loop if you accidentally see a bot reaction

def not_bot_reaction(reaction, user):
    return user != client.user

...

res1 = await client.wait_for_reaction(emoji="✅", message=message_1, timeout=10, check=not_bot_reaction)
res2 = await client.wait_for_reaction(emoji="❌", message=message_1, timeout=10, check=not_bot_reaction)

if res1 or res2:  # If the wait_for times out, it will return None instead of the namedtuple
    ...