使用discord.js收集对邮件作出反应的用户

时间:2017-10-22 17:46:38

标签: javascript node.js discord discord.js

我试图收集对某些消息做出反应的所有用户。 我的代码

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] },部分。提前致谢。

1 个答案:

答案 0 :(得分:3)

根据docs,它只是reaction.users

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