谁反应,使用discord.js消息收集用户(Collecting users who reacte

2019-09-27 03:37发布

我试图收集已反应一定信息的所有用户。 我的代码

client.on('messageReactionAdd', (reaction, user) => {
    if(reaction.emoji.name === "✅") {
    console.log(reaction.emoji.users);
}

但它返回undefined。 如果我使用“reaction.emoji”返回

ReactionEmoji {
  reaction: 
   MessageReaction {
     message: 
      Message {
        channel: [Object],
        id: '371695165498458115',
        type: 'DEFAULT',
        content: 'bb',
        author: [Object],
        member: [Object],
        pinned: false,
        tts: false,
        nonce: '371695172469129216',
        system: false,
        embeds: [],
        attachments: Collection {},
        createdTimestamp: 1508689433217,
        editedTimestamp: null,
        reactions: [Object],
        mentions: [Object],
        webhookID: null,
        hit: null,
        _edits: [] },
     me: true,
     count: 1,
     users: Collection { '370300235030986752' => [Object] },
     _emoji: [Circular] },
  name: '✅',

我试图让users: Collection { '370300235030986752' => [Object] },的一部分。 提前致谢。

Answer 1:

根据该文档是刚reaction.users

client.on('messageReactionAdd', (reaction, user) => {
    if(reaction.emoji.name === "✅") {
        console.log(reaction.users);
    }
});


文章来源: Collecting users who reacted to a message using discord.js