diff --git a/src/d2m/actions/expression.js b/src/d2m/actions/expression.js index fd75aa5..1c95dda 100644 --- a/src/d2m/actions/expression.js +++ b/src/d2m/actions/expression.js @@ -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 } diff --git a/src/matrix/file.js b/src/matrix/file.js index 2070a56..7bc1fec 100644 --- a/src/matrix/file.js +++ b/src/matrix/file.js @@ -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([ diff --git a/test/ooye-test-data.sql b/test/ooye-test-data.sql index 36ec0b6..ef3dc5f 100644 --- a/test/ooye-test-data.sql +++ b/test/ooye-test-data.sql @@ -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'),