【问题标题】:Collecting users who reacted to a message using discord.js使用 discord.js 收集对消息做出反应的用户
【发布时间】:2018-04-03 06:58:19
【问题描述】:

我正在尝试收集对特定消息做出反应的所有用户。 我的代码

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

【问题讨论】:

    标签: javascript node.js discord discord.js


    【解决方案1】:

    根据docs,它只是reaction.users

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

    【讨论】:

    • 谢谢。出于某种原因,我认为它是 react.emoji.users。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-24
    • 2021-07-02
    • 2021-05-14
    • 2021-04-02
    • 2020-05-17
    • 2021-03-31
    • 2021-05-26
    相关资源
    最近更新 更多