Пример #1
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Starting bot");
            _logger.LogInformation("Testing {MessengerType}", _messenger.GetType().FullName);

            bool testOk = await _messenger.Test(cancellationToken).ConfigureAwait(false);

            if (!testOk)
            {
                _logger.LogWarning("Messenger test failed.");
                return;
            }

            _logger.LogInformation("Messenger test successful.");

            _messenger.SnapshotRequested += MessengerOnSnapshotRequested;
            await _messenger.Start(cancellationToken).ConfigureAwait(false);

            _logger.LogInformation("Bot started.");
        }