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

187
Views
¿Hay alguna manera de enviar args[1] args[2] veces?

Quiero que mi bot pueda enviar a alguien un DM de args[1] sin importar cuántas veces sea args[2] . Creo que debería ser bastante simple, pero hasta ahora no he encontrado la manera de hacerlo. Este es mi código hasta ahora:

 module.exports = { name: 'message', description: 'message', execute(message, args) { let recipient = message.mentions.users.first() if (message.author.id === 'My ID') { recipient.send(args[1]) } if ((!args[1])) return message.channel.send('Please include the message you want to send.') if (isNaN(args[2])) return message.channel.send('Please include how many times you want the message to send.') } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puedes usar un bucle for simple:

 module.exports = { name: 'message', description: 'message', execute(message, args) { let recipient = message.mentions.users.first(); if (!args[1]) return message.channel.send( 'Please include the message you want to send.', ); if (isNaN(args[2])) return message.channel.send( 'Please include how many times you want to send the message.', ); if (message.author.id === 'My ID') { for (let i = 0; i < args[2]; i++) { recipient.send(args[1]); } } }, };
over 4 years ago · Santiago Trujillo 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!