Fix: serialization error on thread creation timestamp. (#2188)

This commit is contained in:
Armano den Boef
2022-03-26 13:45:54 +01:00
committed by GitHub
parent 741ed809d6
commit d48a7bd348
2 changed files with 2 additions and 2 deletions

View File

@@ -21,6 +21,6 @@ namespace Discord.API
public Optional<bool> Invitable { get; set; } public Optional<bool> Invitable { get; set; }
[JsonProperty("create_timestamp")] [JsonProperty("create_timestamp")]
public Optional<DateTimeOffset> CreatedAt { get; set; } public Optional<DateTimeOffset?> CreatedAt { get; set; }
} }
} }

View File

@@ -121,7 +121,7 @@ namespace Discord.WebSocket
internal new static SocketThreadChannel Create(SocketGuild guild, ClientState state, Model model) internal new static SocketThreadChannel Create(SocketGuild guild, ClientState state, Model model)
{ {
var parent = guild.GetChannel(model.CategoryId.Value); var parent = guild.GetChannel(model.CategoryId.Value);
var entity = new SocketThreadChannel(guild.Discord, guild, model.Id, parent, model.ThreadMetadata.GetValueOrDefault()?.CreatedAt.ToNullable()); var entity = new SocketThreadChannel(guild.Discord, guild, model.Id, parent, model.ThreadMetadata.GetValueOrDefault()?.CreatedAt.GetValueOrDefault(null));
entity.Update(state, model); entity.Update(state, model);
return entity; return entity;
} }