mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
fix(*): typedefs and typings for image & webhook options (#5805)
This commit is contained in:
@@ -426,7 +426,7 @@ class Guild extends BaseGuild {
|
||||
|
||||
/**
|
||||
* The URL to this guild's banner.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
bannerURL({ format, size } = {}) {
|
||||
@@ -445,7 +445,7 @@ class Guild extends BaseGuild {
|
||||
|
||||
/**
|
||||
* The URL to this guild's invite splash image.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
splashURL({ format, size } = {}) {
|
||||
@@ -455,7 +455,7 @@ class Guild extends BaseGuild {
|
||||
|
||||
/**
|
||||
* The URL to this guild's discovery splash image.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
discoverySplashURL({ format, size } = {}) {
|
||||
|
||||
@@ -93,7 +93,7 @@ class GuildPreview extends Base {
|
||||
|
||||
/**
|
||||
* The URL to this guild's splash.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
splashURL({ format, size } = {}) {
|
||||
@@ -103,7 +103,7 @@ class GuildPreview extends Base {
|
||||
|
||||
/**
|
||||
* The URL to this guild's discovery splash.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
discoverySplashURL({ format, size } = {}) {
|
||||
|
||||
@@ -26,7 +26,7 @@ class PartialGroupDMChannel extends Channel {
|
||||
|
||||
/**
|
||||
* The URL to this channel's icon.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
iconURL({ format, size } = {}) {
|
||||
|
||||
@@ -335,9 +335,7 @@ class RichPresenceAssets {
|
||||
|
||||
/**
|
||||
* Gets the URL of the small image asset
|
||||
* @param {Object} [options] Options for the image url
|
||||
* @param {string} [options.format] Format of the image
|
||||
* @param {number} [options.size] Size of the image
|
||||
* @param {StaticImageURLOptions} [options] Options for the image url
|
||||
* @returns {?string} The small image URL
|
||||
*/
|
||||
smallImageURL({ format, size } = {}) {
|
||||
@@ -350,9 +348,7 @@ class RichPresenceAssets {
|
||||
|
||||
/**
|
||||
* Gets the URL of the large image asset
|
||||
* @param {Object} [options] Options for the image url
|
||||
* @param {string} [options.format] Format of the image
|
||||
* @param {number} [options.size] Size of the image
|
||||
* @param {StaticImageURLOptions} [options] Options for the image url
|
||||
* @returns {?string} The large image URL
|
||||
*/
|
||||
largeImageURL({ format, size } = {}) {
|
||||
|
||||
@@ -81,7 +81,7 @@ class Team extends Base {
|
||||
|
||||
/**
|
||||
* A link to the teams's icon.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
|
||||
* @returns {?string} URL to the icon
|
||||
*/
|
||||
iconURL({ format, size } = {}) {
|
||||
|
||||
@@ -126,12 +126,17 @@ class TextChannel extends GuildChannel {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Options used to create a {@link Webhook} for {@link TextChannel} and {@link NewsChannel}.
|
||||
* @typedef {Object} ChannelWebhookCreateOptions
|
||||
* @property {BufferResolvable|Base64Resolvable} [avatar] Avatar for the webhook
|
||||
* @property {string} [reason] Reason for creating the webhook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a webhook for the channel.
|
||||
* @param {string} name The name of the webhook
|
||||
* @param {Object} [options] Options for creating the webhook
|
||||
* @param {BufferResolvable|Base64Resolvable} [options.avatar] Avatar for the webhook
|
||||
* @param {string} [options.reason] Reason for creating the webhook
|
||||
* @param {ChannelWebhookCreateOptions} [options] Options for creating the webhook
|
||||
* @returns {Promise<Webhook>} webhook The created webhook
|
||||
* @example
|
||||
* // Create a webhook for the current channel
|
||||
|
||||
@@ -211,12 +211,17 @@ class Webhook {
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the webhook.
|
||||
* @param {Object} options Options
|
||||
* @param {string} [options.name=this.name] New name for this webhook
|
||||
* @param {BufferResolvable} [options.avatar] New avatar for this webhook
|
||||
* @param {ChannelResolvable} [options.channel] New channel for this webhook
|
||||
* @param {string} [reason] Reason for editing this webhook
|
||||
* Options used to edit a {@link Webhook}.
|
||||
* @typedef {Object} WebhookEditData
|
||||
* @property {string} [name=this.name] The new name for the webhook
|
||||
* @property {BufferResolvable} [avatar] The new avatar for the webhook
|
||||
* @property {ChannelResolvable} [channel] The new channel for the webhook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Edits this webhook.
|
||||
* @param {WebhookEditData} options Options for editing the webhook
|
||||
* @param {string} [reason] Reason for editing the webhook
|
||||
* @returns {Promise<Webhook>}
|
||||
*/
|
||||
async edit({ name = this.name, avatar, channel }, reason) {
|
||||
@@ -334,7 +339,7 @@ class Webhook {
|
||||
|
||||
/**
|
||||
* A link to the webhook's avatar.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
avatarURL({ format, size } = {}) {
|
||||
|
||||
@@ -62,7 +62,7 @@ class Application extends Base {
|
||||
|
||||
/**
|
||||
* A link to the application's icon.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
|
||||
* @returns {?string} URL to the icon
|
||||
*/
|
||||
iconURL({ format, size } = {}) {
|
||||
@@ -72,7 +72,7 @@ class Application extends Base {
|
||||
|
||||
/**
|
||||
* A link to this application's cover image.
|
||||
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
|
||||
* @returns {?string} URL to the cover image
|
||||
*/
|
||||
coverURL({ format, size } = {}) {
|
||||
|
||||
@@ -136,11 +136,16 @@ function makeImageUrl(root, { format = 'webp', size } = {}) {
|
||||
|
||||
/**
|
||||
* Options for Image URLs.
|
||||
* @typedef {Object} ImageURLOptions
|
||||
* @property {string} [format] One of `webp`, `png`, `jpg`, `jpeg`, `gif`. If no format is provided,
|
||||
* defaults to `webp`.
|
||||
* @typedef {StaticImageURLOptions} ImageURLOptions
|
||||
* @property {boolean} [dynamic] If true, the format will dynamically change to `gif` for
|
||||
* animated avatars; the default is false.
|
||||
* animated avatars; the default is false
|
||||
*/
|
||||
|
||||
/**
|
||||
* Options for static Image URLs.
|
||||
* @typedef {Object} StaticImageURLOptions
|
||||
* @property {string} [format] One of `webp`, `png`, `jpg`, `jpeg`, `gif`. If no format is provided,
|
||||
* defaults to `webp`
|
||||
* @property {number} [size] One of `16`, `32`, `64`, `128`, `256`, `512`, `1024`, `2048`, `4096`
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user