public Dictionary <ulong, KappaGuild> guilds; // Guild dictionary, <guild id, guild persistency data> /// <summary> /// Creates an object based off of data from the guilds.json. /// </summary> /// <param name="path">The path to the guilds.json file</param> public GuildManager(string path) { path = KappaIO.EnsureFileExists(path, "guilds.json is not found in the data folder! Building an empty guilds.json..."); guilds = new Dictionary <ulong, KappaGuild>(); string jsonData = File.ReadAllTextAsync(path).Result; if (!string.IsNullOrEmpty(jsonData)) { ReadGuilds(JObject.Parse(jsonData)); } }
public ResponseManager(string linesPath, string embedsPath) { linesPath = KappaIO.EnsureFileExists(linesPath, Resources.lines, "lines.json is not found in the data folder! Building lines.json..."); lines = new Dictionary <string, List <string> >(); embeds = new Dictionary <string, List <EmbedBuilder> >(); this.embedsPath = embedsPath; // Might make these two be laoded in separate threads in the future JObject linesJson = JObject.Parse(File.ReadAllTextAsync(linesPath).Result); LoadLines(linesJson); }
/// <summary> /// Rebuilds/Generates a config.json from Resources /// </summary> /// <param name="path">Path to config.json</param> /// <returns>path</returns> private string RewriteConfig(string path) { KappaIO.EnsureFileExists(path, Resources.config, "config.json is not found in the data folder! Building the config..."); return(path); }