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

126
Views
Discord Bot Wehbhook

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.

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

    }

about 4 years ago · Juan Pablo Isaza
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!