Check out this Discord.js code snippet for a Discord bot:
client.channels.fetch('channelID here').then(function (channel) {
channel.messages.fetch('messageID here').then(function (message) {
console.log(message.reactions.cache.get('EmojiID here').users);
});
});
When executed, the console displays the following information:
ReactionUserManager {
cacheType: [class Collection extends Collection],
cache: Collection [Map] {},
reaction: MessageReaction {
message: Message {
channel: [TextChannel],
deleted: false,
id: 'MessageID here',
type: 'DEFAULT',
system: false,
content: 'What role do you want?\n' +
'React with:\n' +
'<:Red:870224025811558450> for <@&870162738561814578> \n' +
'<:Blue:870224213976444959> for <@&870162842983206922> \n' +
'<:Yellow:870224106061172776> for <@&870162885412810773>\n' +
'You will be assigned the role corresponding to your most recent reaction.\n' +
'Unreact to remove the role.',
author: [User],
pinned: false,
tts: false,
nonce: null,
embeds: [],
attachments: Collection [Map] {},
createdTimestamp: 1627548937713,
editedTimestamp: 1627617831107,
reactions: [ReactionManager],
mentions: [MessageMentions],
webhookID: null,
application: null,
activity: null,
_edits: [],
flags: [MessageFlags],
reference: null
},
me: true,
users: [Circular],
_emoji: ReactionEmoji {
animated: undefined,
name: 'Red',
id: 'EmojiID here',
deleted: false,
reaction: [Circular]
},
count: 2
}
}
In the output, count: 2
is shown. To retrieve the list of objects associated with these two users, how can this be accomplished?