Expect channel parents to be null

pull/1107/head
Tyrrrz 1 year ago
parent 8776a6955b
commit 51192425b7

@ -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);

@ -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")?

@ -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; }
}
}

@ -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,

Loading…
Cancel
Save