【发布时间】:2020-09-18 22:57:12
【问题描述】:
我正在编写一个不和谐机器人,我需要知道谁对指定消息做出了反应,并将他们的用户名放入不和谐嵌入中。
代码如下:
MSG.messages.fetch({ around: GameID, limit: 1 }).then((msg) => {
fetchedMsg = msg.first();
let MessageOBJ = fetchedMsg.reactions.cache.get("????");
const embed = new Discord.MessageEmbed()
.setTitle("All players here !")
.setDescription("Here's all of the players for this game")
.addField(
"Players",
MessageOBJ.users.fetch().then((users) => {
users.forEach((element) => {
`${element.username}\n`;
});
})
);
fetchedMsg.edit(embed);
});
但是,机器人在嵌入的 Players 类别中显示 [object Promise]。
【问题讨论】:
-
使用
Array.prototype.map()而不是Array.prototype.forEach() -
我试过了,但这仍然给了我 [object Promise]
-
你可以试试
console.log(users)吗? -
我会,但我是问题
标签: javascript node.js discord discord.js es6-promise