Beispiel #1
0
        private void OnMessageReceived(PrivateMessage message)
        {
            var command = new BotCommand
            {
                Channel = message.Channel,
                From    = message.From,
                Message = message.Message
            };

            SendCommandToBotsAsync(command).ContinueWith(PublishUnhandledException);
        }
Beispiel #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
                });
            }
        }
Beispiel #3
0
 protected Task SendCommandToBotsAsync(BotCommand command)
 {
     return(_aggregateBot.HandleAsync(command));
 }
Beispiel #4
0
        public Task HandleAsync(BotCommand command)
        {
            var tasks = _bots.Select(b => b.HandleAsync(command));

            return(Task.WhenAll(tasks));
        }
Beispiel #5
0
 public Task HandleAsync(BotCommand command)
 {
     return(Task.CompletedTask);
 }