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); } } } }
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); } } } }
public void Handle(IncomingMessage msg) { if (!msg.IsDestChannel() || !msg.HasMessage()) { return; } if (SED_REGEX.IsMatch(msg.Message)) { string lastmessage = Database.GetKeyValue(msg.Server, LASTMESSAGE_PREFIX + msg.Sender); if (lastmessage == null || lastmessage.Equals("")) { // oh no return; } string reply; Match m = SED_REGEX.Match(msg.Message); if (m.Groups[3] == null || m.Groups[3].Value.Equals("")) { reply = ReplaceFirst(lastmessage, m.Groups[1].Value, m.Groups[2].Value); } else if (m.Groups[3] != null && m.Groups[3].Value.Equals("g")) { reply = lastmessage.Replace(m.Groups[1].Value, m.Groups[2].Value); } else { msg.SendChat(msg.Sender + ": You did something wrong..."); return; } msg.SendChat(msg.Sender + " meant: " + reply); } else { Database.SetKeyValue(msg.Server, LASTMESSAGE_PREFIX + msg.Sender, msg.Message); } }
public void Handle(IncomingMessage msg) { if (!msg.IsDestChannel() || !msg.HasMessage()) { return; } if (SED_REGEX.IsMatch(msg.Message)) { string lastmessage = Database.GetKeyValue(msg.Server, LASTMESSAGE_PREFIX + msg.Sender); if (lastmessage == null || lastmessage.Equals("")) { // oh no return; } string reply; Match m = SED_REGEX.Match(msg.Message); if (m.Groups[3] == null || m.Groups[3].Value.Equals("")) { reply = ReplaceFirst(lastmessage, m.Groups[1].Value, m.Groups[2].Value); } else if (m.Groups[3] != null && m.Groups[3].Value.Equals("g")) { reply = lastmessage.Replace(m.Groups[1].Value, m.Groups[2].Value); } else { msg.SendChat(msg.Sender + ": You did something wrong..."); return; } msg.SendChat(msg.Sender + " meant: " + reply); } else { Database.SetKeyValue(msg.Server, LASTMESSAGE_PREFIX + msg.Sender, msg.Message); } }