0.0.1 • Published 4 years ago
@blumoon/discord-webhook v0.0.1
@blumoon/discord-webhook
General use discord webhook
const DiscordHook = require('@blumoon/discord-webhook');
const hookStr = new DiscordHook('https://discordapp.com/api/webhooks/123456789123456789/aBcDeFgHiJkLmNoPqRsTuVwXyZaBcDeFgHiJkLmNoPqRsTuVwXyZaBcDeFgHiJkLmNoP');
const hook = new DiscordHook({
url: 'https://discordapp.com/api/webhooks/123456789123456789/aBcDeFgHiJkLmNoPqRsTuVwXyZaBcDeFgHiJkLmNoPqRsTuVwXyZaBcDeFgHiJkLmNoP',
colors: { trace: 65535, info: 52224, warn: 14535680, error: 16733440, fatal: 16711680 },
levels: ['debug', 'trace', 'info', 'warn', 'error', 'fatal'],
avatar_url: 'https://i.imgur.com/4M34hi2.png',
username: 'mrpool'
});
hook.trace({
color: 52224,
username: 'foobar',
title: 'ze title',
message: 'quick brown fox',
timestamp: '2020-02-20'
});
hook.trace('title', 'message', 'username', 'timestamp');
hook.trace('title', 'message', 'username');
hook.trace('title', 'message');
hook.trace('message');
hook.trace('message');
hook.debug('test');
hook.info('test');
hook.warn('test');
hook.error('test');
hook.fatal('test');
hook.post({ username: 'foo', content: 'bar' });
For custom posts, read this guide on the structure of discord webhook.
0.0.1
4 years ago