我正在尝试收集对特定消息做出反应的所有用户.我的代码
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);
}
});
这篇关于使用 discord.js 收集对消息做出反应的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
discord.js v12:我如何等待 DM 频道中的消息?discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 频道中的消息?)
如何让我的机器人提及发出该机器人命令的人how to make my bot mention the person who gave that bot command(如何让我的机器人提及发出该机器人命令的人)
如何修复必须使用导入来加载 ES 模块 discord.jsHow to fix Must use import to load ES Module discord.js(如何修复必须使用导入来加载 ES 模块 discord.js)
如何列出来自特定服务器的所有成员?How to list all members from a specific server?(如何列出来自特定服务器的所有成员?)
Discord bot:修复“找不到 FFMPEG"Discord bot: Fix ‘FFMPEG not found’(Discord bot:修复“找不到 FFMPEG)
使用 discord.js 加入 discord 服务器时的欢迎消息Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服务器时的欢迎消息)