DEV Community

Discussion on: Send automated Discord messages through Webhooks using JavaScript (Part 2 - Embeds)

 
oskarcodes profile image
Oskar Codes

Oh yeah that's totally an option if you just want to send one specific Webhook message, but this post is about learning how to code that, which is useful if you want to integrate that to your own application, so your Webhook can send messages when events occur in it.

Thread Thread
 
pealco821103 profile image
Pedro Costa • Edited

Hello @oskarcodes I found the issue.

We can't use color: hexToDecimal("#ff0000"), instead we have to use decimal code so just change color: hexToDecimal("#ff0000") with color : 16711680

Probably you have other script to execute that hexToDecimal command.

Hope it helps

Thread Thread
 
oskarcodes profile image
Oskar Codes

Oh well yeah the hexTodecimal function is just this:

function hexToDecimal(hex) {
  return parseInt(hex.replace("#",""), 16)
}