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

240
Vistas
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 Respuestas
Responde la pregunta

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