X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fkarma.rb;h=f4716e2bd24c75269e718fc80ec6cabaf8048483;hb=ad78fb47422664c9ce24a3b62194e42974274af7;hp=148427a53cd15f36872f8c5abd2ba2ec7fc08bb4;hpb=21949774b91eaec6ecde4eaa8ad121e2c0a36b87;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/karma.rb b/data/rbot/plugins/karma.rb index 148427a5..f4716e2b 100644 --- a/data/rbot/plugins/karma.rb +++ b/data/rbot/plugins/karma.rb @@ -15,7 +15,7 @@ class KarmaPlugin < Plugin # import if old file format found if(File.exist?("#{@bot.botclass}/karma.rbot")) - puts "importing old karma data" + log "importing old karma data" IO.foreach("#{@bot.botclass}/karma.rbot") do |line| if(line =~ /^(\S+)<=>([\d-]+)$/) item = $1 @@ -52,7 +52,7 @@ class KarmaPlugin < Plugin def help(plugin, topic="") - "karma module: ++/-- => increase/decrease karma for , karma for ? => show karma for , karmastats => show stats. Karma is a community rating system - only in-channel messages can affect karma and you cannot adjust your own." + "karma module: Listens to everyone's chat. ++/-- => increase/decrease karma for , karma for ? => show karma for , karmastats => show stats. Karma is a community rating system - only in-channel messages can affect karma and you cannot adjust your own." end def listen(m) return unless m.kind_of?(PrivMessage) && m.public? @@ -69,9 +69,12 @@ class KarmaPlugin < Plugin key.sub!(/^\((.*)\)$/, "\1") key.gsub!(/\s+/, " ") next unless(key.length > 0) - next if(key == m.sourcenick) + next if(key.downcase == m.sourcenick.downcase) if(change == "++") @registry[key] += 1 + if key =~ /^#{@bot.nick}$/i + @bot.say m.replyto, @bot.lang.get("thanks") + end elsif(change == "--") @registry[key] -= 1 end