Discord webhooks wrapper
src | ||
test | ||
.eslintrc.json | ||
.gitignore | ||
index.ts | ||
package.json | ||
README.md | ||
tsconfig.json | ||
yarn.lock |
Discord Webhook
Wrapper for Discord's webhooks.
Doesn't do much, takes care of rate limits, allows sending of messages to Discord webhooks.
Example
import WebhookClient from '@navy.gif/discord-webhook';
const webhook = new WebhookClient({url: 'https://discord.com/api/webhooks/ID/TOKEN'});
// or
const webhook = new WebhookClient({id: 'ID', token: 'TOKEN'});
// Ensure webhook exists, discord doesn't like you if you try to send a request to webhooks that don't exist
// Throws an error if it doesn't exist
await webhook.fetch();
// send message
await webhook.send('Hello from Node.js');