]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/markov.rb
dice: restore + killed by ec5745fa7abd47b8ca12bd783b0759079dff9917
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / markov.rb
index 676f4966e9297b914ff5baede1a4c3b30f8554a8..c2ef3a961c86040ff996e7a11b681c8182a8250a 100755 (executable)
@@ -388,7 +388,7 @@ class MarkovPlugin < Plugin
     action = params[:action]
     user = params[:option]
     case action
-    when 'remove':
+    when 'remove'
       if @bot.config['markov.ignore'].include? user
         s = @bot.config['markov.ignore']
         s.delete user
@@ -397,7 +397,7 @@ class MarkovPlugin < Plugin
       else
         m.reply _("not found in list")
       end
-    when 'add':
+    when 'add'
       if user
         if @bot.config['markov.ignore'].include?(user)
           m.reply _("%{u} already in list") % { :u => user }
@@ -408,7 +408,7 @@ class MarkovPlugin < Plugin
       else
         m.reply _("give the name of a person or channel to ignore")
       end
-    when 'list':
+    when 'list'
       m.reply _("I'm ignoring %{ignored}") % { :ignored => @bot.config['markov.ignore'].join(", ") }
     else
       m.reply _("have markov ignore the input from a hostmask or a channel. usage: markov ignore add <mask or channel>; markov ignore remove <mask or channel>; markov ignore list")
@@ -448,7 +448,7 @@ class MarkovPlugin < Plugin
   def random_markov(m, message)
     return unless should_talk
 
-    word1, word2 = message.split(/\s+/)
+    word1, word2 = clean_str(message).split(/\s+/)
     return unless word1 and word2
     line = generate_string(word1.intern, word2.intern)
     return unless line
@@ -494,7 +494,7 @@ class MarkovPlugin < Plugin
     return if ignore? m
 
     # in channel message, the kind we are interested in
-    message = clean_str m.plainmessage
+    message = m.plainmessage
 
     if m.action?
       message = "#{m.sourcenick} #{message}"
@@ -522,7 +522,7 @@ class MarkovPlugin < Plugin
 
   def learn_line(message)
     # debug "learning #{message.inspect}"
-    wordlist = message.split(/\s+/).map { |w| w.intern }
+    wordlist = clean_str(message).split(/\s+/).map { |w| w.intern }
     return unless wordlist.length >= 2
     word1, word2 = MARKER, MARKER
     wordlist << MARKER