]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/lart.rb
nickserv plugin: regexp tweaks and case insensitivity
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / lart.rb
index a70c67b858542491ee89417cf524eed180588b85..0e995efb114ff2928f5dbc09cd3863b53656ceb2 100644 (file)
@@ -95,6 +95,9 @@ class LartPlugin < Plugin
     end
     who = params[:who].to_s
     reason = params[:why]
+    if who == "me"
+      who = m.sourcenick
+    end
     if who == @bot.nick
       who = m.sourcenick
       reason = "for trying to make me lart myself"
@@ -113,7 +116,8 @@ class LartPlugin < Plugin
     end
     who = params[:who].to_s
     reason = params[:why]
-    if who == m.sourcenick
+    if who == m.sourcenick || who == "me"
+      params[:who] = m.sourcenick
       params[:why] = "for praising himself"
       handle_lart(m, params)
       return
@@ -139,7 +143,7 @@ class LartPlugin < Plugin
   def handle_listlart(m, params)
     rx = Regexp.new(params[:lart].to_s, true)
     list = @larts.grep(rx)
-    if list
+    unless list.empty?
       m.reply list.join(" | "), :split_at => /\s+\|\s+/
     else
       m.reply "no lart found matching #{params[:lart]}"
@@ -161,7 +165,7 @@ class LartPlugin < Plugin
   def handle_listpraise(m, params)
     rx = Regexp.new(params[:praise].to_s, true)
     list = @praises.grep(rx)
-    if list
+    unless list.empty?
       m.reply list.join(" | "), :split_at => /\s+\|\s+/
     else
       m.reply "no praise found matching #{params[:praise]}"