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

121
Views
Discord.js: MessageCollector, los mensajes no activan el evento de recopilación

Estoy tratando de codificar un bot de obsequio en discord.js, es la primera vez que codifico en Javascript, por lo que si tiene alguna recomendación, ¡me encantaría escucharla!

Estoy tratando de lanzar un sorteo en un canal específico, el canal generalmente está bloqueado para @todos, cuando comienza el sorteo, abro el canal y empiezo a escuchar las entradas.

Me gustaría escuchar todos los mensajes, verificar si es una billetera ethereum correcta, si lo es, recopilarla, si no lo es, eliminar el mensaje del canal.

Quería usar un createMessageCollector sin ningún filtro y verificar todo manualmente. Sin embargo, los mensajes no activan el evento de collect .

Aquí está el código:

 async function launch_giveaway(interaction) { const giveawayChannel = interaction.options.getChannel("in"); const giveawayName = interaction.options.getString("name"); const numWinner = interaction.options.getInteger("num_winners"); const hours = interaction.options.getInteger("hours"); const minutes = interaction.options.getInteger("minutes"); const channelWinner = interaction.options.getChannel("winner_channel") let endTime = Math.round(Date.now()/1000) + hours*3600 + minutes*60; await interaction.reply(`Starting the giveaway of **${giveawayName}** in ${giveawayChannel} for ${hours}:${minutes}, I will put the ${numWinner} winners in ${channelWinner} !`); await open_giveaway(interaction, giveawayChannel, giveawayName, numWinner, endTime, channelWinner) await interaction.followUp(`Done ! ${giveawayChannel} is now open and members can send there wallets !`); setTimeout(close_channel, hours*3600000 + minutes*60000, interaction, giveawayChannel, channelWinner, giveawayName); let wallets = []; const filter = m => {return true;}; const collector = giveawayChannel.createMessageCollector({ filter, time: 15000 }); collector.on('collect', m => { console.log("someone typed in #giveaway"); // check ethereum wallet regex etc // add to wallets list }); collector.on('end', collected => { console.log(`Collected ${collected.size} wallets`); }); }

Incluso probé con el código predeterminado de este tutorial , pero no registra nada en mi consola.

Muchas gracias por su ayuda,

Chronoxx

about 4 years ago · Juan Pablo Isaza
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!