mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-11 20:59:42 +01:00
Added RFE #890130.
This commit is contained in:
parent
b51961b18a
commit
a32a263b90
@ -165,11 +165,23 @@ class Karma(callbacks.PrivmsgCommandAndRegexp, plugins.ChannelDBHandler):
|
||||
ORDER BY added-subtracted ASC
|
||||
LIMIT %s""", limit)
|
||||
lowest=['%r (%s)' % (t[0], int(t[1])) for t in cursor.fetchall()]
|
||||
cursor.execute("""SELECT added-subtracted FROM karma
|
||||
WHERE name=%s""", msg.nick)
|
||||
if not (highest and lowest):
|
||||
irc.error('I have no karma for this channel.')
|
||||
else:
|
||||
s = 'Highest karma: %s. Lowest karma: %s.' % \
|
||||
(utils.commaAndify(highest), utils.commaAndify(lowest))
|
||||
return
|
||||
rankS = ''
|
||||
if cursor.rowcount != 0:
|
||||
personal = int(cursor.fetchone()[0])
|
||||
cursor.execute("""SELECT COUNT(*) FROM karma
|
||||
WHERE added-subtracted > %s""", personal)
|
||||
rank = int(cursor.fetchone()[0]) + 1
|
||||
cursor.execute("""SELECT COUNT(*) FROM karma""")
|
||||
total = int(cursor.fetchone()[0])
|
||||
rankS = ' You (%s) are ranked %s out of %s.' % \
|
||||
(msg.nick, rank, total)
|
||||
s = 'Highest karma: %s. Lowest karma: %s.%s' % \
|
||||
(utils.commaAndify(highest), utils.commaAndify(lowest), rankS)
|
||||
irc.reply(s)
|
||||
|
||||
_mostAbbrev = utils.abbrev(['increased', 'decreased', 'active'])
|
||||
|
Loading…
Reference in New Issue
Block a user