Exemple #1
0
        public void RunnerOutput(Request request, string result)
        {
            _client.SendMessage(SendMessage, request.channel, result);
            Console.WriteLine("Got runner result : " + result);

            // while we are here remove any runner that is now finished
            runners.RemoveAll(r => r.IsFinished() == true);
        }
Exemple #2
0
        private void Receieved(NewMessage message)
        {
            Console.WriteLine("Got message " + message.channel + " : " + message.text);

            var request = new Request {
                message = message.text,
                from = _client.UserLookup[message.user].name,
                channel = message.channel
            };

            foreach ( var responder in Responders )
            {
                if (responder.Matched(request))
                {
                    var runner = responder.Create(request, RunnerOutput);
                    if ( !runner.IsFinished())
                        runners.Add(runner);
                    return;
                }
            }

            _client.SendMessage(SendMessage, message.channel, "You said : " + message.text);
        }