From 47d2ef3e40165d846b5a901709b26dfffea46ef2 Mon Sep 17 00:00:00 2001 From: Advaith Date: Sun, 8 Aug 2021 04:45:00 -0700 Subject: [PATCH] fix(Constants): fix CDN endpoint typings (#6332) --- src/util/Constants.js | 8 ++++---- typings/index.d.ts | 45 ++++++++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/util/Constants.js b/src/util/Constants.js index 7c8a041d0ad7..dd6f5136c9fd 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -55,10 +55,10 @@ exports.Endpoints = { if (dynamic) format = hash.startsWith('a_') ? 'gif' : format; return makeImageUrl(`${root}/icons/${guildId}/${hash}`, { format, size }); }, - AppIcon: (clientId, hash, { format = 'webp', size } = {}) => - makeImageUrl(`${root}/app-icons/${clientId}/${hash}`, { size, format }), - AppAsset: (clientId, hash, { format = 'webp', size } = {}) => - makeImageUrl(`${root}/app-assets/${clientId}/${hash}`, { size, format }), + AppIcon: (appId, hash, { format = 'webp', size } = {}) => + makeImageUrl(`${root}/app-icons/${appId}/${hash}`, { size, format }), + AppAsset: (appId, hash, { format = 'webp', size } = {}) => + makeImageUrl(`${root}/app-assets/${appId}/${hash}`, { size, format }), StickerPackBanner: (bannerId, format = 'webp', size) => makeImageUrl(`${root}/app-assets/710982414301790216/store/${bannerId}`, { size, format }), GDMIcon: (channelId, hash, format = 'webp', size) => diff --git a/typings/index.d.ts b/typings/index.d.ts index 3fec97346003..0c012d029c34 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -2141,33 +2141,42 @@ export const Constants: { botGateway: string; invite: (root: string, code: string) => string; CDN: (root: string) => { - Asset: (name: string) => string; - DefaultAvatar: (id: Snowflake | number) => string; Emoji: (emojiId: Snowflake, format: DynamicImageFormat) => string; - Avatar: (userId: Snowflake, hash: string, format: DynamicImageFormat, size: AllowedImageSize) => string; - Banner: (guildId: Snowflake | number, hash: string, format: AllowedImageFormat, size: AllowedImageSize) => string; - Icon: (userId: Snowflake | number, hash: string, format: DynamicImageFormat, size: AllowedImageSize) => string; - AppIcon: (userId: Snowflake | number, hash: string, format: AllowedImageFormat, size: AllowedImageSize) => string; - AppAsset: ( - userId: Snowflake | number, + Asset: (name: string) => string; + DefaultAvatar: (discriminator: number) => string; + Avatar: ( + userId: Snowflake, hash: string, - format: AllowedImageFormat, + format: DynamicImageFormat, size: AllowedImageSize, + dynamic: boolean, ) => string; - StickerPackBanner: (bannerId: Snowflake, format: AllowedImageFormat, size: AllowedImageSize) => string; - GDMIcon: (userId: Snowflake | number, hash: string, format: AllowedImageFormat, size: AllowedImageSize) => string; - Splash: (guildId: Snowflake | number, hash: string, format: AllowedImageFormat, size: AllowedImageSize) => string; - DiscoverySplash: ( - guildId: Snowflake | number, + Banner: (guildId: Snowflake, hash: string, format: AllowedImageFormat, size: AllowedImageSize) => string; + Icon: ( + guildId: Snowflake, hash: string, - format: AllowedImageFormat, + format: DynamicImageFormat, size: AllowedImageSize, + dynamic: boolean, + ) => string; + AppIcon: ( + appId: Snowflake, + hash: string, + { format, size }: { format: AllowedImageFormat; size: AllowedImageSize }, ) => string; + AppAsset: ( + appId: Snowflake, + hash: string, + { format, size }: { format: AllowedImageFormat; size: AllowedImageSize }, + ) => string; + StickerPackBanner: (bannerId: Snowflake, format: AllowedImageFormat, size: AllowedImageSize) => string; + GDMIcon: (channelId: Snowflake, hash: string, format: AllowedImageFormat, size: AllowedImageSize) => string; + Splash: (guildId: Snowflake, hash: string, format: AllowedImageFormat, size: AllowedImageSize) => string; + DiscoverySplash: (guildId: Snowflake, hash: string, format: AllowedImageFormat, size: AllowedImageSize) => string; TeamIcon: ( - teamId: Snowflake | number, + teamId: Snowflake, hash: string, - format: AllowedImageFormat, - size: AllowedImageSize, + { format, size }: { format: AllowedImageFormat; size: AllowedImageSize }, ) => string; Sticker: (stickerId: Snowflake, stickerFormat: StickerFormatType) => string; };