https://github.com/knutkirkhorn/discord-webhook-wrapper
A very simple wrapper for creating a discord.js `WebhookClient` object
https://github.com/knutkirkhorn/discord-webhook-wrapper
Last synced: 7 months ago
JSON representation
A very simple wrapper for creating a discord.js `WebhookClient` object
- Host: GitHub
- URL: https://github.com/knutkirkhorn/discord-webhook-wrapper
- Owner: knutkirkhorn
- License: mit
- Created: 2022-06-16T18:10:01.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-26T17:37:39.000Z (over 1 year ago)
- Last Synced: 2025-03-02T06:47:49.899Z (7 months ago)
- Language: JavaScript
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# discord-webhook-wrapper
> A very simple wrapper for creating a [discord.js](https://github.com/discordjs/discord.js) `WebhookClient` object
## Install
```sh
npm install discord-webhook-wrapper
```## Usage
```js
import discordWebhookWrapper from 'discord-webhook-wrapper';const webhookClient = discordWebhookWrapper({
discordWebhookUrl: 'https://discord.com/api/webhooks/1337/example-token',
});
// ...const webhookClientUsingIdAndToken = discordWebhookWrapper({
discordWebhookId: '1337',
discordWebhookToken: 'example-token',
});
// ...
```## API
### discordWebhookWrapper(webhookConfig)
Creates a [discord.js](https://github.com/discordjs/discord.js) `WebhookClient` object from either a Discord Webhook URL or from both a Discord Webhook ID and a token.
#### webhookConfig
##### discordWebhookUrl?
Type: `string`
URL to the Discord Webhook containing both the ID and the token.
##### discordWebhookId?
Type: `string`
ID to the Discord Webhook. Needs to be used together with the token.
##### discordWebhookToken?
Type: `string`
Token to the Discord Webhook. Needs to be used together with the ID.