#Get users who has reacted on a message without addevent

12 messages · Page 1 of 1 (latest)

glad junco
#

When I start the bot, the bot gets the last message in the channel. I want to check which user has reacted a specific icon.
I would say loop over the reactions of the message but their are no users coupled at the reaction.

ivory groveBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

ivory elk
#

you have to fetch the users for the specific reaction, fetching a message does not include them.
<MessageReaction>.users.fetch()

glad junco
#

Thank you!

glad junco
#

I get the error
Cannot read properties of undefined (reading 'fetch')

The code is
const channel = client.channels.cache.get("1014647044117381221");
channel.messages.fetch({ limit: 100 }).then(messages => {
messages.forEach(message => {
channel.messages.fetch(message).then(reactionMessage => {
reactionMessage.users.fetch();
});
})
})

ivory elk
#

reactionMessage would either be a <Message> or a <Collection<Snowflake, Message>>, but not a <MessageReaction>

rotund pasture
glad junco
rotund pasture
glad junco
#

Can you please give an example?

rotund pasture