努力从discord.js中删除特定用户的反应。说删除未定义

时间:2020-07-21 04:25:01

标签: javascript discord discord.js

我试图通过向左或向右反应来使页面正常工作。那行得通,但我似乎无法撤消用户的反应。它告诉我删除未定义

.then(sentEmbed => {
            sentEmbed.react("⬅️"),
                sentEmbed.react("➡️")
            const filterLeft = (reaction, user) => reaction.emoji.name === '⬅️' && user.id === author;
            const filterRight = (reaction, user) => reaction.emoji.name === '➡️' && user.id === author;
            const collectorLeft = sentEmbed.createReactionCollector(filterLeft, { time: 15000 });
            const collectorRight = sentEmbed.createReactionCollector(filterRight, { time: 15000 });
            collectorRight.on('collect', r => {

                currentMessage = sentEmbed.id,
                    client.channels.cache.get(channel).send(currentMessage),
                    sentEmbed.reaction.remove(author),

1 个答案:

答案 0 :(得分:0)

我认为您正在使用discord.js v12。如果是,则收集的反应现在正在使用缓存。因此,您需要替换:

sentEmbed.reaction.remove(author);sentEmbed.reaction.users.remove(author);