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

139
Views
Tiene problemas para obtener un comando que envía en función de la cantidad ingresada para trabajar

Estoy tratando de hacer un comando que repita un mensaje basado en el número que ingresaste. Por ejemplo, si hiciera -ping 4 diría pong back 4 veces. Mi código para la funcionalidad del comando en este momento (separado del archivo principal) es:

 async execute(message, args) { if(!args[1]) return message.channel.send("`Command Usage:\n-rqplay (amount)`"); if(isNaN(args[1])) return message.channel.send("Please enter an actual number idiot :rolling_eyes:"); if(args[1] > 15) return message.channel.send("I don't want to send that many messages :nauseated_face:"); if(args[1] < 1) return message.reply("Bro come on, are this stupid?"); await message.channel.messages.fetch({limit: args[1]}).then(_messages =>{ message.channel.send('@everyone play'); }); }

Sin embargo, el bot solo regresa con un comando. La ayuda sería muy apreciada, gracias!

Estoy usando los últimos Discord.js, VSCode y node.js.

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

0

Con await message.channel.messages.fetch({limit: args[1]}) está recuperando los mensajes del canal con un límite de cualquier número que hayan proporcionado.

Si desea enviar un mensaje al canal, independientemente de las veces que lo hayan proporcionado, puede utilizar este:

 async execute(message, args) { if(!args[1]) return message.channel.send("`Command Usage:\n-rqplay (amount)`"); if(isNaN(args[1])) return message.channel.send("Please enter an actual number idiot :rolling_eyes:"); if(args[1] > 15) return message.channel.send("I don't want to send that many messages :nauseated_face:"); if(args[1] < 1) return message.reply("Bro come on, are this stupid?"); for (let i = 0; i < args[1]; i++) { message.channel.send('@everyone play'); } } }

Observe el bucle for en la parte inferior que se usa para enviar los mensajes.

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!