Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
DISCORD JS v13 createReactionCollector "collect" doesn't work

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.

discord preview

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

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

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'],
});
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda