mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
* Fix some missing doc strings
Mainly just readonly tags
* Return an error when guild#allowDMs is ran from a bot account, and fix some return types
* WebhookClient implements Webhook, doesn't extend it
* Fix Client#rateLimit docs not showing what it returns
Cause I wanted to handle this event only to see no return props 🤔
* Actually make Client#rateLimit show the right info
Its an object with all the info
30 lines
808 B
JavaScript
30 lines
808 B
JavaScript
const Webhook = require('../structures/Webhook');
|
|
const BaseClient = require('./BaseClient');
|
|
|
|
/**
|
|
* The webhook client.
|
|
* @implements {Webhook}
|
|
* @extends {BaseClient}
|
|
*/
|
|
class WebhookClient extends BaseClient {
|
|
/**
|
|
* @param {Snowflake} id ID of the webhook
|
|
* @param {string} token Token of the webhook
|
|
* @param {ClientOptions} [options] Options for the client
|
|
* @example
|
|
* // Create a new webhook and send a message
|
|
* const hook = new Discord.WebhookClient('1234', 'abcdef');
|
|
* hook.send('This will send a message').catch(console.error);
|
|
*/
|
|
constructor(id, token, options) {
|
|
super(options);
|
|
Object.defineProperty(this, 'client', { value: this });
|
|
this.id = id;
|
|
this.token = token;
|
|
}
|
|
}
|
|
|
|
Webhook.applyToClass(WebhookClient);
|
|
|
|
module.exports = WebhookClient;
|