-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGlobalConfiguration.cs
43 lines (36 loc) · 1007 Bytes
/
GlobalConfiguration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.IO;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace MopBot
{
//Used for important things, like configuring a list of developers, or global permament toggling for systems.
public class GlobalConfiguration
{
public class Config
{
public string token;
public ulong[] masterUsers;
public ulong[] usersToPingForExceptions;
public ulong? logChannel;
public bool enableBashCommand;
public Dictionary<string, bool> systemToggles;
public int maxMemoryBackups = 10;
}
public const string ConfigurationFile = "BotConfig.json";
public static Config config;
public static void Initialize()
{
if (File.Exists(ConfigurationFile)) {
config = JsonConvert.DeserializeObject<Config>(File.ReadAllText(ConfigurationFile));
}
if (config == null) {
config = new Config();
Save();
}
}
public static void Save()
{
File.WriteAllText(ConfigurationFile, JsonConvert.SerializeObject(config, Formatting.Indented));
}
}
}