Updated some namespaces, finished some todos. v5 should be cancelled probably as the code is too intertwined to make it modular

This commit is contained in:
Kwoth
2023-11-11 05:22:52 +00:00
parent a28be0d343
commit bc77783820
224 changed files with 308 additions and 317 deletions

View File

@@ -6,6 +6,7 @@ using System.Text.Json;
namespace NadekoBot.Modules.Searches;
// todo fix stock/crypto
public sealed class DefaultStockDataService : IStockDataService, INService
{
private readonly IHttpClientFactory _httpClientFactory;
@@ -82,7 +83,6 @@ public sealed class DefaultStockDataService : IStockDataService, INService
PrepareHeaderForMatch = args => args.Header.Humanize(LetterCasing.Title)
};
// todo replace .ToTimestamp() and remove google protobuf dependency
// todo this needs testing
public async Task<IReadOnlyCollection<CandleData>> GetCandleDataAsync(string query)
{

View File

@@ -5,7 +5,7 @@ using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Db;
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
namespace NadekoBot.Modules.Searches.Services;

View File

@@ -13,7 +13,7 @@ global using Nadeko.Common; // new project
global using NadekoBot.Common; // old + nadekobot specific things
global using NadekoBot.Common.Attributes;
global using NadekoBot.Extensions;
// global using Nadeko.Snake;
// global using Nadeko.Medusa;
// discord
global using Discord;

View File

@@ -10,6 +10,7 @@ using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Http.Json;
using Color = SixLabors.ImageSharp.Color;
namespace NadekoBot.Modules.Searches;
@@ -548,9 +549,7 @@ public partial class Searches : NadekoModule<SearchesService>
try
{
using var http = _httpFactory.CreateClient();
var res = await http.GetStringAsync($"https://bible-api.com/{book} {chapterAndVerse}");
obj = JsonConvert.DeserializeObject<BibleVerses>(res);
obj = await http.GetFromJsonAsync<BibleVerses>($"https://bible-api.com/{book} {chapterAndVerse}");
}
catch
{

View File

@@ -5,7 +5,7 @@ using NadekoBot.Db;
using NadekoBot.Db.Models;
using NadekoBot.Modules.Searches.Common;
using NadekoBot.Modules.Searches.Common.StreamNotifications;
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
namespace NadekoBot.Modules.Searches.Services;

View File

@@ -3,7 +3,7 @@ using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
using System.Net;
namespace NadekoBot.Modules.Searches;

View File

@@ -1,7 +1,7 @@
#nullable disable
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
namespace NadekoBot.Modules.Searches;

View File

@@ -1,9 +1,9 @@
#nullable disable
using Newtonsoft.Json;
using System.Text.Json.Serialization;
namespace NadekoBot.Modules.Searches.Common;
// todo replace newtonsoft with json.text
public class BibleVerses
{
public string Error { get; set; }
@@ -12,7 +12,7 @@ public class BibleVerses
public class BibleVerse
{
[JsonProperty("book_name")]
[JsonPropertyName("book_name")]
public string BookName { get; set; }
public int Chapter { get; set; }