From cb9fda0ec1c29bf328f9b221afd9f032ecc2cbf5 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 6 Feb 2007 09:57:44 +0000 Subject: salut plugin: don't respond to salutations when changing the configuration --- data/rbot/plugins/salut.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/data/rbot/plugins/salut.rb b/data/rbot/plugins/salut.rb index a5f94675..02ffca3f 100644 --- a/data/rbot/plugins/salut.rb +++ b/data/rbot/plugins/salut.rb @@ -3,6 +3,8 @@ # TODO allow online editing of salutations # TODO *REMEMBER* to set @changed to true after edit # TODO or changes won't be saved +# +# TODO reply in the language the salutation was in unless Array.respond_to?(:pick_one) debug "Defining the pick_one method for Array" @@ -82,6 +84,7 @@ class SalutPlugin < Plugin def listen(m) return unless @match return unless m.kind_of?(PrivMessage) + return if m.address? and m.plugin == 'config' to_me = m.address? || m.message =~ /#{Regexp.escape(@bot.nick)}/i if @bot.config['salut.address_only'] return unless to_me @@ -89,14 +92,14 @@ class SalutPlugin < Plugin salut = nil [:both, :in, :out].each { |k| next unless @match[k] - debug "Checking salutations #{k} (#{@match[k].inspect})" + # debug "Checking salutations #{k} (#{@match[k].inspect})" if m.message =~ @match[k] salut = k break end } return unless salut - # If the bot wasn't addressed, we continue only the match was exact + # If the bot wasn't addressed, we continue only if the match was exact # (apart from space and punctuation) or if @match[:dest] matches too return unless to_me or m.message =~ @match[:dest] or m.message =~ /^#{@punct}#{@match[salut]}#{@punct}$/ h = Time.new.hour -- cgit v1.2.3