问题描述
我正在尝试收集对特定消息做出反应的所有用户.我的代码
I'm trying to collect all users that have reacted to certain message. My code
client.on('messageReactionAdd', (reaction, user) => { if(reaction.emoji.name === "?") { console.log(reaction.emoji.users); }
但它返回未定义.如果我使用reaction.emoji"它会返回
But it returns undefined. If I use "reaction.emoji" it returns
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' =>[对象] }, 部分.提前致谢.
I'm trying to get the users: Collection { '370300235030986752' => [Object] }, part. Thanks in advance.
推荐答案
根据docs 它只是 reaction.users:
client.on('messageReactionAdd', (reaction, user) => { if(reaction.emoji.name === "?") { console.log(reaction.users); } });