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

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

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 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