static async void LoadDatabase() { while (guild == null) { guild = Program.GetGuild(); } await guild.DownloadUsersAsync(); supporterRole = guild.GetRole(547202953505800233); supporterChannel = guild.GetTextChannel(547204432144891907); generalChannel = guild.GetChannel(334933825383563266) as SocketTextChannel; try { database = FileDatabase.Read <AccountDatabase>("Accounts/accounts"); Console.WriteLine("Loaded database!"); foreach (AccountInfo account in database.accounts.Values) { await UpdateAsync(account, null); } Console.WriteLine(database.accounts.Count); Console.WriteLine(database.expiryAccounts.Count); } catch (Exception e) { Console.WriteLine("Account database not found! " + e.Message); database = new AccountDatabase(); } }
public static void Save() { isChanged = false; FileDatabase.Write("Accounts/accounts", database, true); }