This commit is contained in:
2022-07-06 14:32:16 +03:00
parent 27fe615447
commit efb6ac5192
5 changed files with 5 additions and 13 deletions

View File

@@ -96,16 +96,6 @@ internal class Boot
Console.Title = "ONLINE"; Console.Title = "ONLINE";
isReady = true; isReady = true;
new Thread(() =>
{
while (true)
{
Config.SaveConfig();
Thread.Sleep(10000);
}
}
).Start();
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@@ -99,6 +99,7 @@ public class Program
Console.WriteLine($"Running on version: {Config.GetValue<string>("Version") ?? System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()}"); Console.WriteLine($"Running on version: {Config.GetValue<string>("Version") ?? System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()}");
Console.WriteLine($"Git URL: {Config.GetValue<string>("GitURL") ?? " Could not find Git URL"}"); Console.WriteLine($"Git URL: {Config.GetValue<string>("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.ForegroundColor = ConsoleColor.White;
Console.WriteLine($"============================ LOG ============================"); Console.WriteLine($"============================ LOG ============================");

View File

@@ -5,7 +5,6 @@ using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using Newtonsoft.Json.Linq;
namespace PluginManager namespace PluginManager
{ {

View File

@@ -246,6 +246,8 @@ public class ConsoleCommandsHandler
await client.StopAsync(); await client.StopAsync();
await client.DisposeAsync(); await client.DisposeAsync();
Config.SaveConfig(); Config.SaveConfig();
Console.WriteLine("Bot is closing in 2 seconds ! Please wait to save data !");
await Task.Delay(2000);
Environment.Exit(0); Environment.Exit(0);
} }
); );

View File

@@ -77,7 +77,7 @@ namespace PluginManager.Others
/// <param name="LogMessage">The message to be wrote</param> /// <param name="LogMessage">The message to be wrote</param>
public static void WriteLogFile(string LogMessage) 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); if (!Directory.Exists(logFolder)) Directory.CreateDirectory(logFolder);
File.AppendAllText(logsPath, LogMessage + " \n"); File.AppendAllText(logsPath, LogMessage + " \n");
} }
@@ -88,7 +88,7 @@ namespace PluginManager.Others
/// <param name="ErrMessage">The message to be wrote</param> /// <param name="ErrMessage">The message to be wrote</param>
public static void WriteErrFile(string ErrMessage) 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); if (!Directory.Exists(errFolder)) Directory.CreateDirectory(errFolder);
File.AppendAllText(errPath, ErrMessage + " \n"); File.AppendAllText(errPath, ErrMessage + " \n");
} }