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

238
Views
if it has footer.text it reacts, but I want it to do the opposite

what it does is add a reaction :pray: when an embed has footer.text, but I don't want that, I want it to react when it doesn't have a footer.text

if(message.embeds.length >= 0) 
    // Check if the Message has embed or not
    {
      let embed = message.embeds
      // console.log(embed) just a console.log
      for(let i = 0; i < embed.length; i++)
      // Loop it since in v13 you can send multiple embed in single message
      {
        if (!embed[i] || !embed[i].footer || embed[i].footer.text === null) return;
        // check each embed if it has footer.text or not, if it doesnt then do nothing
        {
          setTimeout(function(){
            message.react(':pray:')
          }, 1000);
        }
      }
    }
about 4 years ago ยท Juan Pablo Isaza
1 answers
Answer question

0

You simply need to switch your conditions like so:

if (embed[i] || embed[i].footer || embed[i].footer.text !== null) {
    setTimeout(function() {
        message.react('๐Ÿ™')
    }, 1000);
}

Where !== represents Strict Inequality so what you are actually doing is checking the following conditions

  • If there is an embed to the message
  • If that embed object has a footer
  • If the content of the footer is not empty

Further since all of these conditions are necessary I would suggest using Logical AND (&&) operator which only returns true if the checks of all operands are fulfilled, so your code would look something like this:

if (embed[i] && embed[i].footer && embed[i].footer.text !== null) {
    setTimeout(function() {
        message.react('๐Ÿ™')
    }, 1000);
}
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!