Home > other >  if it has footer.text it reacts, but I want it to do the opposite
if it has footer.text it reacts, but I want it to do the opposite

Time:09-23

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);
        }
      }
    }

CodePudding user response:

You simply need to switch your conditions like so:

if (embed[i] || embed[i].footer || embed[i].footer.text !== null) {
    setTimeout(function() {
        message.react('           
  • Related