public async Task AsyncMain() { _config = JsonConvert.DeserializeObject <Configuration>(File.ReadAllText(@"data/config.json")); _config.Shutdown = false; _random = new FloraRandom(); _reactions = new Reactions(_random); await _reactions.LoadReactionsFromDatabase(); _botGames = new BotGameHandler(_random, _client, _logger); await _botGames.LoadBotGamesFromDB(); //Services InitServices(); var provider = _map.BuildServiceProvider(); //Command Setup await InitCommands(provider); _commands.Log += Log; await _client.LoginAsync(TokenType.Bot, _config.Token); await _client.StartAsync(); provider.GetRequiredService <CommandHandler>(); //provider.GetRequiredService<StartupHandler>(); provider.GetRequiredService <ReactionHandler>(); provider.GetRequiredService <ImageRateLimitHandler>(); provider.GetRequiredService <ReactionHandler>(); _logger.Log("Updating User List", "Startup"); foreach (SocketGuild guild in _client.Guilds) { await guild.DownloadUsersAsync(); } if (_config.RotatingGames) { _logger.Log("Starting game rotation", "RotatingGames"); WorkingTask(); } //Block task until program is closed await Task.Delay(-1); }