Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

78
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda