mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
docs(WebhookClient): Make constructor a union (#8370)
Co-authored-by: muchnameless <12682826+muchnameless@users.noreply.github.com>
This commit is contained in:
@@ -12,11 +12,21 @@ const { parseWebhookURL } = require('../util/Util');
|
|||||||
*/
|
*/
|
||||||
class WebhookClient extends BaseClient {
|
class WebhookClient extends BaseClient {
|
||||||
/**
|
/**
|
||||||
* The data for the webhook client containing either an id and token or just a URL
|
* Represents the credentials used for a webhook in the form of its id and token.
|
||||||
* @typedef {Object} WebhookClientData
|
* @typedef {Object} WebhookClientDataIdWithToken
|
||||||
* @property {Snowflake} [id] The id of the webhook
|
* @property {Snowflake} id The webhook's id
|
||||||
* @property {string} [token] The token of the webhook
|
* @property {string} token The webhook's token
|
||||||
* @property {string} [url] The full URL for the webhook client
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the credentials used for a webhook in the form of a URL.
|
||||||
|
* @typedef {Object} WebhookClientDataURL
|
||||||
|
* @property {string} url The full URL for the webhook
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the credentials used for a webhook.
|
||||||
|
* @typedef {WebhookClientDataIdWithToken|WebhookClientDataURL} WebhookClientData
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -520,16 +520,9 @@ function lazy(cb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the credentials used for a given webhook
|
* Parses a webhook URL for the id and token.
|
||||||
* @typedef {Object} WebhookCredentials
|
|
||||||
* @property {string} id The webhook's id
|
|
||||||
* @property {string} token The webhook's token
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a webhook URL for the id and token
|
|
||||||
* @param {string} url The URL to parse
|
* @param {string} url The URL to parse
|
||||||
* @returns {?WebhookCredentials} Null if the URL is invalid, otherwise the id and the token
|
* @returns {?WebhookClientDataIdWithToken} `null` if the URL is invalid, otherwise the id and the token
|
||||||
*/
|
*/
|
||||||
function parseWebhookURL(url) {
|
function parseWebhookURL(url) {
|
||||||
const matches = url.match(
|
const matches = url.match(
|
||||||
|
|||||||
Reference in New Issue
Block a user