Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 2.36 KB

README.md

File metadata and controls

60 lines (43 loc) · 2.36 KB

simple-discord-webhooks

npm package stats

♥ Sponsor or ★ Star

Features

  • New: TypeScript support
  • Send webhook messages
  • Edit webhook messages
  • Delete webhook messages
  • Fetch webhook messages
  • Delete and edit webhooks
  • Support for custom avatarUrl and username per message
  • Support for Embed-Objects
  • Support for Allowed-Mentions-Object
  • Support for Message-Component-Object. ⚠ This will only work, if your webhook is owned by an application.

Install from NPM

$ npm i simple-discord-webhooks --save

Changelog

You can find the changelog here.

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

Please refer to the online documentation.

Questions or suggestions?

Please create a discussion on Github.

Contributing

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

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