Skip to content
A simple Javascript file for nicely formatting Discord webhooks
JavaScript
Branch: master
Clone or download

Latest commit

Latest commit 35266c4 Apr 23, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows
lib Rename inline prop to short prop to comply with slack api Apr 23, 2020
.eslintrc.json ESLint & Add name verification May 8, 2018
.gitignore Add doc builder GitHub Action Apr 23, 2020
CODE_OF_CONDUCT.md i want the github insights page to be more green Dec 1, 2018
LICENSE Update copyright year Jul 12, 2019
README.md Readme updates Apr 23, 2020
index.d.ts
package-lock.json 3.7.3 Apr 23, 2020
package.json 3.7.3 Apr 23, 2020

README.md

Discord Webhooks

version npm

A simple Javascript file for nicely formatting Discord webhooks

See the full documentation at jos-b.github.io/webhook-discord

Usage

It's simple

To initialise:

const webhook = require("webhook-discord")

const Hook = new webhook.Webhook("WEBHOOK URL")

Presets

To send an info message:

Hook.info("WEBHOOK NAME","Info")

To send a warning message:

Hook.warn("WEBHOOK NAME", "Warning message")

To send an error message:

Hook.err("WEBHOOK NAME","Error")

To send a success message:

Hook.success("WEBHOOK NAME","Yay we did something right")

Custom messages

To send custom messages, you should make use of the MessageBuilder.

See all the options on the documentation

const webhook = require("webhook-discord");

const Hook = new webhook.Webhook("WEBHOOK URL");

const msg = new webhook.MessageBuilder()
                .setName("Username")
                .setColor("#aabbcc")
                .setText("This is my webhook!");
Hook.send(msg);

Installation

Either use npm:

npm install webhook-discord

Or clone from source:

git clone https://github.com/jos-b/webhook-discord.git

License

MIT

You can’t perform that action at this time.