mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-10 12:59:22 +01:00
Karma: refactor _doKarma handling
This commit is contained in:
parent
40310c4d5a
commit
4729213898
@ -246,7 +246,7 @@ class Karma(callbacks.Plugin):
|
|||||||
def _doKarma(self, irc, msg, channel, thing):
|
def _doKarma(self, irc, msg, channel, thing):
|
||||||
inc = self.registryValue('incrementChars', channel)
|
inc = self.registryValue('incrementChars', channel)
|
||||||
dec = self.registryValue('decrementChars', channel)
|
dec = self.registryValue('decrementChars', channel)
|
||||||
if thing.endswith(tuple(inc + dec)):
|
karma = ''
|
||||||
for s in inc:
|
for s in inc:
|
||||||
if thing.endswith(s):
|
if thing.endswith(s):
|
||||||
thing = thing[:-len(s)]
|
thing = thing[:-len(s)]
|
||||||
@ -272,6 +272,7 @@ class Karma(callbacks.Plugin):
|
|||||||
return
|
return
|
||||||
self.db.decrement(channel, self._normalizeThing(thing))
|
self.db.decrement(channel, self._normalizeThing(thing))
|
||||||
karma = self.db.get(channel, self._normalizeThing(thing))
|
karma = self.db.get(channel, self._normalizeThing(thing))
|
||||||
|
if karma:
|
||||||
self._respond(irc, channel, thing, karma[0]-karma[1])
|
self._respond(irc, channel, thing, karma[0]-karma[1])
|
||||||
|
|
||||||
def invalidCommand(self, irc, msg, tokens):
|
def invalidCommand(self, irc, msg, tokens):
|
||||||
|
Loading…
Reference in New Issue
Block a user