Issue reading list of users who have reacted to a message

Afternoon, I'm creating a voting system in one of my servers that has users choose one of eight options. I am currently attempting to get the bot to reliably read the list of users that have reacted to each reaction, while also ignoring its own reactions. Related code
if (victors.length===1) {
thmb = highestCountReactions.map((info) => raidMasterList.find((raid) => raid.emj===info.name)?.icon || info.name);
title = `Raid Vote: ${victors}`;
desc = `${victors} wins with ${highestCountReactions[0].count} votes!`;
} else if (victors.length>1) {
title = `Raid Vote: TIE!`;
desc = `__Raid vote ended in a tie__\n\`-\` ${victors.join('\n\`-\` ')}`
}

const eRaidVote = new EmbedBuilder()
.setTitle(`${title}`)
.setDescription(`${desc}`)
.setColor(0x00ff00)
.setThumbnail(`${thmb}`)

reactions.forEach(reaction => { if (reaction.count>1) { console.log(JSON.stringify(reaction.users,null,2)); } })
//trgtMsg.reactions.removeAll();
await interaction.reply({embeds: [eRaidVote]});
if (victors.length===1) {
thmb = highestCountReactions.map((info) => raidMasterList.find((raid) => raid.emj===info.name)?.icon || info.name);
title = `Raid Vote: ${victors}`;
desc = `${victors} wins with ${highestCountReactions[0].count} votes!`;
} else if (victors.length>1) {
title = `Raid Vote: TIE!`;
desc = `__Raid vote ended in a tie__\n\`-\` ${victors.join('\n\`-\` ')}`
}

const eRaidVote = new EmbedBuilder()
.setTitle(`${title}`)
.setDescription(`${desc}`)
.setColor(0x00ff00)
.setThumbnail(`${thmb}`)

reactions.forEach(reaction => { if (reaction.count>1) { console.log(JSON.stringify(reaction.users,null,2)); } })
//trgtMsg.reactions.removeAll();
await interaction.reply({embeds: [eRaidVote]});
The line in particular is the third from bottom, which is supposed to take all reactions that are greater than 1 (in order to ignore the bot's) and list the users associated with them. When I do let it include itself, it lists the bot's user ID correctly, but it otherwise returns this:
{
"reaction": {
"messageId": "1210638706126626936",
"me": false,
"users": [],
"count": 2,
"emojiId": "1090404643953201234"
}
{
"reaction": {
"messageId": "1210638706126626936",
"me": false,
"users": [],
"count": 2,
"emojiId": "1090404643953201234"
}
I have tried looking up reaction guides on youtube, documentation, and bickering with chatGPT, to no avail. I have all intents enabled so it's not an intent issue
2 Replies
d.js toolkit
d.js toolkit•8mo ago
- 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! - ✅ Marked as resolved by OP
lexitorius
lexitorius•8mo ago
Nevermind, it has all of a sudden decided to start working correctly even though I didn't change anything in the code
Want results from more Discord servers?
Add your server