0
votes

My Discord bot can only react to reactions added to messages sent after the bot started. It won't react if I add a reaction to an old message. How can I make it react to every reaction added, no matter when the message was sent?

@client.event
async def on_reaction_add(reaction, user):
    print(str(reaction.emoji), str(user))

When I add a reaction to a message sent after the Bot started, it works just fine.

User#1234 added a reaction to a message

When I add a reaction to a message sent before the Bot started, it doesn't do anything.

1

1 Answers

1
votes

on_reaction_add will only work for messages stored in the bots internal cache, which will only include those sent after it started. To process reactions from other messages, you must use the on_raw_reaction_add event:

@client.event
async def on_raw_reaction_add(payload):
    user = client.get_user(payload.user_id)
    print(str(payload.emoji), str(user))