Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
DISCORD JS v13 createReactionCollector "recopilar" no funciona

Introducir

Quiero usar la generación de páginas de discord.js-pagination en discord.js v13. El código fuente usa createReactionCollector pero la collect no funciona.

vista previa de discordia

En detalle

Los dos botones de reacción se muestran correctamente. También ejecuta el tiempo de espera correctamente y los dos botones se eliminan después de 12000ms.

El problema es que no hay respuesta cuando presiono el botón de reacción. "recoger" no funciona.

No puedo creer que se ejecute "end", pero no "collect". ¿Alguien podría darme una pista?

Código fuente

 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; }

medio ambiente

discord.js@13.1.0 (obtener por npm ls )

Suma

Mi cliente está siguiendo:

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

createReactionCollector no se activa

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puedo resolver este problema.

No estaba relacionado con el código, se olvidó de agregar la intención GUILD_MESSAGE_REACTIONS.

createReactionCollector no funciona en discord.js

 const client = new Discord.Client({ intents: ['GUILD_VOICE_STATES', 'GUILD_MESSAGES', 'GUILDS', 'GUILD_MESSAGE_REACTIONS'], });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!