From: ethan jones Date: Fri, 26 Sep 2014 18:13:38 +0000 (-0400) Subject: allows .rank to take an argument, i think X-Git-Url: https://jfr.im/git/irc/rizon/acid.git/commitdiff_plain/b170d604a459133288512b1336ea9824d3631281?hp=a7bf3c924d7b35d8a5c9182c33cd4cf99f4da273 allows .rank to take an argument, i think --- diff --git a/pyva/pyva/src/main/python/trivia/trivia.py b/pyva/pyva/src/main/python/trivia/trivia.py index f59f6ee..a749eca 100644 --- a/pyva/pyva/src/main/python/trivia/trivia.py +++ b/pyva/pyva/src/main/python/trivia/trivia.py @@ -266,11 +266,15 @@ class trivia( 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])