mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Fixed karma response in the case of absolutely no karma.
This commit is contained in:
parent
afa0cb8f41
commit
4d8e8807b9
@ -131,9 +131,12 @@ class Karma(callbacks.PrivmsgCommandAndRegexp, plugins.ChannelDBHandler):
|
||||
ORDER BY added-subtracted ASC
|
||||
LIMIT 3""")
|
||||
lowest = ['%r (%s)' % (t[0], t[1]) for t in cursor.fetchall()]
|
||||
s = 'Highest karma: %s. Lowest karma: %s.' % \
|
||||
(utils.commaAndify(highest), utils.commaAndify(lowest))
|
||||
irc.reply(msg, s)
|
||||
if not (highest and lowest):
|
||||
irc.error(msg, 'I have no karma for this channel.')
|
||||
else:
|
||||
s = 'Highest karma: %s. Lowest karma: %s.' % \
|
||||
(utils.commaAndify(highest), utils.commaAndify(lowest))
|
||||
irc.reply(msg, s)
|
||||
|
||||
def increaseKarma(self, irc, msg, match):
|
||||
r"^(\S+)\+\+$"
|
||||
|
@ -42,6 +42,7 @@ if sqlite is not None:
|
||||
class KarmaTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
plugins = ('Karma',)
|
||||
def testKarma(self):
|
||||
self.assertError('karma')
|
||||
self.assertRegexp('karma foobar', 'no karma')
|
||||
try:
|
||||
conf.replyWhenNotCommand = True
|
||||
@ -67,6 +68,5 @@ if sqlite is not None:
|
||||
'.*total.*1')
|
||||
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user