提问者:小点点

收集使用discord.js对消息作出反应的用户


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

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

但它返回未定义。如果我使用“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个答案

匿名用户

根据文档,这只是反应。users:

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