X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fmarkov.rb;h=17446f6d7be4310e97c3d45cf91d716d1a6145fe;hb=6fb82f2c8ae244cb098f2eae78a7d3143f3e2069;hp=9e0bfccdb488431a018bb79818352abf91814d51;hpb=2962912178d5def0f3f4b4d8a42b726bb43e228d;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index 9e0bfccd..17446f6d 100644 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -36,8 +36,10 @@ class MarkovPlugin < Plugin @learning_thread = Thread.new do while s = @learning_queue.pop learn s + sleep 0.5 end end + @learning_thread.priority = -1 end def cleanup @@ -167,6 +169,7 @@ class MarkovPlugin < Plugin return unless should_talk word1, word2 = message.split(/\s+/) + return unless word1 and word2 line = generate_string(word1, word2) return unless line return if line == message @@ -209,7 +212,7 @@ class MarkovPlugin < Plugin return if ignore? m.source # in channel message, the kind we are interested in - message = clean_str m.message + message = clean_str m.plainmessage if m.action? message = "#{m.sourcenick} #{message}"