From 8de93625497749ca307206a2302fbb26c23bd466 Mon Sep 17 00:00:00 2001 From: Jakub Hampl Date: Thu, 4 Feb 2021 17:19:04 +0100 Subject: [PATCH] Changed version number; cleanup --- thorn/Config/pairs.json | 2 +- thorn/Program.cs | 6 ++---- thorn/Reminder/ReminderJob.cs | 2 +- thorn/Services/DataStorageService.cs | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/thorn/Config/pairs.json b/thorn/Config/pairs.json index 3848bd8..a904cf0 100644 --- a/thorn/Config/pairs.json +++ b/thorn/Config/pairs.json @@ -1,5 +1,5 @@ { - "INFO": "**Verze:** 2.0\n**Repozitář:** https://github.com/scp-cs/Thorn", + "INFO": "**Verze:** 2.1\n**Repozitář:** https://github.com/scp-cs/Thorn", "WELCOME_CHANNEL_ID": "666672988883779585", "NEWS_CHANNEL_ID": "537063810121334784", diff --git a/thorn/Program.cs b/thorn/Program.cs index 5e18674..99b69f9 100644 --- a/thorn/Program.cs +++ b/thorn/Program.cs @@ -60,13 +60,11 @@ private static async Task Main() collection.AddSingleton(); collection.AddSingleton(); - // Quartz collection.AddSingleton(); collection.AddSingleton(); + collection.AddSingleton(); - collection.AddSingleton(new JobSchedule( - typeof(ReminderJob), - "0 0 0 * * ?")); // Every day at midnight + collection.AddSingleton(new JobSchedule(typeof(ReminderJob), "0 0 0 * * ?")); // Every day at midnight }); await hostBuilder.RunConsoleAsync(); diff --git a/thorn/Reminder/ReminderJob.cs b/thorn/Reminder/ReminderJob.cs index 9a28f44..a766a05 100644 --- a/thorn/Reminder/ReminderJob.cs +++ b/thorn/Reminder/ReminderJob.cs @@ -25,7 +25,7 @@ public ReminderJob(ILogger logger, DiscordSocketClient client, Pair _pairs = pairs; _channel = client.GetChannel(ulong.Parse(pairs.GetString("GENERAL_CHANNEL_ID"))) as SocketTextChannel; - _daily = DataStorageService.GetDictionary("Config/daily.json"); + _daily = data.GetDictionary("Config/daily.json"); } public async Task Execute(IJobExecutionContext context) diff --git a/thorn/Services/DataStorageService.cs b/thorn/Services/DataStorageService.cs index c798e1e..93cfd90 100644 --- a/thorn/Services/DataStorageService.cs +++ b/thorn/Services/DataStorageService.cs @@ -28,7 +28,7 @@ public Task SaveAllUserAccounts(IEnumerable accounts, string filePa return Task.CompletedTask; } - public static Dictionary GetDictionary(string path) => + public Dictionary GetDictionary(string path) => JsonConvert.DeserializeObject>(File.ReadAllText(path)); public static List LoadUserAccounts(string filePath)