feat(Sticker): add support for gif stickers (#9038)

* feat(Sticker): add support for gif stickers

* chore: upgrade discord-api-types

* refactor: requested changes
This commit is contained in:
Almeida
2023-01-13 15:29:35 +00:00
committed by GitHub
parent 8c265b628d
commit 6a9875da05
7 changed files with 33 additions and 15 deletions

View File

@@ -219,12 +219,11 @@ export class CDN {
*
* @param stickerId - The sticker id
* @param extension - The extension of the sticker
* @privateRemarks
* Stickers cannot have a `.webp` extension, so we default to a `.png`
*/
public sticker(stickerId: string, extension?: StickerExtension): string {
return this.makeURL(`/stickers/${stickerId}`, {
allowedExtensions: ALLOWED_STICKER_EXTENSIONS,
extension: extension ?? 'png', // Stickers cannot have a `.webp` extension, so we default to a `.png`
});
public sticker(stickerId: string, extension: StickerExtension = 'png'): string {
return this.makeURL(`/stickers/${stickerId}`, { allowedExtensions: ALLOWED_STICKER_EXTENSIONS, extension });
}
/**

View File

@@ -43,7 +43,7 @@ export const enum RESTEvents {
}
export const ALLOWED_EXTENSIONS = ['webp', 'png', 'jpg', 'jpeg', 'gif'] as const satisfies readonly string[];
export const ALLOWED_STICKER_EXTENSIONS = ['png', 'json'] as const satisfies readonly string[];
export const ALLOWED_STICKER_EXTENSIONS = ['png', 'json', 'gif'] as const satisfies readonly string[];
export const ALLOWED_SIZES = [16, 32, 64, 128, 256, 512, 1_024, 2_048, 4_096] as const satisfies readonly number[];
export type ImageExtension = (typeof ALLOWED_EXTENSIONS)[number];