diff --git a/src/NadekoBot/Common/SmartText/SmartText.cs b/src/NadekoBot/Common/SmartText/SmartText.cs index 7bc840e25..e9e68b78c 100644 --- a/src/NadekoBot/Common/SmartText/SmartText.cs +++ b/src/NadekoBot/Common/SmartText/SmartText.cs @@ -1,5 +1,6 @@ #nullable disable -using System.Text.Json; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace NadekoBot; @@ -13,12 +14,6 @@ public abstract record SmartText public bool IsEmbedArray => this is SmartEmbedTextArray; - - private static readonly JsonSerializerOptions _opts = new JsonSerializerOptions() - { - PropertyNameCaseInsensitive = true, - PropertyNamingPolicy = JsonNamingPolicy.CamelCase - }; public static SmartText operator +(SmartText text, string input) => text switch @@ -58,13 +53,13 @@ public abstract record SmartText try { - var doc = JsonDocument.Parse(input); - var root = doc.RootElement; - if (root.ValueKind == JsonValueKind.Object) + var doc = JObject.Parse(input); + var root = doc.Root; + if (root.Type == JTokenType.Object) { - if (root.TryGetProperty("embeds", out _)) + if (((JObject)root).TryGetValue("embeds", out _)) { - var arr = root.Deserialize(_opts); + var arr = root.ToObject(); if (arr is null) return new SmartPlainText(input); @@ -73,7 +68,7 @@ public abstract record SmartText return arr; } - var obj = root.Deserialize(_opts); + var obj = root.ToObject(); if (obj is null) return new SmartPlainText(input); diff --git a/src/NadekoBot/Services/Impl/StatsService.cs b/src/NadekoBot/Services/Impl/StatsService.cs index 0978f6a1e..a89cd9721 100644 --- a/src/NadekoBot/Services/Impl/StatsService.cs +++ b/src/NadekoBot/Services/Impl/StatsService.cs @@ -7,7 +7,7 @@ namespace NadekoBot.Services; public sealed class StatsService : IStatsService, IReadyExecutor, INService { - public const string BOT_VERSION = "4.1.2"; + public const string BOT_VERSION = "4.1.3"; public string Author => "Kwoth#2452";