message on reaction add event v14.3.0
client.rest.on(Events.MessageReactionAdd, async (reaction, user) => {
Hello, is anyone knows how i can get the reaction that are added from a specific message in 14.3.0 ?24 Replies
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
1) You don't need to go through
.rest
; just client.on(...)
is correct for almost every event
2) Compare reaction.message.id
to the id of the specific message
3) reaction.emoji
is the emoji that was addedthat's what i've done
and i'm getting
From the guide:
well, i logged client and got that :
That looks like all of discord.js' exports, not a Client instance
`
index.js
and then my command i go in the execute function
nope
The messageReactionAdd event isn't a command though...
or maybe is it this ?
yes he's in the execute of a command
š¤Ø š why ?
the first time you create the command, you make one messageReactionAdd event listener
1 total
the second time you create the command, you make one messageReactionAdd event listener
2 total
etc.
These are designed for temporary use, and you can create them to only listen on specific messages
so i should pass with a collector of reaction on my specific message ?
what do you mean by "pass"
i should go and change my code for...
That's what I would do since you're not using a persistent database for each message that you care about
but i don't understand the utility of Events.MessageReactionAdd then, in which case should we use it ?
yes
If you care about listening to reactions as soon as the bot starts, use the client event
If you care about listening to reactions when a command is used, use collectors
in my case it's when i do my command, i send a message with reactions, i wait for a certain time to catch all reactions to then do something
so it's case 2 ?
Correct
Use the collector's
end
event whose first parameter is a Collection of each reaction added since the collector was createdend is when the filter is "true" ?
mmh and what's interesting is that in the filter i can check roles of user who react to collect it or no ?
yep
I have this filter condition, i enter to my
collector.on()
when i react to A, but when i react to B, i still enter to my collector.on()
Does anyone knows what happens in my filter ?
it logs true then false but still enter in it š¤
i must rename filterReactionCollector to filter ?
that's a good answer ! ty !