【发布时间】:2021-02-01 04:21:57
【问题描述】:
我正在尝试使用收集器为我的 Discord JS 机器人创建轮询功能。我遵循了关于制作收藏家的指南here。我的具体代码如下:
client.on('message', msg => {
msg.channel.send("This message has a reactor collector").then(function(mesg) {
const filter = (reaction, user) => {
return true
}
const collector = mesg.createReactionCollector(filter, { time: 15000 });
collector.on('collect', (reaction, user) => {
}
});
collector.on('end', collected => {
mesg.reactions.removeAll().catch(error => console.error('Failed to clear reactions: ', error));
})
}
}
错误是当我尝试清除 collector.on('end' 语句中的所有反应时。这是确切的错误:TypeError: mesg.reactions.removeAll is not a function
根据this 链接,我使用完全相同的代码来删除反应,但它似乎不起作用。有谁知道如何解决这个问题?
提前感谢您的帮助:)
【问题讨论】:
-
你的 discord.js 版本是多少?
-
欢迎您!请在标签中添加
discord.js。 -
我相信我使用的是 Discord JS 的最新版本(12.3.1)。
-
链接似乎失效了,网站无法加载
标签: javascript discord.js