diff --git a/plugins/Karma/plugin.py b/plugins/Karma/plugin.py index bd896bf30..783575b58 100644 --- a/plugins/Karma/plugin.py +++ b/plugins/Karma/plugin.py @@ -272,7 +272,7 @@ def _doKarma(self, irc, msg, channel, thing): karma = '' for s in inc: if thing.endswith(s): - thing = thing[:-len(s)] + thing = thing[:-len(s)].rstrip(",: ") # Don't reply if the target isn't a nick if onlynicks and thing.lower() not in map(ircutils.toLower, irc.state.channels[channel].users): @@ -286,7 +286,7 @@ def _doKarma(self, irc, msg, channel, thing): karma = self.db.get(channel, self._normalizeThing(thing)) for s in dec: if thing.endswith(s): - thing = thing[:-len(s)] + thing = thing[:-len(s)].rstrip(",: ") if onlynicks and thing.lower() not in map(ircutils.toLower, irc.state.channels[channel].users): return diff --git a/plugins/Karma/test.py b/plugins/Karma/test.py index 97c178919..f31f168e6 100644 --- a/plugins/Karma/test.py +++ b/plugins/Karma/test.py @@ -60,6 +60,10 @@ def testKarma(self): 'Karma for [\'"]moo[\'"].*increased 1.*total.*1') self.assertRegexp('karma MoO', '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): try: