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

88
Vistas
Presence Update event spams

I used presence update for my Discord bot so when me or my friends are getting live on Twitch, the bot would send a message in a channel and console log. But when we go live, the bot does the job, like, it sends the first message then it starts spamming. As you may expect, I don't have the knowledge in js as I am a beginner. So, can someone tell me how to fix this problem or if it can be fixed? Here is my code:

    if (!newPresence.activities) return false;
    newPresence.activities.forEach(activity => {
        if (activity.type == "STREAMING") {
            console.log(`${newPresence.user.tag} is streaming at ${activity.url}.`);
        };
    });
});

And here is the console.log spam:

Mini-Game#8953 is streaming at https://www.twitch.tv/murus.
Mini-Game#8953 is streaming at https://www.twitch.tv/murus.
Mini-Game#8953 is streaming at https://www.twitch.tv/murus.
Mini-Game#8953 is streaming at https://www.twitch.tv/murus.
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Add a return after the console.log() inside the forEach

newPresence.activities.forEach((activity,idx,arr) => {
        if (activity.type == "STREAMING") {
            console.log(`${newPresence.user.tag} is streaming at ${activity.url}.`);
            return; //---> ADD this
        };
    });

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