Madder
Madder
DIAdiscord.js - Imagine an app
Created by Madder on 6/1/2024 in #djs-questions
Trying to pull users who reacted to a specified message with a specified emoji, need some guidance
Here's my code, can't seem to get reactedUsers to populate with the right values. This makes it a map with 0 length. Is there anything obvious I'm missing here?
async execute(interaction) {
await interaction.deferReply();
var message = await interaction.channel.messages.fetch(
interaction.options.getString("targetmessage")
);

var reactedUsers = await message.reactions.resolve(":poop:").users.cache;

var winner = reactedUsers[Math.random(reactedUsers.count() - 1)];

await interaction.editReply(
`${winner.displayName} is the winner of the giveaway!`
);
},
async execute(interaction) {
await interaction.deferReply();
var message = await interaction.channel.messages.fetch(
interaction.options.getString("targetmessage")
);

var reactedUsers = await message.reactions.resolve(":poop:").users.cache;

var winner = reactedUsers[Math.random(reactedUsers.count() - 1)];

await interaction.editReply(
`${winner.displayName} is the winner of the giveaway!`
);
},
40 replies