From ca71ea8695b6810ececa7cd9caeec09aae57d751 Mon Sep 17 00:00:00 2001 From: Voker57 Date: Sat, 12 Dec 2009 21:46:42 +0300 Subject: markov: separate probability for answering when adressed --- data/rbot/plugins/markov.rb | 9 +++++++-- 1 file 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 -- cgit v1.2.3