dev: Removed some unused code, no functional change

This commit is contained in:
Kwoth
2024-08-05 13:18:44 +00:00
parent f8da25a6f3
commit 15fe8b5daf
7 changed files with 15 additions and 113 deletions

View File

@@ -1,6 +1,5 @@
#nullable disable
using Microsoft.Extensions.Caching.Memory;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Modules.Games.Common;
using NadekoBot.Modules.Games.Common.Acrophobia;
using NadekoBot.Modules.Games.Common.Nunchi;
@@ -8,11 +7,10 @@ using Newtonsoft.Json;
namespace NadekoBot.Modules.Games.Services;
public class GamesService : INService, IReadyExecutor
public class GamesService : INService
{
private const string TYPING_ARTICLES_PATH = "data/typing_articles3.json";
public ConcurrentDictionary<ulong, GirlRating> GirlRatings { get; } = new();
public IReadOnlyList<string> EightBallResponses
=> _gamesConfig.Data.EightBallResponses;
@@ -25,7 +23,6 @@ public class GamesService : INService, IReadyExecutor
public ConcurrentDictionary<ulong, TypingGame> RunningContests { get; } = new();
public ConcurrentDictionary<ulong, NunchiGame> NunchiGames { get; } = new();
public AsyncLazy<RatingTexts> Ratings { get; }
private readonly GamesConfigService _gamesConfig;
private readonly IHttpClientFactory _httpFactory;
@@ -41,7 +38,6 @@ public class GamesService : INService, IReadyExecutor
SizeLimit = 500_000
});
Ratings = new(GetRatingTexts);
_rng = new NadekoRandom();
try
@@ -55,22 +51,6 @@ public class GamesService : INService, IReadyExecutor
}
}
public async Task OnReadyAsync()
{
// reset rating once a day
using var timer = new PeriodicTimer(TimeSpan.FromDays(1));
while (await timer.WaitForNextTickAsync())
GirlRatings.Clear();
}
private async Task<RatingTexts> GetRatingTexts()
{
using var http = _httpFactory.CreateClient();
var text = await http.GetStringAsync(
"https://nadeko-pictures.nyc3.digitaloceanspaces.com/other/rategirl/rates.json");
return JsonConvert.DeserializeObject<RatingTexts>(text);
}
public void AddTypingArticle(IUser user, string text)
{
TypingArticles.Add(new()
@@ -104,15 +84,4 @@ public class GamesService : INService, IReadyExecutor
File.WriteAllText(TYPING_ARTICLES_PATH, JsonConvert.SerializeObject(articles));
return removed;
}
public class RatingTexts
{
public string Nog { get; set; }
public string Tra { get; set; }
public string Fun { get; set; }
public string Uni { get; set; }
public string Wif { get; set; }
public string Dat { get; set; }
public string Dan { get; set; }
}
}