From 0c1a01522239badcdec7d99082adb2a940198a5e Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Sat, 8 Mar 2025 00:52:27 +1300 Subject: [PATCH] Fix GIF stickers --- src/matrix/file.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/matrix/file.js b/src/matrix/file.js index 002f34f..2070a56 100644 --- a/src/matrix/file.js +++ b/src/matrix/file.js @@ -109,18 +109,17 @@ function emoji(emojiID, animated) { } const stickerFormat = new Map([ - [1, {label: "PNG", ext: "png", mime: "image/png"}], - [2, {label: "APNG", ext: "png", mime: "image/apng"}], - [3, {label: "LOTTIE", ext: "json", mime: "lottie"}], - [4, {label: "GIF", ext: "gif", mime: "image/gif"}] + [1, {label: "PNG", ext: "png", mime: "image/png", endpoint: "/stickers/"}], + [2, {label: "APNG", ext: "png", mime: "image/apng", endpoint: "/stickers/"}], + [3, {label: "LOTTIE", ext: "json", mime: "lottie", endpoint: "/stickers/"}], + [4, {label: "GIF", ext: "gif", mime: "image/gif", endpoint: "https://media.discordapp.net/stickers/"}] ]) /** @param {{id: string, format_type: number}} sticker */ function sticker(sticker) { const format = stickerFormat.get(sticker.format_type) if (!format) throw new Error(`No such format ${sticker.format_type} for sticker ${JSON.stringify(sticker)}`) - const ext = format.ext - return `/stickers/${sticker.id}.${ext}` + return `${format.endpoint}${sticker.id}.${format.ext}` } module.exports.DISCORD_IMAGES_BASE = DISCORD_IMAGES_BASE