Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

79
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!