diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-01-25 23:11:43 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-01-25 23:11:43 +0100 |
commit | 8302e6c468c5688dfd382b9264a8e8780f4edba6 (patch) | |
tree | 17d12d69bd42bc8879ef4da870c208c98796fddc /data | |
parent | db379fd8e1b9b9f4829217b2d5262e7629360413 (diff) |
markov: unify should_talk
Unify probability check for addressed and non-addressed case by
passing the message as a parameter to should_talk and picking the
probability accordingly.
Diffstat (limited to 'data')
-rwxr-xr-x | data/rbot/plugins/markov.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index 28211203..ce5a35a2 100755 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -490,9 +490,9 @@ class MarkovPlugin < Plugin m.okay end - def should_talk + def should_talk(m) return false unless @bot.config['markov.enabled'] - prob = probability? + prob = m.address? ? @bot.config['markov.answer_addressed'] : probability? return true if prob > rand(100) return false end @@ -531,7 +531,7 @@ class MarkovPlugin < Plugin end def random_markov(m, message) - return unless (should_talk or (m.address? and @bot.config['markov.answer_addressed'] > rand(100))) + return unless should_talk(m) words = clean_str(message).split(/\s+/) if words.length < 2 |