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

208
Views
El recopilador de mensajes en Discord.JS no se está ejecutando

Tengo un comando básico para probar la función de recolección de mensajes en mi bot discord.js v13.

El bot no falla cuando lo ejecuto, pero la función no se carga correctamente, ya que tiene un error.

 import { ICommand } from 'wokcommands' import { Message } from 'discord.js' export default { category: 'Testing', description: 'Tests the collector system', hidden: true, callback: ({ message, channel }) => { message.reply('Answer your username') const filter = (m: Message) => { m.author.id === message.author.id } const collector = channel.createMessageCollector({ filter, max: 1, time: 1000 * 10, }) collector.on('collect', message => { console.log(message.content) }) collector.on('end', collected => { if (collected.size === 0) { message.reply('You did not provide your username') return } let text = 'Collected:\n\n' collected.forEach((message) => { text += `${message.content}\n` }) message.reply(text) }) } } as ICommand

El error está en la línea dentro de la función del colector cuando llamo al filtro. El IDE me da un error:

El tipo '(m: Message) => void' no se puede asignar al tipo 'CollectorFilter<[Message]>'. El tipo 'vacío' no se puede asignar al tipo 'booleano | Promesa'.

Entiendo lo que el error está tratando de decir, pero ¿cómo puedo solucionarlo?

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

0

Su filter debe devolver un valor booleano. De momento no devuelves nada, solo comparas las dos variables. Cualquiera de estos funcionará:

 const filter = (m: Message) => { return m.author.id === message.author.id }
 const filter = (m: Message) => m.author.id === message.author.id
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!