1
0
Fork 0

continue on stickers

This commit is contained in:
Cadence Ember 2023-05-15 17:25:05 +12:00
parent e1d7ced87d
commit 512f61422d
4 changed files with 51 additions and 2 deletions

View file

@ -80,8 +80,24 @@ function emoji(emojiID, animated) {
else return base + ".png"
}
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: "application/json"}],
[4, {label: "GIF", ext: "gif", mime: "image/gif"}]
])
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}`
}
module.exports.guildIcon = guildIcon
module.exports.userAvatar = userAvatar
module.exports.memberAvatar = memberAvatar
module.exports.emoji = emoji
module.exports.stickerFormat = stickerFormat
module.exports.sticker = sticker
module.exports.uploadDiscordFileToMxc = uploadDiscordFileToMxc