Karma: Display the new karma when it is updated.

This commit is contained in:
Valentin Lorentz 2013-03-25 18:07:21 +01:00
parent cb827c09df
commit 3137db859f
1 changed files with 7 additions and 4 deletions

View File

@ -232,9 +232,10 @@ class Karma(callbacks.Plugin):
thing = thing[1:-1]
return thing
def _respond(self, irc, channel):
def _respond(self, irc, channel, thing, karma):
if self.registryValue('response', channel):
irc.replySuccess()
irc.reply(_('%(thing)s\'s karma is now %(karma)i') %
{'thing': thing, 'karma': karma})
else:
irc.noReply()
@ -247,7 +248,8 @@ class Karma(callbacks.Plugin):
irc.error(_('You\'re not allowed to adjust your own karma.'))
elif thing:
self.db.increment(channel, self._normalizeThing(thing))
self._respond(irc, channel)
karma = self.db.get(channel, self._normalizeThing(thing))
self._respond(irc, channel, thing, karma[0]-karma[1])
else:
thing = thing[:-2]
if ircutils.strEqual(thing, irc.msg.nick) and \
@ -255,7 +257,8 @@ class Karma(callbacks.Plugin):
irc.error(_('You\'re not allowed to adjust your own karma.'))
elif thing:
self.db.decrement(channel, self._normalizeThing(thing))
self._respond(irc, channel)
karma = self.db.get(channel, self._normalizeThing(thing))
self._respond(irc, channel, thing, karma[0]-karma[1])
def invalidCommand(self, irc, msg, tokens):
channel = msg.args[0]