diff --git a/DiscordBot/Discord/Core/Boot.cs b/DiscordBot/Discord/Core/Boot.cs index ce2ad4c..2c6e9f7 100644 --- a/DiscordBot/Discord/Core/Boot.cs +++ b/DiscordBot/Discord/Core/Boot.cs @@ -96,16 +96,6 @@ internal class Boot Console.Title = "ONLINE"; isReady = true; - new Thread(() => - { - while (true) - { - Config.SaveConfig(); - Thread.Sleep(10000); - } - } - ).Start(); - return Task.CompletedTask; } diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs index c78d07d..bbce4ef 100644 --- a/DiscordBot/Program.cs +++ b/DiscordBot/Program.cs @@ -99,6 +99,7 @@ public class Program Console.WriteLine($"Running on version: {Config.GetValue("Version") ?? System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()}"); Console.WriteLine($"Git URL: {Config.GetValue("GitURL") ?? " Could not find Git URL"}"); + Console_Utilities.WriteColorText("&rRemember to close the bot using the ShutDown command &y(sd) &ror some settings won't be saved"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine($"============================ LOG ============================"); diff --git a/PluginManager/Config.cs b/PluginManager/Config.cs index 985abc8..5314c53 100644 --- a/PluginManager/Config.cs +++ b/PluginManager/Config.cs @@ -5,7 +5,6 @@ using System.Text.Json; using System.Threading.Tasks; using System.Collections.Generic; using System.Threading; -using Newtonsoft.Json.Linq; namespace PluginManager { diff --git a/PluginManager/Items/ConsoleCommandsHandler.cs b/PluginManager/Items/ConsoleCommandsHandler.cs index 0e88442..9e22455 100644 --- a/PluginManager/Items/ConsoleCommandsHandler.cs +++ b/PluginManager/Items/ConsoleCommandsHandler.cs @@ -246,6 +246,8 @@ public class ConsoleCommandsHandler await client.StopAsync(); await client.DisposeAsync(); Config.SaveConfig(); + Console.WriteLine("Bot is closing in 2 seconds ! Please wait to save data !"); + await Task.Delay(2000); Environment.Exit(0); } ); diff --git a/PluginManager/Others/Functions.cs b/PluginManager/Others/Functions.cs index c1df251..38bba1d 100644 --- a/PluginManager/Others/Functions.cs +++ b/PluginManager/Others/Functions.cs @@ -77,7 +77,7 @@ namespace PluginManager.Others /// The message to be wrote public static void WriteLogFile(string LogMessage) { - string logsPath = logFolder + "Log.txt"; + string logsPath = logFolder + $"{DateTime.Today.ToShortDateString().Replace("/", "-").Replace("\\", "-")} Log.txt"; if (!Directory.Exists(logFolder)) Directory.CreateDirectory(logFolder); File.AppendAllText(logsPath, LogMessage + " \n"); } @@ -88,7 +88,7 @@ namespace PluginManager.Others /// The message to be wrote public static void WriteErrFile(string ErrMessage) { - string errPath = errFolder + "Error.txt"; + string errPath = errFolder + $"{DateTime.Today.ToShortDateString().Replace("/", "-").Replace("\\", "-")} Error.txt"; if (!Directory.Exists(errFolder)) Directory.CreateDirectory(errFolder); File.AppendAllText(errPath, ErrMessage + " \n"); }