mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-29 05:55:21 -04:00
Allow whitespace in sticker names
This commit is contained in:
parent
17b548d679
commit
ca56d47110
1 changed files with 2 additions and 1 deletions
|
@ -4,6 +4,7 @@ using JsonExtensions.Reading;
|
||||||
|
|
||||||
namespace DiscordChatExporter.Core.Discord.Data;
|
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)
|
public record Sticker(Snowflake Id, string Name, StickerFormat Format, string SourceUrl)
|
||||||
{
|
{
|
||||||
private static string GetSourceUrl(Snowflake id, StickerFormat format)
|
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)
|
public static Sticker Parse(JsonElement json)
|
||||||
{
|
{
|
||||||
var id = json.GetProperty("id").GetNonWhiteSpaceString().Pipe(Snowflake.Parse);
|
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 format = (StickerFormat)json.GetProperty("format_type").GetInt32();
|
||||||
|
|
||||||
var sourceUrl = GetSourceUrl(id, format);
|
var sourceUrl = GetSourceUrl(id, format);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue