Skip to content

LingleDev/Webhooks.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

About

Webhooks.js is a new, lightweight, and fast Node.js wrapper for the Discord Webhooks API.

  • Object Oriented
  • Up-to-Date

Installation

Node.js 12 or newer is required.

npm install webhooks.js --save

Examples

You can send a raw Webhook params object Read More

const hooks = require('webhooks.js')
const hook = new hooks.Webhook({ id: "your-webhook-id", token: "your-webhook-token" })

hook.send({
    username: "Webhook",
    content: "Hello!",
    embeds: [{
        title: "hello!"
    }]
})
.then(json => {
    console.log(json)
})
.catch(err => {
    console.error(err)
})

or you can send a string

const hooks = require('webhooks.js')
const hook = new hooks.Webhook({ id: "your-webhook-id", token: "your-webhook-token" })

hook.send("hello world!")
.then(json => {
    console.log(json)
})
.catch(err => {
    console.error(err)
})

or you can send a RichEmbed (different from Discord.js MessageEmbeds)

const hooks = require('webhooks.js')
const hook = new hooks.Webhook({ id: "your-webhook-id", token: "your-webhook-token" })

const embed = new hooks.RichEmbed()
.setTitle(`Embed test`)
.setTimestamp()
.setDescription("Test..?")

hook.send(embed)
.then(json => {
    console.log(json)
})
.catch(err => {
    console.error(err)
})

Links

Help

You can get help in the Webhooks.js Discord Server in the #support channel.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published