fix(*): typedefs and typings for image & webhook options (#5805)

This commit is contained in:
Shubham Parihar
2021-06-12 03:52:01 +05:30
committed by GitHub
parent 19d0405aa5
commit a5a6e22316
10 changed files with 71 additions and 58 deletions

View File

@@ -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 } = {}) {

View File

@@ -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 } = {}) {

View File

@@ -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 } = {}) {

View File

@@ -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 } = {}) {

View File

@@ -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 } = {}) {

View File

@@ -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

View File

@@ -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 } = {}) {

View File

@@ -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 } = {}) {