summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/markov.rb
diff options
context:
space:
mode:
authorVoker57 <voker57@gmail.com>2009-12-12 21:46:42 +0300
committerVoker57 <voker57@gmail.com>2010-01-26 00:41:04 +0300
commitca71ea8695b6810ececa7cd9caeec09aae57d751 (patch)
tree66099e62da6215ea2f17ad8de2d1bf13befeebf7 /data/rbot/plugins/markov.rb
parent7552cb5123ca149d7ba61dd764945250f8259d0f (diff)
markov: separate probability for answering when adressed
Diffstat (limited to 'data/rbot/plugins/markov.rb')
-rwxr-xr-xdata/rbot/plugins/markov.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb
index d3887469..1ffda9fa 100755
--- a/data/rbot/plugins/markov.rb
+++ b/data/rbot/plugins/markov.rb
@@ -35,6 +35,10 @@ class MarkovPlugin < Plugin
:default => true,
:validate => Proc.new { |v| v >= 0 },
:desc => "Wait short time before contributing to conversation.")
+ Config.register Config::IntegerValue.new('markov.answer_addressed',
+ :default => 50,
+ :validate => Proc.new { |v| (0..100).include? v },
+ :desc => "Probability of answer when addressed by nick")
MARKER = :"\r\n"
@@ -396,7 +400,8 @@ class MarkovPlugin < Plugin
def ignore?(m=nil)
return false unless m
- return true if m.address? or m.private?
+ return true if m.private?
+ return true if m.prefixed?
@bot.config['markov.ignore'].each do |mask|
return true if m.channel.downcase == mask.downcase
return true if m.source.matches?(mask)
@@ -525,7 +530,7 @@ class MarkovPlugin < Plugin
end
def random_markov(m, message)
- return unless should_talk
+ return unless (should_talk or (m.address? and @bot.config['markov.answer_addressed'] > rand(100)))
word1, word2 = clean_str(message).split(/\s+/)
return unless word1 and word2