]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
reaction plugin: make triggers case insensitive
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 21 Sep 2007 13:32:53 +0000 (13:32 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 21 Sep 2007 13:32:53 +0000 (13:32 +0000)
data/rbot/plugins/reaction.rb

index 0ec75d5866847da663059f684817e8390a1b9976..ad8f2431a571994a4dd8b004280a11daf10cec14 100644 (file)
@@ -66,9 +66,9 @@ class ::Reaction
     end
     @trigger = [act]
     if rex.sub!(%r@^([/!])(.*)\1$@, '\2')
-      @trigger << Regexp.new(rex)
+      @trigger << Regexp.new(rex, true)
     else
-      @trigger << Regexp.new(/\b#{Regexp.escape(rex)}\b/u)
+      @trigger << Regexp.new(/\b#{Regexp.escape(rex)}\b/ui)
     end
   end
 
@@ -241,7 +241,7 @@ class ReactionPlugin < Plugin
 
   def find_reaction(trigger)
     @reactions.find { |react|
-      react.raw_trigger == trigger
+      react.raw_trigger.downcase == trigger.downcase
     }
   end