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

215
Vistas
how to change the activities title *Respectively* in discord.js?

hey i wanna do something on discord.js but just don't know how, i know that it's possible but idk how so i wanted to ask ya guys that: i wanna set my bot's activity like it's keep being changed respectively not randomly. it shouldn't be randomly because....uhhh....you'll realize soon ._.

here's my activity's codes but it's in randomly(i want it to be respectively as i said):

client.on("ready") {
        console.log('Boom bot is ready to boom!')
        setInterval(() => {
            var v = (client.guilds.cache.size)
            const count = [
                "1", "2", "3", "BOOM!"]
            // here it collects the titles in randomly
            const number = Math.floor(Math.random()*(count.length))
            const activity = count[number]
            
            client.user.setActivity(activity);
        };
    })

if anybody here knows how to get the numbers of number variable respectively, plz consider helping this guy👍🏻

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try a couple things: declare the desired statuses outside of the setInterval function. Also set an interval in ms for the interval to execute on. This is done by adding a comma and then the number of milliseconds to wait before executing again. Declare the desired index outside of the function and then inside the function reset the index to zero once you've iterated through the whole array.

const count = ["1", "2", "3", "BOOM!"] //removed outside
let index = 0; //declaring an index
setInterval(() => {
            // here it collects the titles in randomly
            const activity = count[index] //accessing array at index
            index++; //incrementing
            if (index >= count.length) index = 0; //resetting
            console.log(activity);
            }, 1000); //setting an interval
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