EmoteCloner: fix low quality; don't count managed emojis (#2321)

Co-authored-by: Nam Anh <phamnamanh25@gmail.com>
Co-authored-by: ryan-0324 <77452312+ryan-0324@users.noreply.github.com>
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
byron 2024-04-08 20:33:18 -04:00 committed by GitHub
parent 3ecd2deae5
commit ae01e88e13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -54,9 +54,9 @@ const StickerExt = [, "png", "png", "json", "gif"] as const;
function getUrl(data: Data) { function getUrl(data: Data) {
if (data.t === "Emoji") if (data.t === "Emoji")
return `${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/emojis/${data.id}.${data.isAnimated ? "gif" : "png"}`; return `${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/emojis/${data.id}.${data.isAnimated ? "gif" : "png"}?size=4096&lossless=true`;
return `${window.GLOBAL_ENV.MEDIA_PROXY_ENDPOINT}/stickers/${data.id}.${StickerExt[data.format_type]}`; return `${window.GLOBAL_ENV.MEDIA_PROXY_ENDPOINT}/stickers/${data.id}.${StickerExt[data.format_type]}?size=4096&lossless=true`;
} }
async function fetchSticker(id: string) { async function fetchSticker(id: string) {
@ -130,7 +130,8 @@ function getGuildCandidates(data: Data) {
let count = 0; let count = 0;
for (const emoji of emojis) for (const emoji of emojis)
if (emoji.animated === isAnimated) count++; if (emoji.animated === isAnimated && !emoji.managed)
count++;
return count < emojiSlots; return count < emojiSlots;
}).sort((a, b) => a.name.localeCompare(b.name)); }).sort((a, b) => a.name.localeCompare(b.name));
} }

View file

@ -425,6 +425,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
newwares: { newwares: {
name: "newwares", name: "newwares",
id: 421405303951851520n id: 421405303951851520n
},
Byron: {
name: "byeoon",
id: 1167275288036655133n
} }
} satisfies Record<string, Dev>); } satisfies Record<string, Dev>);