JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5180
  • Score
    100M100P100Q125611F
  • License MIT

Allows for easy webhook sending through discord's webhook API

Package Exports

  • discord-webhook-node

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (discord-webhook-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#Discord Webhook sending version npm

#How to use

Basic use:

const webhook = require('discord-webhook-node');
const hook = new webhook.Webhook("YOUR WEBHOOK URL");

hook.send("Hello there!");

Custom embeds:

const webhook = require('discord-webhook-node');
const hook = new webhook.Webhook("YOUR WEBHOOK URL");

const embed = new webhook.messageBuilder()
.setTitle('My title here')
.setAuthor('Author here', 'https://cdn.discordapp.com/embed/avatars/0.png', 'https://www.google.com')
.setURL('https://www.google.com')
.addField('First field', 'this is inline', true)
.addField('Second field', 'this is not inline')
.setColor(7785669)
.setThumbnail('https://cdn.discordapp.com/embed/avatars/0.png')
.setDescription('Oh look a description :)')
.setImage('https://cdn.discordapp.com/embed/avatars/0.png')
.setFooter('Hey its a footer', 'https://cdn.discordapp.com/embed/avatars/0.png')
.setTimestamp();

Keep in mind that the custom embed method setColor takes in a decimal color. You can convert hex colors to decimal using this website here: https://convertingcolors.com

Custom settings:

const webhook = require('discord-webhook-node');
const hook = new webhook.Webhook({
    url: "YOUR WEBHOOK URL",
    //If throwErrors is set to false, no errors will be thrown if there is an error sending
    throwErrors: false,
    //retryOnLimit gives you the option to not attempt to send the message again if rate limited
    retryOnLimit: false
});

#Installation npm install discord-webhook-node

#License

MIT