1.1.0 • Published 2 years ago

discohook.js v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Webhook Builder

version npm

Sections


Installation

With NPM

$ npm install discohook.js

With yarn

$ yarn add discohook.js

Example

The example path is in the:

Github Path


API


Webhook (Class)

Constructor:

  • webhookURL: "String" | "URL"

Methods:

  • setWebhook

    • data: "Object"
      • username: "String"
      • avatar_url: "String"
  • send - content (optional): "String" - embed (optional): "MessageBuilder"

(Content and embed parameters mustn't be null or empty)

EG:

    // No. It's not gonna work
    webhook.send(null, null);

    // But this is valid
    webhook.send(null, mb);

    // And this
    webhook.send("Hello World!");

Message Builder (Class)

Constructor:

  • Embed Object: "Object"

Methods:

  • setTitle

    • title: "String"
  • setURL

    • titleURL: "String" | "URL"
  • setDescription

    • description: "String"
  • setColor

    • color: "String" | "Number"
  • setAuthor

    • authorOpts: "Object"
      • name: "String"
      • icon_url (optional): "String" | "URL"
      • url (optional): "String" | "URL"
  • setThumbnail

    • url: "String" | "URL"
  • setField

    • footerOpts: "Object[]"
      • name: "String"
      • value: "String"
      • inline (optional): "Boolean"
  • setFooter - footerText: "String" - footerIcon (optional): "String" | "URL"


More features will come soon!