FakeNitro: fix non apng gif stickers being sent as images (#2050)

This commit is contained in:
sappho 2023-12-13 04:37:31 -05:00 committed by GitHub
parent 817cb9b60b
commit 40b3ec57ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -787,7 +787,14 @@ export default definePlugin({
if (sticker.available !== false && (canUseStickers || sticker.guild_id === guildId))
break stickerBypass;
const link = this.getStickerLink(sticker.id);
// [12/12/2023]
// Work around an annoying bug where getStickerLink will return StickerType.GIF,
// but will give us a normal non animated png for no reason
// TODO: Remove this workaround when it's not needed anymore
let link = this.getStickerLink(sticker.id);
if (sticker.format_type === StickerType.GIF && link.includes(".png")) {
link = link.replace(".png", ".gif");
}
if (sticker.format_type === StickerType.APNG) {
this.sendAnimatedSticker(link, sticker.id, channelId);
return { cancel: true };