private void InitializeStorage() { Commands = new CommandStore(); // load default commands Commands.AddMany(DefaultCommands.Content); CommandStateData = new TwoKeyDictionary <string, ulong, CommandState>(CommandState.None, 0); UserFlags = new TwoKeyDictionary <ulong, ulong, UserFlag>(UserFlag.User, 0); }
public async Task Initialize() { Utilities.WriteLog($"XenoBot2 v{Utilities.GetVersion()} starting initialization..."); // Initialize command storage, needs to be done before config load Commands = new CommandStore(); // load default commands Commands.AddMany(DefaultCommands.Content); CommandStateData = new TwoKeyDictionary <string, ulong, CommandState>(CommandState.None, 0); Manager = new ServerManager(); var timer = new Stopwatch(); Utilities.WriteLog("Looking for config..."); timer.Start(); await LoadConfig(); timer.Stop(); Utilities.WriteLog($"Config load took {timer.ElapsedMilliseconds} ms."); if (!Directory.Exists("Data")) { Directory.CreateDirectory("Data"); } Utilities.WriteLog("Setting up command data..."); timer.Restart(); Strings.WhatTheCommit = (await Utilities.GetAsset("https://www.lohikar.io/assets/xenobot/commits.txt", "wtc.txt")).Split('\n'); Strings.Names = (await Utilities.GetAsset("https://www.lohikar.io/assets/xenobot/names.txt", "wtc_names.txt")).Split('\n'); timer.Stop(); Utilities.WriteLog($"Done setting up command data; took {timer.ElapsedMilliseconds} ms."); // initialize client _client = new DiscordClient(); _client.MessageReceived += MessageReceived; _client.Ready += OnReady; Utilities.WriteLog("Done initialization."); }