mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-11 20:59:42 +01:00
Fixed multiple-karma responses in the face of no results.
This commit is contained in:
parent
8ebef1ec6e
commit
e189603220
@ -367,9 +367,13 @@ class ChannelDB(plugins.ChannelDBHandler, callbacks.PrivmsgCommandAndRegexp):
|
||||
FROM karma WHERE %s
|
||||
ORDER BY added-subtracted DESC""" % criteria
|
||||
cursor.execute(sql, *args)
|
||||
if cursor.rowcount > 0:
|
||||
s = utils.commaAndify(['%s: %s' % (n, t)
|
||||
for (n,t) in cursor.fetchall()])
|
||||
irc.reply(msg, s + '.')
|
||||
else:
|
||||
irc.reply(msg, 'I didn\'t know the karma for any '
|
||||
'of those things.')
|
||||
else: # No name was given. Return the top/bottom 3 karmas.
|
||||
cursor.execute("""SELECT name, added-subtracted
|
||||
FROM karma
|
||||
|
@ -80,6 +80,9 @@ if sqlite is not None:
|
||||
self.assertRegexp('karma foobar', 'increased 1.*total.*1')
|
||||
self.assertNoResponse('foobar--', 2)
|
||||
self.assertRegexp('karma foobar', 'decreased 1.*total.*0')
|
||||
self.assertNoResponse('foo++', 2)
|
||||
self.assertNoResponse('bar--', 2)
|
||||
self.assertRegexp('karma foo bar foobar', '.*foo.*foobar.*bar.*')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
Loading…
Reference in New Issue
Block a user