Skip to content

Commit

Permalink
more concise logic for scorekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
zerokarmaleft committed Jan 20, 2012
1 parent 96fdd64 commit 8890d37
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions plugins/karma.rb
Expand Up @@ -3,11 +3,11 @@
class Karma
include Cinch::Plugin

match /[a-z_\-\[\]\\^{}|][a-z0-9_\-\[\]\\^{}|]*[+][+]/
match /(\S+)\+{2}/

def initialize(*args)
super
@users = {}
@users = Hash.new(0)
end

def execute(m)
Expand All @@ -17,12 +17,8 @@ def execute(m)
m.reply "Increasing my karma would result in overflow."
elsif nick == m.user.nick
m.reply "Just keep patting yourself on the back there, sport."
elsif @users.key? nick
@users[nick] += 1
m.reply "#{ nick } has #{ @users[nick] } awesome points."
else
@users[nick] = 1
m.reply "#{ nick } has #{ @users[nick] } awesome points."
m.reply "#{ nick } has #{ @users[nick] += 1 } awesome points."
end
end
end

0 comments on commit 8890d37

Please sign in to comment.