Discord.py Reaction Counting don't word

Viewed 83

I am trying to get the number of users, who reacted on a message with a specific emoji, but my code isn't working, even through i dont find any mistakes i made. If i react with the first Emoji made its Working, but not with one of the other Emojis. Maybe one of you can help me?

My Code:

    msg = await ctx.send("Now: react to Move!")
    await msg.add_reaction("⬅️")
    await msg.add_reaction("➡️")
    await msg.add_reaction("⬆️")
    await msg.add_reaction("⬇️")
    msg = await ctx.fetch_message(msg.id)
    await asyncio.sleep(5)
    print(msg.reactions)

My output when i react with the "⬆️" Emoji:

[<Reaction emoji='⬅️' me=True count=1>, <Reaction emoji='➡️' me=True count=1>, <Reaction emoji='⬆️' me=True count=1>, <Reaction emoji='⬇️' me=True count=1>]

My output when i react with tne "⬅️" Emoji:

[<Reaction emoji='⬅️' me=True count=2>, <Reaction emoji='➡️' me=True count=1>, <Reaction emoji='⬆️' me=True count=1>, <Reaction emoji='⬇️' me=True count=1>]
1 Answers

Because you have to sleep before (not after) fetching the message again:

await asyncio.sleep(5)
msg = await ctx.fetch_message(msg.id)
print(msg.reactions)

It's a really simple mistake

Related