title: Discord Bot Wehbhook
body: <p>This is my code for a webhook discord alert bot. I used discord.js and the channel's webhooks. I used readline-sync for the input at the console but when I iterate through the answer at console to determine the embed colour, all signals show yellow from the last iteration for some reason.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const { MessageEmbed, WebhookClient } = require('discord.js');
  const readline = require('readline-sync')
  
  const webhookClient = new WebhookClient({ id: '', token: '' });
  
  var signal = readline.question("Signal: ")
  
  if (signal.content === "SELL")
  {
    const embed = new MessageEmbed()
      .setTitle(signal)
      .setColor('RED')
    .setFooter({
    text: "test"
    })
  
    webhookClient.send({
        content: 'Webhook test',
        username: "Logan's Signals",
        avatarURL: 'https://i.imgur.com/AfFp7pu.png',
        embeds: [embed],
    });
  
  }
  else if (signal.content === "BUY")
  {
    const embed = new MessageEmbed()
      .setTitle(signal)
      .setColor('GREEN')
    .setFooter({
    text: "test"
    })
  
    webhookClient.send({
        content: 'Webhook test',
        username: "Logan's Signals",
        avatarURL: 'https://i.imgur.com/AfFp7pu.png',
        embeds: [embed],
    });
  
  }
  else
  {
    const embed = new MessageEmbed()
      .setTitle(signal)
      .setColor('YELLOW')
    .setFooter({
    text: "test"
    })
  
    webhookClient.send({
        content: 'Webhook test',
        username: "Logan's Signals",
        avatarURL: 'https://i.imgur.com/AfFp7pu.png',
        embeds: [embed],
    });
  
      }</code></pre>
  </div>
  </div>
  </p>