#Get users who has reacted on a message without addevent
12 messages · Page 1 of 1 (latest)
• 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.
you have to fetch the users for the specific reaction, fetching a message does not include them.
<MessageReaction>.users.fetch()
Thank you!
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();
});
})
})
reactionMessage would either be a <Message> or a <Collection<Snowflake, Message>>, but not a <MessageReaction>
Also why refectch each fetched message individually right away? The fetched messages are already freshly fetched…
This gives says message.reactions.forEach is not a function
const channel = client.channels.cache.get("1014647044117381221");
channel.messages.fetch({ limit: 100 }).then(messages => {
messages.forEach(message => {
message.reactions.forEach(reaction =>{
reaction.users.then(user =>{
console.log(user)
});
})
})
})
Because That’s a ReactionManager. Use its cache or fetch the reactions
I dont know what you are talking about ...
Can you please give an example?
message.reactions.cache.forEach