fix Config.json
This commit is contained in:
parent
784ece36cd
commit
cb33113e8a
@ -13,4 +13,11 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ContentWithTargetPath Include="../Config.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<TargetPath>Config.json</TargetPath>
|
||||||
|
</ContentWithTargetPath>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -51,8 +51,14 @@ namespace Discord_Bot
|
|||||||
|
|
||||||
public static JObject GetConfig()
|
public static JObject GetConfig()
|
||||||
{
|
{
|
||||||
using StreamReader configJson = new StreamReader(Directory.GetCurrentDirectory() + @"/Config.json");
|
string path = Directory.GetCurrentDirectory() + @"/Config.json";
|
||||||
return (JObject)JsonConvert.DeserializeObject(configJson.ReadToEnd());
|
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)
|
public static void SaveConfig(JObject config)
|
||||||
|
|||||||
10
Config.json
Normal file
10
Config.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user