diff --git a/Budet-cho-bot/Budet-cho-bot.csproj b/Budet-cho-bot/Budet-cho-bot.csproj index ac47556..c7bc99f 100644 --- a/Budet-cho-bot/Budet-cho-bot.csproj +++ b/Budet-cho-bot/Budet-cho-bot.csproj @@ -13,4 +13,11 @@ + + + PreserveNewest + Config.json + + + diff --git a/Budet-cho-bot/Functions/Functions.cs b/Budet-cho-bot/Functions/Functions.cs index 13e1ebd..0f8f997 100644 --- a/Budet-cho-bot/Functions/Functions.cs +++ b/Budet-cho-bot/Functions/Functions.cs @@ -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) diff --git a/Config.json b/Config.json new file mode 100644 index 0000000..6de0c34 --- /dev/null +++ b/Config.json @@ -0,0 +1,10 @@ +{ + "version": "1.0", + "token": "MTA4NDA5MTA4OTE1NTI4MDkxNw.G77VAz.3O8uS-D4nwp1Ax8iZMBIx0Z9gsYNNOwPFfGRl8", + "prefixes": ["."], + "join_message": "Hello, I'm Discord Bot! :heart:", + "currently": "playing|listening|watching|streaming", + "playing_status": "майныч", + "status": "online|dnd|idle|offline", + "reminderTime": "1:12" +}