From 2a1998b81cd2c51e50427758587f0addc91ae0f6 Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Thu, 23 Feb 2023 19:33:49 +0200 Subject: [PATCH] Add support for group DMs in invite embeds --- DiscordChatExporter.Core/Discord/Data/Invite.cs | 4 ++-- .../Exporting/MessageGroupTemplate.cshtml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DiscordChatExporter.Core/Discord/Data/Invite.cs b/DiscordChatExporter.Core/Discord/Data/Invite.cs index a9e4cb5..a73db9f 100644 --- a/DiscordChatExporter.Core/Discord/Data/Invite.cs +++ b/DiscordChatExporter.Core/Discord/Data/Invite.cs @@ -8,7 +8,7 @@ namespace DiscordChatExporter.Core.Discord.Data; // https://discord.com/developers/docs/resources/invite#invite-object public record Invite( string Code, - Guild? Guild, + Guild Guild, Channel? Channel) { public static string? TryGetCodeFromUrl(string url) => @@ -17,7 +17,7 @@ public record Invite( public static Invite Parse(JsonElement json) { var code = json.GetProperty("code").GetNonWhiteSpaceString(); - var guild = json.GetPropertyOrNull("guild")?.Pipe(Guild.Parse); + var guild = json.GetPropertyOrNull("guild")?.Pipe(Guild.Parse) ?? Guild.DirectMessages; var channel = json.GetPropertyOrNull("channel")?.Pipe(c => Channel.Parse(c)); return new Invite(code, guild, channel); diff --git a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml index 00b2417..44d8b75 100644 --- a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml @@ -329,15 +329,15 @@