Skip to content

renzbobz/discord-webhook-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Webhook JS

⚠️ Will fix soon! BRB.

Documentation, ESModules support, and Browser support soon.

Installation

npm i @renzbobz/discord-webhook

Usage

const { Webhook, Alert, File, Message, Embed } = require("@renzbobz/discord-webhook");

Response Object

Name Type Description
success boolean Response code is in 2xx range
data object|string Response data of successful request. Can be a message/webhook object or an empty string
status number Status code of response
statusText string Status message corresponding to the status code
error object|null Request error or discord error

Sample

(async () => {
  const webhook = "";

  const wh = new Webhook(webhook);
  console.log(await wh.post("Hello"));

  const msg = new Message().setContent("Hello").setTts(true);

  console.log(await wh.post(msg));

  const embed = new Embed().setTitle("Hello").setDescription("World");
  msg.addEmbed(embed);
  console.log(await wh.post(msg));

  const file = new File("file.txt");
  msg.addFile(file);
  console.log(await wh.post(msg));

  const alert = new Alert.Success("Success!", "Blah Blah");
  console.log(await alert.send(webhook));
})();

About

Easily send and manage discord webhook messages

Resources

Stars

Watchers

Forks

Packages

No packages published