diff --git a/DiscordChatExporter.Core/Discord/Data/Channel.cs b/DiscordChatExporter.Core/Discord/Data/Channel.cs index 81b2531..d55f8fc 100644 --- a/DiscordChatExporter.Core/Discord/Data/Channel.cs +++ b/DiscordChatExporter.Core/Discord/Data/Channel.cs @@ -11,7 +11,7 @@ public partial record Channel( Snowflake Id, ChannelKind Kind, Snowflake GuildId, - Snowflake ParentId, + Snowflake? ParentId, string? ParentName, int? ParentPosition, ChannelCategory Category, @@ -36,7 +36,7 @@ public partial record Channel json.GetPropertyOrNull("guild_id")?.GetNonWhiteSpaceStringOrNull()?.Pipe(Snowflake.Parse) ?? Guild.DirectMessages.Id; - var parentId = json.GetProperty("parent_id").GetNonWhiteSpaceString().Pipe(Snowflake.Parse); + var parentId = json.GetPropertyOrNull("parent_id")?.GetNonWhiteSpaceStringOrNull()?.Pipe(Snowflake.Parse); var category = categoryHint ?? ChannelCategory.CreateDefault(kind); diff --git a/DiscordChatExporter.Core/Discord/Data/ChannelThread.cs b/DiscordChatExporter.Core/Discord/Data/ChannelThread.cs index 412d923..5107023 100644 --- a/DiscordChatExporter.Core/Discord/Data/ChannelThread.cs +++ b/DiscordChatExporter.Core/Discord/Data/ChannelThread.cs @@ -10,7 +10,7 @@ public record ChannelThread( Snowflake Id, ChannelKind Kind, Snowflake GuildId, - Snowflake ParentId, + Snowflake? ParentId, string? ParentName, string Name, bool IsActive, @@ -29,7 +29,6 @@ public record ChannelThread( var parentId = json.GetProperty("parent_id").GetNonWhiteSpaceString().Pipe(Snowflake.Parse); var name = json.GetProperty("name").GetNonWhiteSpaceString(); - var isActive = !json .GetPropertyOrNull("thread_metadata")? .GetPropertyOrNull("archived")? diff --git a/DiscordChatExporter.Core/Discord/Data/Common/IChannel.cs b/DiscordChatExporter.Core/Discord/Data/Common/IChannel.cs index cba97b5..2aa36bd 100644 --- a/DiscordChatExporter.Core/Discord/Data/Common/IChannel.cs +++ b/DiscordChatExporter.Core/Discord/Data/Common/IChannel.cs @@ -4,7 +4,7 @@ public interface IChannel : IHasId { ChannelKind Kind { get; } Snowflake GuildId { get; } - Snowflake ParentId { get; } + Snowflake? ParentId { get; } string? ParentName { get; } int? ParentPosition { get; } string Name { get; } @@ -12,4 +12,4 @@ public interface IChannel : IHasId string? IconUrl { get; } string? Topic { get; } Snowflake? LastMessageId { get; } -} +} \ No newline at end of file diff --git a/DiscordChatExporter.Core/Exporting/ExportRequest.cs b/DiscordChatExporter.Core/Exporting/ExportRequest.cs index 982cf5d..1fd7dcb 100644 --- a/DiscordChatExporter.Core/Exporting/ExportRequest.cs +++ b/DiscordChatExporter.Core/Exporting/ExportRequest.cs @@ -149,7 +149,7 @@ public partial class ExportRequest { "%g" => guild.Id.ToString(), "%G" => guild.Name, - "%t" => channel.ParentId.ToString(), + "%t" => channel.ParentId.ToString() ?? "", "%T" => channel.ParentName ?? "", "%c" => channel.Id.ToString(), "%C" => channel.Name,