Formatting

This commit is contained in:
Tyrrrz
2026-02-27 17:56:29 +02:00
parent 28f26e45fb
commit 675d910ea3
10 changed files with 29 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
using DiscordChatExporter.Core.Discord; using DiscordChatExporter.Core.Discord;
namespace DiscordChatExporter.Cli.Tests.Infra; namespace DiscordChatExporter.Cli.Tests.Infra;

View File

@@ -19,9 +19,6 @@ public class HtmlForwardSpecs
); );
// Assert // Assert
message message.Text().Should().ContainAll("Forwarded", @"¯\_(ツ)_/¯", "December 29, 2025");
.Text()
.Should()
.ContainAll("Forwarded", @"¯\_(ツ)_/¯", "December 29, 2025");
} }
} }

View File

@@ -27,4 +27,3 @@ public class JsonForwardSpecs
forwardedMessage.GetProperty("timestamp").GetString().Should().StartWith("2025-12-29"); forwardedMessage.GetProperty("timestamp").GetString().Should().StartWith("2025-12-29");
} }
} }

View File

@@ -14,8 +14,6 @@ public class PlainTextForwardSpecs
var document = await ExportWrapper.ExportAsPlainTextAsync(ChannelIds.ForwardTestCases); var document = await ExportWrapper.ExportAsPlainTextAsync(ChannelIds.ForwardTestCases);
// Assert // Assert
document document.Should().ContainAll("{Forwarded Message}", @"¯\_(ツ)_/¯", "December 29, 2025");
.Should()
.ContainAll("{Forwarded Message}", @"¯\_(ツ)_/¯", "December 29, 2025");
} }
} }

View File

@@ -9,7 +9,8 @@ public record MessageReference(
MessageReferenceKind Kind, MessageReferenceKind Kind,
Snowflake? MessageId, Snowflake? MessageId,
Snowflake? ChannelId, Snowflake? ChannelId,
Snowflake? GuildId) Snowflake? GuildId
)
{ {
public static MessageReference Parse(JsonElement json) public static MessageReference Parse(JsonElement json)
{ {

View File

@@ -15,7 +15,8 @@ public record MessageSnapshot(
string Content, string Content,
IReadOnlyList<Attachment> Attachments, IReadOnlyList<Attachment> Attachments,
IReadOnlyList<Embed> Embeds, IReadOnlyList<Embed> Embeds,
IReadOnlyList<Sticker> Stickers) IReadOnlyList<Sticker> Stickers
)
{ {
public static MessageSnapshot Parse(JsonElement json) public static MessageSnapshot Parse(JsonElement json)
{ {
@@ -23,37 +24,35 @@ public record MessageSnapshot(
json.GetPropertyOrNull("timestamp")?.GetDateTimeOffsetOrNull() json.GetPropertyOrNull("timestamp")?.GetDateTimeOffsetOrNull()
?? DateTimeOffset.MinValue; ?? DateTimeOffset.MinValue;
var editedTimestamp = json var editedTimestamp = json.GetPropertyOrNull("edited_timestamp")?.GetDateTimeOffsetOrNull();
.GetPropertyOrNull("edited_timestamp")
?.GetDateTimeOffsetOrNull();
var content = json.GetPropertyOrNull("content")?.GetStringOrNull() ?? ""; var content = json.GetPropertyOrNull("content")?.GetStringOrNull() ?? "";
var attachments = var attachments =
json json.GetPropertyOrNull("attachments")
.GetPropertyOrNull("attachments")
?.EnumerateArrayOrNull() ?.EnumerateArrayOrNull()
?.Select(Attachment.Parse) ?.Select(Attachment.Parse)
.ToArray() .ToArray()
?? []; ?? [];
var embeds = var embeds =
json json.GetPropertyOrNull("embeds")?.EnumerateArrayOrNull()?.Select(Embed.Parse).ToArray()
.GetPropertyOrNull("embeds")
?.EnumerateArrayOrNull()
?.Select(Embed.Parse)
.ToArray()
?? []; ?? [];
var stickers = var stickers =
json json.GetPropertyOrNull("sticker_items")
.GetPropertyOrNull("sticker_items")
?.EnumerateArrayOrNull() ?.EnumerateArrayOrNull()
?.Select(Sticker.Parse) ?.Select(Sticker.Parse)
.ToArray() .ToArray()
?? []; ?? [];
return new MessageSnapshot(timestamp, return new MessageSnapshot(
editedTimestamp, content, attachments, embeds, stickers); timestamp,
editedTimestamp,
content,
attachments,
embeds,
stickers
);
} }
} }