diff --git a/DiscordChatExporter.Core/Discord/Data/Message.cs b/DiscordChatExporter.Core/Discord/Data/Message.cs index 29465ab5..9af6d5ab 100644 --- a/DiscordChatExporter.Core/Discord/Data/Message.cs +++ b/DiscordChatExporter.Core/Discord/Data/Message.cs @@ -28,14 +28,16 @@ public partial record Message( MessageReference? Reference, Message? ReferencedMessage, MessageSnapshot? ForwardedMessage, - Interaction? Interaction + Interaction? Interaction, + JsonElement? Poll ) : IHasId { public bool IsEmpty { get; } = string.IsNullOrWhiteSpace(Content) && !Attachments.Any() && !Embeds.Any() - && !Stickers.Any(); + && !Stickers.Any() + && Poll is null; public bool IsSystemNotification { get; } = Kind is >= MessageKind.RecipientAdd and <= MessageKind.ThreadCreated; @@ -187,6 +189,8 @@ public partial record Message var interaction = json.GetPropertyOrNull("interaction")?.Pipe(Interaction.Parse); + var poll = json.GetPropertyOrNull("poll"); + return new Message( id, kind, @@ -205,7 +209,8 @@ public partial record Message messageReference, referencedMessage, forwardedMessage, - interaction + interaction, + poll ); } } diff --git a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml index f0dba0de..7b3f0261 100644 --- a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml @@ -400,6 +400,35 @@ } + @* Poll *@ + @if (message.Poll is not null) + { + var pollQuestion = message.Poll.Value + .GetPropertyOrNull("question")? + .GetPropertyOrNull("text")? + .GetStringOrNull(); + +