From ca56d47110181b09a8d5007f1d299d6d1fc19625 Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Fri, 20 May 2022 20:45:42 +0300 Subject: [PATCH] Allow whitespace in sticker names --- DiscordChatExporter.Core/Discord/Data/Sticker.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DiscordChatExporter.Core/Discord/Data/Sticker.cs b/DiscordChatExporter.Core/Discord/Data/Sticker.cs index 5274f46..5970a96 100644 --- a/DiscordChatExporter.Core/Discord/Data/Sticker.cs +++ b/DiscordChatExporter.Core/Discord/Data/Sticker.cs @@ -4,6 +4,7 @@ using JsonExtensions.Reading; namespace DiscordChatExporter.Core.Discord.Data; +// https://discord.com/developers/docs/resources/sticker#sticker-resource public record Sticker(Snowflake Id, string Name, StickerFormat Format, string SourceUrl) { private static string GetSourceUrl(Snowflake id, StickerFormat format) @@ -15,7 +16,7 @@ public record Sticker(Snowflake Id, string Name, StickerFormat Format, string So public static Sticker Parse(JsonElement json) { var id = json.GetProperty("id").GetNonWhiteSpaceString().Pipe(Snowflake.Parse); - var name = json.GetProperty("name").GetNonWhiteSpaceString(); + var name = json.GetProperty("name").GetNonNullString(); var format = (StickerFormat)json.GetProperty("format_type").GetInt32(); var sourceUrl = GetSourceUrl(id, format);