diff options
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/markov.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index dd66ae1d..62559658 100644 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -44,7 +44,7 @@ class MarkovPlugin < Plugin @learning_queue = Queue.new @learning_thread = Thread.new do while s = @learning_queue.pop - learn s + learn_line s sleep 0.5 end end @@ -222,6 +222,10 @@ class MarkovPlugin < Plugin end end + def learn(*lines) + lines.each { |l| @learning_queue.push l } + end + def message(m) return if ignore? m @@ -232,11 +236,11 @@ class MarkovPlugin < Plugin message = "#{m.sourcenick} #{message}" end - @learning_queue.push message + learn message random_markov(m, message) unless m.replied? end - def learn(message) + def learn_line(message) # debug "learning #{message}" wordlist = message.split(/\s+/) return unless wordlist.length >= 2 |