mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 02:53:31 +01:00
docs: added sizes 16, 32, 64 (#2666)
* documented sizes 16, 32, 64 * Removed space * Added typedef * The options to provide => Options for the Image URL * fixed
This commit is contained in:
@@ -121,9 +121,7 @@ class ClientApplication extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A link to the application's icon.
|
* A link to the application's icon.
|
||||||
* @param {Object} [options={}] Options for the icon url
|
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||||
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`
|
|
||||||
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
|
|
||||||
* @returns {?string} URL to the icon
|
* @returns {?string} URL to the icon
|
||||||
*/
|
*/
|
||||||
iconURL({ format, size } = {}) {
|
iconURL({ format, size } = {}) {
|
||||||
@@ -133,9 +131,7 @@ class ClientApplication extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A link to this application's cover image.
|
* A link to this application's cover image.
|
||||||
* @param {Object} [options={}] Options for the cover image url
|
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||||
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`
|
|
||||||
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
|
|
||||||
* @returns {?string} URL to the cover image
|
* @returns {?string} URL to the cover image
|
||||||
*/
|
*/
|
||||||
coverImage({ format, size } = {}) {
|
coverImage({ format, size } = {}) {
|
||||||
|
|||||||
@@ -116,9 +116,7 @@ class GroupDMChannel extends Channel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the URL to this Group DM's icon.
|
* Gets the URL to this Group DM's icon.
|
||||||
* @param {Object} [options={}] Options for the icon url
|
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||||
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`
|
|
||||||
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
|
|
||||||
* @returns {?string}
|
* @returns {?string}
|
||||||
*/
|
*/
|
||||||
iconURL({ format, size } = {}) {
|
iconURL({ format, size } = {}) {
|
||||||
|
|||||||
@@ -288,9 +288,7 @@ class Guild extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The URL to this guild's icon.
|
* The URL to this guild's icon.
|
||||||
* @param {Object} [options={}] Options for the icon url
|
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||||
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`
|
|
||||||
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
|
|
||||||
* @returns {?string}
|
* @returns {?string}
|
||||||
*/
|
*/
|
||||||
iconURL({ format, size } = {}) {
|
iconURL({ format, size } = {}) {
|
||||||
@@ -309,9 +307,7 @@ class Guild extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The URL to this guild's splash.
|
* The URL to this guild's splash.
|
||||||
* @param {Object} [options={}] Options for the splash url
|
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||||
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`
|
|
||||||
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
|
|
||||||
* @returns {?string}
|
* @returns {?string}
|
||||||
*/
|
*/
|
||||||
splashURL({ format, size } = {}) {
|
splashURL({ format, size } = {}) {
|
||||||
|
|||||||
@@ -115,10 +115,7 @@ class User extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A link to the user's avatar.
|
* A link to the user's avatar.
|
||||||
* @param {Object} [options={}] Options for the avatar url
|
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||||
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided,
|
|
||||||
* it will be `gif` for animated avatars or otherwise `webp`
|
|
||||||
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
|
|
||||||
* @returns {?string}
|
* @returns {?string}
|
||||||
*/
|
*/
|
||||||
avatarURL({ format, size } = {}) {
|
avatarURL({ format, size } = {}) {
|
||||||
@@ -138,10 +135,7 @@ class User extends Base {
|
|||||||
/**
|
/**
|
||||||
* A link to the user's avatar if they have one.
|
* A link to the user's avatar if they have one.
|
||||||
* Otherwise a link to their default avatar will be returned.
|
* Otherwise a link to their default avatar will be returned.
|
||||||
* @param {Object} [options={}] Options for the avatar url
|
* @param {ImageURLOptions} [options={}] Options for the Image URL
|
||||||
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided,
|
|
||||||
* it will be `gif` for animated avatars or otherwise `webp`
|
|
||||||
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
|
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
displayAvatarURL(options) {
|
displayAvatarURL(options) {
|
||||||
|
|||||||
@@ -111,6 +111,13 @@ function makeImageUrl(root, { format = 'webp', size } = {}) {
|
|||||||
if (size && !AllowedImageSizes.includes(size)) throw new RangeError('IMAGE_SIZE', size);
|
if (size && !AllowedImageSizes.includes(size)) throw new RangeError('IMAGE_SIZE', size);
|
||||||
return `${root}.${format}${size ? `?size=${size}` : ''}`;
|
return `${root}.${format}${size ? `?size=${size}` : ''}`;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Options for Image URLs.
|
||||||
|
* @typedef {Object} ImageURLOptions
|
||||||
|
* @property {string} [format] One of `webp`, `png`, `jpg`, `gif`. If no format is provided,
|
||||||
|
* it will be `gif` for animated avatars or otherwise `webp`
|
||||||
|
* @property {number} [size] One of `16`, `32`, `64`, `128`, `256`, `512`, `1024`, `2048`
|
||||||
|
*/
|
||||||
|
|
||||||
exports.Endpoints = {
|
exports.Endpoints = {
|
||||||
CDN(root) {
|
CDN(root) {
|
||||||
|
|||||||
Reference in New Issue
Block a user