diff --git a/DiscordBot/Discord/Core/Boot.cs b/DiscordBot/Discord/Core/Boot.cs index 14f30c8..942178f 100644 --- a/DiscordBot/Discord/Core/Boot.cs +++ b/DiscordBot/Discord/Core/Boot.cs @@ -5,7 +5,6 @@ using System; using System.Threading; using System.Threading.Tasks; using PluginManager; -using PluginManager.Others; using static PluginManager.Others.Functions; namespace DiscordBot.Discord.Core @@ -77,17 +76,6 @@ namespace DiscordBot.Discord.Core } - /// - /// The method that stops the bot from running - /// - /// - public async Task ShutDown() - { - if (client == null) return; - await client.LogoutAsync(); - await client.StopAsync(); - } - private void CommonTasks() { if (client == null) return; diff --git a/DiscordBot/DiscordBot.csproj b/DiscordBot/DiscordBot.csproj index 37fb607..f83d305 100644 --- a/DiscordBot/DiscordBot.csproj +++ b/DiscordBot/DiscordBot.csproj @@ -6,6 +6,16 @@ disable + False + True + + + + none + + + + none diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs index f31fda2..c14a884 100644 --- a/DiscordBot/Program.cs +++ b/DiscordBot/Program.cs @@ -50,9 +50,7 @@ namespace DiscordBot char prefix = Console.ReadLine()[0]; if (prefix == ' ' || char.IsDigit(prefix)) continue; - Config.AddValueToVariables("prefix", prefix.ToString(), false); - break; } diff --git a/DiscordBotGUI/AppUpdater.axaml.cs b/DiscordBotGUI/AppUpdater.axaml.cs index 2295319..bf06532 100644 --- a/DiscordBotGUI/AppUpdater.axaml.cs +++ b/DiscordBotGUI/AppUpdater.axaml.cs @@ -153,7 +153,7 @@ namespace DiscordBotGUI string current_version = Config.GetValue("Version"); if (current_version == null) if (!Config.SetValue("Version", "0")) - Config.AddValueToVariables("Version", "0"); + Config.AddValueToVariables("Version", "0", false); string latest_version = (await ServerCom.ReadTextFromFile("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Updates/Version"))[0]; _version = latest_version; if (current_version != latest_version) { return true; } diff --git a/DiscordBotGUI/MainWindow.axaml.cs b/DiscordBotGUI/MainWindow.axaml.cs index 52f379f..43ad182 100644 --- a/DiscordBotGUI/MainWindow.axaml.cs +++ b/DiscordBotGUI/MainWindow.axaml.cs @@ -42,8 +42,8 @@ namespace DiscordBotGUI return; } - Functions.WriteToSettings(Functions.dataFolder + "DiscordBotCore.data", "BOT_TOKEN", token, '='); - Functions.WriteToSettings(Functions.dataFolder + "DiscordBotCore.data", "BOT_PREFIX", prefix, '='); + Config.SetValue("token", token); + Config.SetValue("prefix", prefix); RunDiscordBot(args); }; diff --git a/PluginManager/Config.cs b/PluginManager/Config.cs index dee04ae..4c35991 100644 --- a/PluginManager/Config.cs +++ b/PluginManager/Config.cs @@ -17,11 +17,11 @@ namespace PluginManager { private static AppConfig appConfig = null; - public static bool AddValueToVariables(string key, string value, bool isReadOnly) + public static bool AddValueToVariables(string key, string value, bool isProtected) { if (appConfig.ApplicationVariables.ContainsKey(key)) return false; appConfig.ApplicationVariables.Add(key, value); - if (isReadOnly) appConfig.ProtectedKeyWords.Add(key); + if (isProtected) appConfig.ProtectedKeyWords.Add(key); SaveConfig(); return true; } @@ -61,7 +61,6 @@ namespace PluginManager { appConfig = await Functions.ConvertFromJson(path); Functions.WriteLogFile($"Loaded {appConfig.ApplicationVariables.Keys.Count} application variables.\nLoaded {appConfig.ProtectedKeyWords.Count} readonly variables."); - //Console.WriteLine($"Loaded {appConfig.ApplicationVariables.Count} application variables !"); } else appConfig = new() { ApplicationVariables = new Dictionary(), ProtectedKeyWords = new List() };