self.notice(sender, '; '.join(out))
elif command == 'rank':
self.dbp.execute("SELECT nick, points FROM trivia_scores WHERE channel = %s ORDER BY points DESC", (self.get_cid(channel),))
+ if arg != '':
+ querynick = arg.lower()
+ else:
+ querynick = sender.lower()
rows = self.dbp.fetchall()
out = ""
# XXX: This is inefficient
for i, row in enumerate(rows):
- if row[0].lower() == sender.lower():
+ if row[0].lower() == querynick:
out = "You are currently ranked #%d with %d points" % (i+1, row[1])
if i > 0:
out += ", %d points behind %s" % (rows[i-1][1] - row[1], rows[i-1][0])