From 781bb489bdfb1a9d8698d65703df1ca5d3bace5e Mon Sep 17 00:00:00 2001 From: Wizzy69 Date: Wed, 8 Jun 2022 21:00:48 +0300 Subject: [PATCH] --- DiscordBot/Program.cs | 13 +++++++++++-- PluginManager/Config.cs | 3 +-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs index 00aadb4..7a9f374 100644 --- a/DiscordBot/Program.cs +++ b/DiscordBot/Program.cs @@ -43,7 +43,7 @@ namespace DiscordBot } Console.WriteLine("Please insert your prefix (max. 1 character long):"); - Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored. No spaces or numbers allowed"); + Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored.\n No spaces or numbers allowed"); Console.Write("Prefix = "); char prefix = Console.ReadLine()![0]; @@ -51,8 +51,17 @@ namespace DiscordBot Config.AddValueToVariables("prefix", prefix.ToString(), false); break; } + } - Config.SaveConfig(); + if (!Config.ContainsKey("prefix")) + { + Console.WriteLine("Please insert your prefix (max. 1 character long):"); + Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored.\n No spaces or numbers allowed"); + Console.Write("Prefix = "); + char prefix = Console.ReadLine()![0]; + + if (prefix == ' ' || char.IsDigit(prefix)) return; + Config.AddValueToVariables("prefix", prefix.ToString(), false); } HandleInput(args).Wait(); diff --git a/PluginManager/Config.cs b/PluginManager/Config.cs index d6cb269..e00cb5d 100644 --- a/PluginManager/Config.cs +++ b/PluginManager/Config.cs @@ -1,9 +1,9 @@ using PluginManager.Others; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.Json; using System.Threading.Tasks; +using System.Collections.Generic; namespace PluginManager { @@ -67,7 +67,6 @@ namespace PluginManager } public static async Task LoadConfig() - { string path = Functions.dataFolder + "config.json"; if (File.Exists(path))