【发布时间】:2020-11-06 03:00:02
【问题描述】:
我正在尝试制作一个发送嵌入的 Discord.js 赠品命令,将其保存到变量 embedSent,在 TimeOut 之后使用反应.get() 方法收集反应,使用 array() 将它们转换为数组然后用 .filter() 过滤它们。问题出在 Array() 步骤,我不断收到错误TypeError: peopleReactedBot.array is not a function。
这是我的代码的一部分:
embedSent.react("????");
setTimeout(function () {
try {
const peopleReactedBot = embedSent.reactions.cache.get("????").users.fetch();
const peopleReacted = peopleReactedBot.array().filter(u => u.id !== client.author.id);
message.channel.send(peopleReacted)
} catch(e) {
return message.channel.send("An error has occured : `"+e+"`");
}
}, time);
我使用 Discord.js v12。
【问题讨论】:
标签: javascript arrays discord bots discord.js