Fix webp animated emojis

https://discord.com/developers/docs/reference#image-formatting-cdn-endpoints
> WebP and AVIF formats must be requested as WebP.
This commit is contained in:
abdul
2026-01-17 12:15:04 +03:00
committed by Cadence Ember
parent c472388acc
commit 1741bc0fa7
3 changed files with 5 additions and 5 deletions

View File

@@ -24,7 +24,7 @@ async function emojisToState(emojis) {
file.uploadDiscordFileToMxc(file.emoji(emoji.id, emoji.animated)).then(url => {
result.images[emoji.name] = {
info: {
mimetype: emoji.animated ? "image/gif" : "image/png"
mimetype: "image/webp"
},
url
}

View File

@@ -103,9 +103,9 @@ function memberAvatar(guildID, user, member) {
}
function emoji(emojiID, animated) {
const base = `/emojis/${emojiID}`
if (animated) return base + ".gif"
else return base + ".png"
const base = `/emojis/${emojiID}.webp`
if (animated) return base + "?animated=true"
else return base
}
const stickerFormat = new Map([

View File

@@ -145,7 +145,7 @@ INSERT INTO file (discord_url, mxc_url) VALUES
('https://cdn.discordapp.com/emojis/230201364309868544.png', 'mxc://cadence.moe/qWmbXeRspZRLPcjseyLmeyXC'),
('https://cdn.discordapp.com/emojis/393635038903926784.gif', 'mxc://cadence.moe/WbYqNlACRuicynBfdnPYtmvc'),
('https://cdn.discordapp.com/attachments/176333891320283136/1157854643037163610/Screenshot_20231001_034036.jpg', 'mxc://cadence.moe/zAXdQriaJuLZohDDmacwWWDR'),
('https://cdn.discordapp.com/emojis/1125827250609201255.png', 'mxc://cadence.moe/pgdGTxAyEltccRgZKxdqzHHP'),
('https://cdn.discordapp.com/emojis/1125827250609201255.webp', 'mxc://cadence.moe/pgdGTxAyEltccRgZKxdqzHHP'),
('https://cdn.discordapp.com/avatars/320067006521147393/5fc4ad85c1ea876709e9a7d3374a78a1.png?size=1024', 'mxc://cadence.moe/JPzSmALLirnIprlSMKohSSoX'),
('https://cdn.discordapp.com/emojis/288858540888686602.png', 'mxc://cadence.moe/mwZaCtRGAQQyOItagDeCocEO'),
('https://cdn.discordapp.com/attachments/112760669178241024/1197621094786531358/Ins_1960637570.mp4', 'mxc://cadence.moe/kMqLycqMURhVpwleWkmASpnU'),