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

76
Vistas
messageReactionAdd bugle dont stopid

When the condition of emoji.id is met === '847502744176820256' is fulfilled , does not stop sending message in consola or channel, how do I stop it?

const { Client, Intents } = require("discord.js-selfbot");
const client = new Client({
    intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS],
});

let token = "";

client.on('ready', () => {
    console.log('Ok');
 });
 
 client.on('messageReactionAdd', (messageReaction, user) => {
  const { message, emoji } = messageReaction;
if(emoji.id === '847502744176820256'){
        setTimeout(function(){
          console.log("reaction ADD")
          message.channel.send("ok")
        message.react(':wleft:847502744176820256')
      }, 350);
      }
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Your code, whenever a reaction is added to a message, checks for the condition that the emote being added is 847502744176820256. If that condition is met, you send your console and Discord messages, and then react with the emote 847502744176820256. By reacting, you trigger the reaction added event. The emote you added has the same ID, so it meets the condition. Thus, it sends the messages again, and reacts again with the same ID. And that meets the condition again. And the cycle continues.

This is a classic infinite loop.

This is why it is usually good practice to ignore events triggered by bots, including your own. You do not want your bot to trigger its own event handler. Here's how you could do that:

if(emoji.id === '847502744176820256' && !user.bot){
      setTimeout(function(){
          console.log("reaction ADD")
          message.channel.send("ok")
          message.react(':wleft:847502744176820256')
      }, 350);
}

Alternatively, if you want to accept input from other bots but not your own, you could check specifically for your bot's ID instead of checking if the user is a bot.

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