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

71
Views
Quiero que el bot envíe solo el primer mensaje

Estoy haciendo un comando de spam. Quiero que los usuarios ingresen un mensaje para spam, pero solo el primer mensaje debe ser spam. No se debe registrar ningún otro mensaje si ya se está ejecutando 1 spam. Mi código -

 else if (command === prefix + "spam" && args[0] !== undefined) { message.reply("Quick tip: Use `stopspam` command to stop this") spamInterval = setInterval(() => { message.channel.send(`${args.slice(0).join(" ")}`); }, 1500); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Definir fuera de una variable de estado

 let spamrunning=0

Luego agregue la condición de esa variable de estado y el cambio de la misma.

 else if (command === prefix + "spam" && args[0] !== undefined && spamrunning==0) { message.reply("Quick tip: Use `stopspam` command to stop this") spamrunning=1 spamInterval = setInterval(() => { message.channel.send(`${args.slice(0).join(" ")}`); }, 1500); }

y cambie el estado nuevamente cuando borre el intervalo

 else if (command === prefix + "stopspam") { ... spamrunning=0 }
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!