This commit is contained in:
2022-06-08 21:00:48 +03:00
parent 1712205222
commit 781bb489bd
2 changed files with 12 additions and 4 deletions

View File

@@ -43,7 +43,7 @@ namespace DiscordBot
} }
Console.WriteLine("Please insert your prefix (max. 1 character long):"); 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 = "); Console.Write("Prefix = ");
char prefix = Console.ReadLine()![0]; char prefix = Console.ReadLine()![0];
@@ -51,8 +51,17 @@ namespace DiscordBot
Config.AddValueToVariables("prefix", prefix.ToString(), false); Config.AddValueToVariables("prefix", prefix.ToString(), false);
break; 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(); HandleInput(args).Wait();

View File

@@ -1,9 +1,9 @@
using PluginManager.Others; using PluginManager.Others;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic;
namespace PluginManager namespace PluginManager
{ {
@@ -67,7 +67,6 @@ namespace PluginManager
} }
public static async Task LoadConfig() public static async Task LoadConfig()
{ {
string path = Functions.dataFolder + "config.json"; string path = Functions.dataFolder + "config.json";
if (File.Exists(path)) if (File.Exists(path))