Esempio n. 1
0
        public void HandleCommand(IRCServer server, string command, IncomingMessage message)
        {
            if (!message.HasMessage())
            {
                // bad syntax
                return;
            }


            if (COMMAND_REGEX.IsMatch(message.Message))
            {
                Match  m   = COMMAND_REGEX.Match(message.Message);
                string cmd = m.Groups[1].Value;

                if (cmd.Equals("about"))
                {
                    if (m.Groups[2].Value == null || m.Groups[2].Value.Equals(""))
                    {
                        message.SendChat("Need context");
                    }

                    string markov = MarkovDatabaseAdapter.MarkovFind(m.Groups[2].Value, m.Groups[3].Value);
                    if (markov == null || markov.Equals(""))
                    {
                        message.SendChat("I can't :(");
                    }
                    else
                    {
                        message.SendChat(markov);
                    }
                }
            }
        }
Esempio n. 2
0
 public MarkovListener()
 {
     if (!MarkovDatabaseAdapter.Setup())
     {
         // oh no
     }
 }
Esempio n. 3
0
 public void Handle(IncomingMessage message)
 {
     if (message.IsDestChannel())
     {
         MarkovDatabaseAdapter.MarkovLearn(message.Message);
         if (CommandManager.RANDOM.Next() * 100 <= Markov.REPLY_RATE)
         {
             string markov = MarkovDatabaseAdapter.MarkovGenerate();
             if (markov != null)
             {
                 //message.SendChat(markov);
             }
         }
     }
 }