public async Task MainAsync(string token) { using (CommandService commandService = new CommandService()) { _client = new DiscordSocketClient(); openDota = OpenDotaApi.GetInstance(); _client.Log += Log; await _client.LoginAsync(TokenType.Bot, token); await _client.StartAsync(); var services = new ServiceCollection() .AddSingleton(_client) .AddSingleton <InteractiveService>() .BuildServiceProvider(); CommandHandler handler = new CommandHandler(_client, commandService, services, openDota); await handler.InstallCommandsAsync(); // Block this task until the program is closed. await Task.Delay(-1); } }