【问题标题】:Struggling to remove a reaction from specific user in discord.js. Says remove not defined努力从 discord.js 中删除特定用户的反应。说删除未定义
【发布时间】:2020-07-21 21:37:52
【问题描述】:

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

.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),

【问题讨论】:

  • 小错字:sentEmbed.reactions(以 s 结尾)

标签: javascript discord discord.js


【解决方案1】:

我猜你正在使用 discord.js v12。如果是,则收集的反应现在正在使用缓存。所以你需要更换:

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

【讨论】:

    猜你喜欢
    • 2021-05-18
    • 2020-02-21
    • 2021-08-12
    • 2019-09-05
    • 1970-01-01
    • 1970-01-01
    • 2016-12-12
    • 2022-08-18
    相关资源
    最近更新 更多