]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/karma.rb
lart plugin: replace "me" with sourcenick
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / karma.rb
index eecfbe26644629a88a5e417a76f4fabe1a68fdd9..2bd5f9f71584cf1026cacab01b330ff0e55e3493 100644 (file)
@@ -60,7 +60,7 @@ class KarmaPlugin < Plugin
   end
 
   def listen(m)
-    return unless m.kind_of?(PrivMessage) && m.public?
+    return unless m.kind_of?(PrivMessage) && m.public? && m.message.match(/\+\+|--/)
     arg = nil
     op = nil
     ac = Hash.new
@@ -71,7 +71,7 @@ class KarmaPlugin < Plugin
           if (tok =~ /^(?:--)(.*[^-].*)$/) || (tok =~ /^(.*[^-].*)(?:--)$/)
             op, arg = '--', $1
             next
-          elsif (tok =~ /^(?:\+\+)(.*[^+].*)$/) || (tok =~ /^(.*[^+].*)(?:\+\+)$/)
+          elsif (tok =~ /^(?:\+\+)(.*[^+].*)$/)||(tok =~ /^(.*[^+].*)(?:\+\+)$/)
             op, arg = '++', $1
             next
           end
@@ -94,7 +94,7 @@ class KarmaPlugin < Plugin
     ac.each do |k, v|
       next if v == 0
       @registry[k] += (v > 0 ? 1 : -1)
-      m.reply @bot.lang.get("thanks") if k == @bot.nick
+      m.reply @bot.lang.get("thanks") if k == @bot.nick && v > 0
     end
   end
 end