mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 14:40:51 +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
|
ORDER BY added-subtracted ASC
|
||||||
LIMIT 3""")
|
LIMIT 3""")
|
||||||
lowest = ['%r (%s)' % (t[0], t[1]) for t in cursor.fetchall()]
|
lowest = ['%r (%s)' % (t[0], t[1]) for t in cursor.fetchall()]
|
||||||
s = 'Highest karma: %s. Lowest karma: %s.' % \
|
if not (highest and lowest):
|
||||||
(utils.commaAndify(highest), utils.commaAndify(lowest))
|
irc.error(msg, 'I have no karma for this channel.')
|
||||||
irc.reply(msg, s)
|
else:
|
||||||
|
s = 'Highest karma: %s. Lowest karma: %s.' % \
|
||||||
|
(utils.commaAndify(highest), utils.commaAndify(lowest))
|
||||||
|
irc.reply(msg, s)
|
||||||
|
|
||||||
def increaseKarma(self, irc, msg, match):
|
def increaseKarma(self, irc, msg, match):
|
||||||
r"^(\S+)\+\+$"
|
r"^(\S+)\+\+$"
|
||||||
|
@ -42,6 +42,7 @@ if sqlite is not None:
|
|||||||
class KarmaTestCase(ChannelPluginTestCase, PluginDocumentation):
|
class KarmaTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||||
plugins = ('Karma',)
|
plugins = ('Karma',)
|
||||||
def testKarma(self):
|
def testKarma(self):
|
||||||
|
self.assertError('karma')
|
||||||
self.assertRegexp('karma foobar', 'no karma')
|
self.assertRegexp('karma foobar', 'no karma')
|
||||||
try:
|
try:
|
||||||
conf.replyWhenNotCommand = True
|
conf.replyWhenNotCommand = True
|
||||||
@ -67,6 +68,5 @@ if sqlite is not None:
|
|||||||
'.*total.*1')
|
'.*total.*1')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user