Пример #1
0
        private async Task MessageReceived(SlackMessage message)
        {
            _logger.Information("[Message found from '{FromUserName} in channel {ChannelName}']:\n" +
                                "{MessageText}", message.User.Name, message.ChatHub.Name, message.Text.SafeSubstring(0, 90));

            try
            {
                await _dispatcher.HandleMessage(message);
            }
            catch (System.Exception e)
            {
                _logger.Error(e, e.Message);
            }
        }
Пример #2
0
        //protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        //{
        //    var connection = await ConnectionProvider.GetConnection();
        //    connection.OnMessageReceived += MessageReceived;

        //}

        public async Task MessageReceived(SlackMessage message)
        {
            _logger.Information("[Message found from '{FromUserName}']", message.User.Name);
            _logger.Debug($"MSG: {message.Text.SafeSubstring(0, 90)}");

            try
            {
                await _dispatcher.HandleMessage(message);
            }
            catch (System.Exception e)
            {
                _logger.Error(e, e.Message);
            }
        }