protected override async Task ExecuteAsync(CancellationToken stoppingToken) { _logger.LogInformation("Connecting to Discord"); await _client.LoginAsync(TokenType.Bot, _discordSettings.ApiKey); await _client.StartAsync(); await _commandHandlingService.InitializeAsync(); _logger.LogInformation("Connection successful."); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { try { _logger.LogInformation("Connecting to Discord"); await _client.LoginAsync(TokenType.Bot, _discordSettings.ApiKey); await _client.StartAsync(); await _commandHandlingService.InitializeAsync(); _logger.LogInformation("Connection successful."); } catch (Exception e) { _logger.LogError("Something went wrong: {exception}\n {innerException}", e.Message, e.InnerException?.Message); } }