Reading reaction info
I am attempting to take an array of reactions on a given message and identify the individual users that have posted each reaction. I have run into an issue where I can only reliably console.log the bot's user ID, and the list does not contain the rest of the user IDs unless the command is run immediately following a reaction state change (someone adds one). The other issue I'm running into is that I can console.log the information, but I can't seem to access it programmatically.
This line of code is turning the reaction.users circular collection into something I can read in the console.
Before that line is stringifying the array, this block is trying to read each element of the reactions.users array and console log it:
This is not working. The console log is returning a list of userIDs in the stringified log, but returning
Id:
for the block that is trying to get the user IDs. I am not sure what to do or try next, as I've already dug through youtube, guides, and chatGPT12 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!what does
reaction.users.cache.size
returnno errors?
I will check on mark’s question in a bit
But yeah it’s not throwing any errors, just returning an empty list
Documentation suggestion for @lexitorius:
:method: ReactionUserManager#fetch()
Fetches all the users that gave this reaction. Resolves with a collection of users, mapped by their ids.
you may need to fetch the users
Will look into reactionusermanager might have to watch some tutorial vids tho lol
show what you have written
There's more above but not super related
reactions is an array of the reaction objects
the part that you define
reactions
this won't work if you're fetching older messages (not cached), you need to fetch the users https://discord.com/channels/222078108977594368/1210680446740992121/1210790135990460426