Skip to content

Releases: SCDerox/simple-discord-webhooks

v2.1.0

20 Sep 17:02
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.0.0...v2.1.0

v2.0.0

05 Sep 09:39
4333e68
Compare
Choose a tag to compare
  • Support for Typescript & Custom Error-Type

Full Changelog: v1.1.1...v2.0.0

v1.1.1

05 Oct 19:24
Compare
Choose a tag to compare
  • Improved documentation

v1.1.0

05 Oct 18:50
16b1af7
Compare
Choose a tag to compare

v1.1.0 (October 5, 2021)

Read more in the CHANGELOG.

First Version (with a bug fix)

13 Mar 20:50
Compare
Choose a tag to compare

simple-discord-webhooks

npm package stats

Features

Install from NPM

$ npm i simple-discord-webhooks --save

Example Usage

const {Webhook} = require('simple-discord-webhooks');

const webhook = new Webhook('https://discord.com/api/webhooks/820304489637871657/QPZWXNS6wUsQ7iKA-Sm7YDIODCbxk60WNeRDoPtEOxZaMvlqbrM_1LQ_LVZHMNhbdz6N');

webhook.send('This message should get edited (hopefully) soon').then(async (result) => {
    setTimeout(async () => {
        await result.edit('And should get deleted (hopefully) soon');
        console.log('Successfully edited send message!');
    }, 3000);
    setTimeout(async () => {
        await result.delete();
        console.log('Successfully deleted send message!');
    }, 6000);
});

const message = webhook.resolveMessageID('820311219432194068');
message.edit('Hello there!').then(() => console.log('Edited message'))

API

  • Class: Webhook(url, username = null, avatarUrl = null)

    • function send(content, embeds = [], allowedMentions = {}, tts = false) - Sends a message
      • content (string): Content of the message
      • embeds (array, optional): Array
        of Embed-Objects
      • allowedMentions (object, optional):
        A Allowed-Mentions-Object
      • tts (boolean, optional): Set to true to enable TTS.
      • Returns Promise<Message> (with all the values
        from here)
    • function resolveMessageID(messageID) - Returns a MessageObject of a Message-ID
      • messageID(string): ID of a message send by this webhook
      • Returns Message
      • NOTE: You can only get a Message-Object with to edit and delete the message - You can not (!) get the
        content of it.
  • Class: Message(messageData, webhookurl)

    • messageData (object) has to have a value called id with the id of the message in it
    • function delete() - Deletes the message
      • Returns Promise<boolean> (true if everything went smoothly.)
    • function edit(content, embeds = [], allowedMentions = {}) - Edits the message
      • content (string): Content of the message
      • embeds (array, optional): Array
        of Embed-Objects
      • allowedMentions (object, optional):
        A Allowed-Mentions-Object
      • Returns Promise<Message> (with all the values
        from here)

Questions or suggestions?

Feel free to send me a DM on Discord: SCDerox#4645

Contributing

Feel free to create any issues and PRs in our github repository if you
want to contribute.

© Simon Csaba, 22021 | mail[at]scderox.de

First Version

13 Mar 18:32
Compare
Choose a tag to compare

simple-discord-webhooks

npm package stats

Features

Install from NPM

$ npm i simple-discord-webhooks --save

Example Usage

const {Webhook} = require('../Webhook');

const webhook = new Webhook('https://discord.com/api/webhooks/820304489637871657/QPZWXNS6wUsQ7iKA-Sm7YDIODCbxk60WNeRDoPtEOxZaMvlqbrM_1LQ_LVZHMNhbdz6N');

webhook.send('This message should get edited (hopefully) soon').then(async (result) => {
    setTimeout(async () => {
        await result.edit('And should get deleted (hopefully) soon');
        console.log('Successfully edited send message!');
    }, 3000);
    setTimeout(async () => {
        await result.delete();
        console.log('Successfully deleted send message!');
    }, 6000);
});

const message = webhook.resolveMessageID('820311219432194068');
message.edit('Hello there!').then(() => console.log('Edited message'))

API

  • Class: Webhook(url, username = null, avatarUrl = null)

    • function send(content, embeds = [], allowedMentions = {}, tts = false) - Sends a message
      • content (string): Content of the message
      • embeds (array, optional): Array
        of Embed-Objects
      • allowedMentions (object, optional):
        A Allowed-Mentions-Object
      • tts (boolean, optional): Set to true to enable TTS.
      • Returns Promise<Message> (with all the values
        from here)
    • function resolveMessageID(messageID) - Returns a MessageObject of a Message-ID
      • messageID(string): ID of a message send by this webhook
      • Returns Message
      • NOTE: You can only get a Message-Object with to edit and delete the message - You can not (!) get the
        content of it.
  • Class: Message(messageData, webhookurl)

    • messageData (object) has to have a value called id with the id of the message in it
    • function delete() - Deletes the message
      • Returns Promise<boolean> (true if everything went smoothly.)
    • function edit(content, embeds = [], allowedMentions = {}) - Edits the message
      • content (string): Content of the message
      • embeds (array, optional): Array
        of Embed-Objects
      • allowedMentions (object, optional):
        A Allowed-Mentions-Object
      • Returns Promise<Message> (with all the values
        from here)

Questions or suggestions?

Feel free to send me a DM on Discord: SCDerox#4645

Contributing

Feel free to create any issues and PRs in our github repository if you
want to contribute.

© Simon Csaba, 22021 | mail[at]scderox.de