From 666d854019fe336f69cfaeb9b7e7599aa04a3151 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 28 Oct 2006 08:28:52 +0000 Subject: salut now only replies to salutations directed at him, unless salut.address_only is false --- data/rbot/plugins/salut.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'data/rbot') diff --git a/data/rbot/plugins/salut.rb b/data/rbot/plugins/salut.rb index 48276019..b8d9c4d7 100644 --- a/data/rbot/plugins/salut.rb +++ b/data/rbot/plugins/salut.rb @@ -18,6 +18,12 @@ class SalutPlugin < Plugin :desc => "Check for a salutation in all languages and not just in the one defined by core.language", :on_change => Proc.new {|bot, v| bot.plugins['salut'].reload} ) + BotConfig.register BotConfigBooleanValue.new('salut.address_only', + :default => true, + :desc => "When set to true, the bot will only reply to salutations directed at him", + :on_change => Proc.new {|bot, v| bot.plugins['salut'].reload} + ) + def initialize @salutations = Hash.new @@ -63,6 +69,9 @@ class SalutPlugin < Plugin end def listen(m) + if @bot.config['salut.address_only'] + return unless m.address? or m.message =~ /#{Regexp.escape(@bot.nick)}/ + end salut = nil [:both, :in, :out].each { |k| next unless @match[k] -- cgit v1.2.3