|
|
@ -13,6 +13,7 @@ namespace DiscordChatExporter.Core.Discord.Data;
|
|
|
|
public record Message(
|
|
|
|
public record Message(
|
|
|
|
Snowflake Id,
|
|
|
|
Snowflake Id,
|
|
|
|
MessageKind Kind,
|
|
|
|
MessageKind Kind,
|
|
|
|
|
|
|
|
MessageFlags Flags,
|
|
|
|
User Author,
|
|
|
|
User Author,
|
|
|
|
DateTimeOffset Timestamp,
|
|
|
|
DateTimeOffset Timestamp,
|
|
|
|
DateTimeOffset? EditedTimestamp,
|
|
|
|
DateTimeOffset? EditedTimestamp,
|
|
|
@ -87,6 +88,7 @@ public record Message(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var id = json.GetProperty("id").GetNonWhiteSpaceString().Pipe(Snowflake.Parse);
|
|
|
|
var id = json.GetProperty("id").GetNonWhiteSpaceString().Pipe(Snowflake.Parse);
|
|
|
|
var kind = (MessageKind)json.GetProperty("type").GetInt32();
|
|
|
|
var kind = (MessageKind)json.GetProperty("type").GetInt32();
|
|
|
|
|
|
|
|
var flags = (MessageFlags?)json.GetPropertyOrNull("flags")?.GetInt32() ?? MessageFlags.None;
|
|
|
|
var author = json.GetProperty("author").Pipe(User.Parse);
|
|
|
|
var author = json.GetProperty("author").Pipe(User.Parse);
|
|
|
|
|
|
|
|
|
|
|
|
var timestamp = json.GetProperty("timestamp").GetDateTimeOffset();
|
|
|
|
var timestamp = json.GetProperty("timestamp").GetDateTimeOffset();
|
|
|
@ -139,6 +141,7 @@ public record Message(
|
|
|
|
return new Message(
|
|
|
|
return new Message(
|
|
|
|
id,
|
|
|
|
id,
|
|
|
|
kind,
|
|
|
|
kind,
|
|
|
|
|
|
|
|
flags,
|
|
|
|
author,
|
|
|
|
author,
|
|
|
|
timestamp,
|
|
|
|
timestamp,
|
|
|
|
editedTimestamp,
|
|
|
|
editedTimestamp,
|
|
|
|