0.0.3 • Published 1 year ago

discord-webhook.js v0.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

discord-webhook.js ⚡

a simple package to interact with discord webhooks

pic

For support on my packages join my discord!

https://discord.gg/hs4CRuFXua

content

How to install ?

npm i discord-webhook.js

Presets

send info message:

const { Webhook } = require("discord-webhook.js")
const hook = new Webhook("WEBHOOK URL")
hook.info("WEBHOOK NAME", "this is info") // you can put avatar by adding hook.setAvatar("AVATAR URL")

Output: example send warn message:

const { Webhook } = require("discord-webhook.js")
const hook = new Webhook("WEBHOOK URL")
hook.warn("WEBHOOK NAME", "this is Warn")

Output: example send error message:

const { Webhook } = require("discord-webhook.js")
const hook = new Webhook("WEBHOOK URL")
hook.error("WEBHOOK NAME", "this is Error")

Output: example send success message:

const { Webhook } = require("discord-webhook.js")
const hook = new Webhook("WEBHOOK URL")
hook.success("WEBHOOK NAME", "this is Success")

Output: example

Usage

How to send message?

const { Webhook } = require("discord-webhook.js")
const hook = new Webhook("YOUR WEBHOOK URL")
hook.setUsername("discord-webhooks.js")
hook.setAvatar("AVATAR URL")

hook.send("hi there!!")

Output: OUTPUT how to send embed ?

const { Webhook, MessageBuilder } = require("discord-webhook.js")
const hook = new Webhook("YOUR WEBHOOK URL")
const embed = new MessageBuilder()
.setTitle('My title here')
.setAuthor('author', 'https://cdn.discordapp.com/embed/avatars/0.png', 'https://www.google.com')
.setURL('https://www.google.com')
.addField('field', 'this is inline', true)
.addField('field', 'this is not inline') // deafult is false
.setColor('#00b0f4')
.setThumbnail('https://cdn.discordapp.com/embed/avatars/0.png')
.setDescription('description')
.setImage('https://cdn.discordapp.com/embed/avatars/0.png')
.setFooter('Footer', 'https://cdn.discordapp.com/embed/avatars/0.png')
.setTimestamp();
hook.setUsername("Discord")
hook.send("", {embeds:[embed]})

Output: OUTPUT you can send text + embed Example:

const { Webhook, MessageBuilder } = require("discord-webhook.js")
const hook = new Webhook("YOUR WEBHOOK URL")
const embed = new MessageBuilder()
.setTitle('My title here')
.setAuthor('author', 'https://cdn.discordapp.com/embed/avatars/0.png', 'https://www.google.com')
.setURL('https://www.google.com')
.addField('field', 'this is inline', true)
.addField('field', 'this is not inline') // deafult is false
.setColor('#00b0f4')
.setThumbnail('https://cdn.discordapp.com/embed/avatars/0.png')
.setDescription('description')
.setImage('https://cdn.discordapp.com/embed/avatars/0.png')
.setFooter('Footer', 'https://cdn.discordapp.com/embed/avatars/0.png')
.setTimestamp();
hook.setUsername("Discord")
hook.send("this is a message", {embed})

Output: OUTPUT

Sending files

Example:

const { Webhook } = require("discord-webhook.js")
const hook = new Webhook("YOUR WEBHOOK URL")
hook.setUsername("Spidey Bot")
hook.setAvatar("AVATAR URL")

hook.sendFile("./filename.js") // you can send any file type not just js

Output: example

0.0.1

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago