久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

DISCORD JS v13 createReactionCollector “收集"不工作

DISCORD JS v13 createReactionCollector quot;collectquot; doesn#39;t work(DISCORD JS v13 createReactionCollector “收集不工作)
本文介紹了DISCORD JS v13 createReactionCollector “收集"不工作的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

介紹

我想在

解決方案

我可以解決這個問題.

<塊引用>

與代碼無關,忘記添加 GUILD_MESSAGE_REACTIONS 意圖.

createReactionCollector 在 discord.js 中不起作用

const client = new Discord.Client({意圖:['GUILD_VOICE_STATES','GUILD_MESSAGES','GUILDS','GUILD_MESSAGE_REACTIONS'],});

Introduce

I want to use page generation from discord.js-pagination in discord.js v13. The source code use createReactionCollector but collect doesn't work.

In Detail

The two reaction buttons are displayed correctly. It also runs the timeout correctly and the two buttons are removed after 12000ms.

The problem is that there is no response when I press the reaction button. "collect" doesn't work.

I can't believe that "end" is executed, but "collect" is not. Could anyone give me a clue?

Source code

 static async paginationEmbed(msg: Message, pages:MessageEmbed[], emojiList = ['?', '?'], timeout = 12000)
 {
    if (!pages) throw new Error('Pages are not given.');
    if (emojiList.length !== 2) throw new Error('Need two emojis.');
    let page = pages.length - 1;
    const curPage = await msg.channel.send({ embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)]});

    for (const emoji of emojiList) await curPage.react(emoji);
    const filter = (reaction:MessageReaction, user:User) => {
        return true;
    }
    const reactionCollector = curPage.createReactionCollector({ filter, time: timeout });

    reactionCollector.on('collect', (reaction, user) => {
        console.log("I want to show this!!")

        reaction.users.remove(msg.author);
        switch (reaction.emoji.name) {
            case emojiList[0]:
                page = page > 0 ? --page : pages.length - 1;
                break;
            case emojiList[1]:
                page = page + 1 < pages.length ? ++page : 0;
                break;
            default:
                break;
        }
        curPage.edit({ embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)]});

    });

    reactionCollector.on('end', () => {
        if (!curPage.deleted) {
            curPage.reactions.removeAll()
        }
    });

    return curPage;
}


Enviroment

discord.js@13.1.0 (get by npm ls)

Addition

My Client is following:

const client = new Discord.Client({
 intents: ['GUILD_VOICE_STATES', 'GUILD_MESSAGES', 'GUILD_MEMBERS', 'GUILDS']
 });

createReactionCollector not triggering

解決方案

I can solve this problem.

Was unrelated to code, forgot to add the GUILD_MESSAGE_REACTIONS intent.

createReactionCollector not working in discord.js

const client = new Discord.Client({
 intents: ['GUILD_VOICE_STATES', 'GUILD_MESSAGES', 'GUILDS', 'GUILD_MESSAGE_REACTIONS'],
});

這篇關于DISCORD JS v13 createReactionCollector “收集"不工作的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 久久亚洲国产精品日日av夜夜 | 久久人人国产 | 日本午夜免费福利视频 | 国产精品久久av | 91原创视频 | 成人亚洲视频 | 亚洲精品视频在线 | 日韩www| 亚洲成av人片在线观看 | 亚洲国产精品久久久久 | 超碰在线人人 | 狠狠av | 亚洲欧美在线一区 | 啪啪综合网 | 久久亚洲欧美日韩精品专区 | 欧美区日韩区 | 国产夜恋视频在线观看 | 国产高清一区二区 | 国产成人在线观看免费 | 国产一级成人 | 色爱区综合| 日韩成人| 亚洲精品二区 | 草草精品| 97色综合 | 久草网站 | 一区二区视频 | 欧美亚洲视频在线观看 | 欧美日韩一卡二卡 | 亚洲人的av | www视频在线观看 | 国产福利资源 | 欧美在线一二三 | 欧美一区二 | 亚洲欧洲在线观看视频 | 欧美日韩视频一区二区 | 日本视频免费观看 | 中文字幕亚洲欧美日韩在线不卡 | 欧美激情综合色综合啪啪五月 | 99免费在线视频 | 综合久久国产 |