@s1vann/discord-webhook
v0.0.4
Published
Modern Discord Webhook Framework
Maintainers
Readme
Installation • Quick Start • Features • Examples • Options
npm install @s1vann/discord-webhookyarn add @s1vann/discord-webhookconst Webhook = require(
'@s1vann/discord-webhook'
);
const webhook = new Webhook(
'YOUR_WEBHOOK_URL'
);
webhook.send({
content: 'Hello World 🚀'
});const Webhook = require(
'@s1vann/discord-webhook'
);
const webhook = new Webhook(
'YOUR_WEBHOOK_URL'
);
const embed = webhook
.embed()
.title('Server Started')
.description(
'Everything is running perfectly'
)
.theme('discord')
.timestamp();
webhook.send({
embeds: [embed.build()]
});const embed = webhook
.embed()
.title('Anime Update')
.description(
'One Piece Episode 1100'
)
.field(
'Status',
'Released',
true
)
.thumbnail(
'https://example.com/image.png'
)
.theme('anime')
.timestamp();
webhook.send({
embeds: [embed.build()]
});webhook
.embed()
.title('Cyberpunk Theme')
.theme('cyberpunk');await webhook.template(
'success',
{
description:
'Database Connected'
}
);
// Error Template
await webhook.template(
'error',
{
description:
'Server Crashed'
}
);
// Anime Template
await webhook.template(
'anime',
{
anime: 'One Piece',
episode: '1100'
}
);await webhook.bulk([
{
content: 'Message 1'
},
{
content: 'Message 2'
},
{
content: 'Message 3'
}
]);const webhook = new Webhook(
'YOUR_WEBHOOK_URL',
{
autoLogger: true
}
);
webhook.hookConsole({
log: true,
error: true,
warn: true
});
console.log(
'Server Started'
);
console.error(
'Database Error'
);const webhook = new Webhook(
'YOUR_WEBHOOK_URL',
{
voice: true
}
);
await webhook.voice(
'./voice.ogg',
{
content: 'Voice Message'
}
);const webhook = new Webhook(
'YOUR_WEBHOOK_URL',
{
video: true
}
);
await webhook.video(
'./video.mp4',
{
content: 'Video Upload'
}
);const webhook = new Webhook(
'YOUR_WEBHOOK_URL',
{
charts: true
}
);
await webhook.chart({
title: 'Weekly Stats',
labels: [
'Mon',
'Tue',
'Wed'
],
data: [
10,
25,
40
]
});const logs =
webhook.collection('logs');
logs.send({
content:
'Server Started'
});const buttons = webhook
.buttons()
.link(
'Website',
'https://example.com'
)
.link(
'Discord',
'https://discord.gg/example'
);
webhook.send({
content: 'Links',
components:
buttons.build()
});await webhook.file(
'./image.png',
{
content:
'Uploaded Image'
}
);const webhook = new Webhook(
'YOUR_WEBHOOK_URL',
{
debug: true
}
);const Webhook = require(
'@s1vann/discord-webhook'
);
const webhook = new Webhook(
'YOUR_WEBHOOK_URL',
{
autoLogger: true,
charts: true,
voice: true,
video: true,
debug: true
}
);
webhook.hookConsole();
const embed = webhook
.embed()
.title('Advanced Example')
.description(
'Modern Webhook Framework'
)
.theme('discord')
.timestamp();
webhook.send({
embeds: [embed.build()]
});