mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-25 12:31:04 -05:00
Karma: ignore trailing chars, spaces, tabs (#1579)
Signed-off-by: Pratyush Desai <pratyush.desai@liberta.casa>
This commit is contained in:
parent
7ccaeb088a
commit
01cdfee53e
@ -272,7 +272,7 @@ class Karma(callbacks.Plugin):
|
|||||||
karma = ''
|
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)].rstrip(",:\t ")
|
||||||
# Don't reply if the target isn't a nick
|
# Don't reply if the target isn't a nick
|
||||||
if onlynicks and thing.lower() not in map(ircutils.toLower,
|
if onlynicks and thing.lower() not in map(ircutils.toLower,
|
||||||
irc.state.channels[channel].users):
|
irc.state.channels[channel].users):
|
||||||
@ -286,7 +286,7 @@ class Karma(callbacks.Plugin):
|
|||||||
karma = self.db.get(channel, self._normalizeThing(thing))
|
karma = self.db.get(channel, self._normalizeThing(thing))
|
||||||
for s in dec:
|
for s in dec:
|
||||||
if thing.endswith(s):
|
if thing.endswith(s):
|
||||||
thing = thing[:-len(s)]
|
thing = thing[:-len(s)].rstrip(",:\t ")
|
||||||
if onlynicks and thing.lower() not in map(ircutils.toLower,
|
if onlynicks and thing.lower() not in map(ircutils.toLower,
|
||||||
irc.state.channels[channel].users):
|
irc.state.channels[channel].users):
|
||||||
return
|
return
|
||||||
|
@ -60,6 +60,10 @@ class KarmaTestCase(ChannelPluginTestCase):
|
|||||||
'Karma for [\'"]moo[\'"].*increased 1.*total.*1')
|
'Karma for [\'"]moo[\'"].*increased 1.*total.*1')
|
||||||
self.assertRegexp('karma MoO',
|
self.assertRegexp('karma MoO',
|
||||||
'Karma for [\'"]MoO[\'"].*increased 1.*total.*1')
|
'Karma for [\'"]MoO[\'"].*increased 1.*total.*1')
|
||||||
|
# Test trailing characters and spaces
|
||||||
|
self.assertNoResponse('baz, ++', 2)
|
||||||
|
self.assertRegexp('karma baz',
|
||||||
|
'Karma for [\'"]baz[\'"].*increased 1.*total.*1')
|
||||||
|
|
||||||
def testKarmaRankingDisplayConfigurable(self):
|
def testKarmaRankingDisplayConfigurable(self):
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user