Fix GIF stickers

This commit is contained in:
Cadence Ember 2025-03-08 00:52:27 +13:00
parent ec1550bc97
commit 0c1a015222

View file

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