Пример #1
0
        private void OnMessageReceived(PrivateMessage message)
        {
            var command = new BotCommand
            {
                Channel = message.Channel,
                From    = message.From,
                Message = message.Message
            };

            SendCommandToBotsAsync(command).ContinueWith(PublishUnhandledException);
        }
Пример #2
0
        public async Task HandleAsync(BotCommand command)
        {
            var response = await _responder.HandleAsync(command);

            if (response != null)
            {
                EventHappened.Invoke(new BotEvent
                {
                    Channel = command.Channel,
                    Message = response
                });
            }
        }
Пример #3
0
 protected Task SendCommandToBotsAsync(BotCommand command)
 {
     return(_aggregateBot.HandleAsync(command));
 }
Пример #4
0
        public Task HandleAsync(BotCommand command)
        {
            var tasks = _bots.Select(b => b.HandleAsync(command));

            return(Task.WhenAll(tasks));
        }
Пример #5
0
 public Task HandleAsync(BotCommand command)
 {
     return(Task.CompletedTask);
 }