1.0.1 • Published 1 year ago

@renzbobz/discord-webhook v1.0.1

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

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

NameTypeDescription
successbooleanResponse code is in 2xx range
dataobject|stringResponse data of successful request. Can be a message/webhook object or an empty string
statusnumberStatus code of response
statusTextstringStatus message corresponding to the status code
errorobject|nullRequest 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));
})();
1.0.1

1 year ago

1.0.0

1 year ago