diff --git a/DiscordChatExporter.Core/Discord/Data/Sticker.cs b/DiscordChatExporter.Core/Discord/Data/Sticker.cs index 631312f..63462d8 100644 --- a/DiscordChatExporter.Core/Discord/Data/Sticker.cs +++ b/DiscordChatExporter.Core/Discord/Data/Sticker.cs @@ -7,7 +7,12 @@ using JsonExtensions.Reading; namespace DiscordChatExporter.Core.Discord.Data; // https://discord.com/developers/docs/resources/sticker#sticker-resource -public record Sticker(Snowflake Id, string Name, StickerFormat Format, string SourceUrl) +public partial record Sticker(Snowflake Id, string Name, StickerFormat Format, string SourceUrl) +{ + public bool IsImage => Format != StickerFormat.Lottie; +} + +public partial record Sticker { public static Sticker Parse(JsonElement json) { @@ -22,6 +27,7 @@ public record Sticker(Snowflake Id, string Name, StickerFormat Format, string So StickerFormat.Png => "png", StickerFormat.Apng => "png", StickerFormat.Lottie => "json", + StickerFormat.Gif => "gif", _ => throw new InvalidOperationException($"Unknown sticker format '{format}'.") } ); diff --git a/DiscordChatExporter.Core/Discord/Data/StickerFormat.cs b/DiscordChatExporter.Core/Discord/Data/StickerFormat.cs index 4875c7c..a1a78d4 100644 --- a/DiscordChatExporter.Core/Discord/Data/StickerFormat.cs +++ b/DiscordChatExporter.Core/Discord/Data/StickerFormat.cs @@ -4,5 +4,6 @@ public enum StickerFormat { Png = 1, Apng = 2, - Lottie = 3 + Lottie = 3, + Gif = 4 } diff --git a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml index 01e98f7..92f8a43 100644 --- a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml @@ -634,7 +634,7 @@ @foreach (var sticker in message.Stickers) {
- @if (sticker.Format is StickerFormat.Png or StickerFormat.Apng) + @if (sticker.IsImage) { Sticker }