Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

81
Vistas
I want bot to send first message only

I'm making a spam command. I want users to enter a message to spam but only the first message should be spam. No other message should be registered if 1 spam is already running. My code -

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 Respuestas
Responde la pregunta

0

Define outside an status variable

let spamrunning=0

Then add the condition of that status variable, and the change of it.

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);
          }

and change status again when you clear the interval

else if (command === prefix + "stopspam") {
         ...
         spamrunning=0
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda