1
0

fix Config.json

This commit is contained in:
2023-07-25 17:11:00 +08:00
parent 784ece36cd
commit cb33113e8a
3 changed files with 25 additions and 2 deletions

View File

@@ -51,8 +51,14 @@ namespace Discord_Bot
public static JObject GetConfig()
{
using StreamReader configJson = new StreamReader(Directory.GetCurrentDirectory() + @"/Config.json");
return (JObject)JsonConvert.DeserializeObject(configJson.ReadToEnd());
string path = Directory.GetCurrentDirectory() + @"/Config.json";
if (!File.Exists(path))
{
throw new FileNotFoundException("gde config?");
}
using StreamReader configJson = new StreamReader(path);
return (JObject)JsonConvert.DeserializeObject(configJson.ReadToEnd());
}
public static void SaveConfig(JObject config)