]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
salut plugin: don't respond to salutations when changing the configuration
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 6 Feb 2007 09:57:44 +0000 (09:57 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 6 Feb 2007 09:57:44 +0000 (09:57 +0000)
data/rbot/plugins/salut.rb

index a5f946755f568c520c761ea2fdb38ef7be75c182..02ffca3f8b2e25833b89193cfbfc57aa7b569908 100644 (file)
@@ -3,6 +3,8 @@
 # TODO allow online editing of salutations\r
 # TODO *REMEMBER* to set @changed to true after edit\r
 # TODO or changes won't be saved\r
+#\r
+# TODO reply in the language the salutation was in\r
 \r
 unless Array.respond_to?(:pick_one)\r
   debug "Defining the pick_one method for Array"\r
@@ -82,6 +84,7 @@ class SalutPlugin < Plugin
   def listen(m)\r
     return unless @match\r
     return unless m.kind_of?(PrivMessage)\r
+    return if m.address? and m.plugin == 'config'\r
     to_me = m.address? || m.message =~ /#{Regexp.escape(@bot.nick)}/i\r
     if @bot.config['salut.address_only']\r
       return unless to_me\r
@@ -89,14 +92,14 @@ class SalutPlugin < Plugin
     salut = nil\r
     [:both, :in, :out].each { |k|\r
       next unless @match[k]\r
-      debug "Checking salutations #{k} (#{@match[k].inspect})"\r
+      debug "Checking salutations #{k} (#{@match[k].inspect})"\r
       if m.message =~ @match[k]\r
         salut = k\r
         break\r
       end\r
     }\r
     return unless salut\r
-    # If the bot wasn't addressed, we continue only the match was exact\r
+    # If the bot wasn't addressed, we continue only if the match was exact\r
     # (apart from space and punctuation) or if @match[:dest] matches too\r
     return unless to_me or m.message =~ @match[:dest] or m.message =~ /^#{@punct}#{@match[salut]}#{@punct}$/\r
     h = Time.new.hour\r