]> jfr.im git - irc/rizon/acid.git/commitdiff
allows .rank to take an argument, i think
authorethan jones <redacted>
Fri, 26 Sep 2014 18:13:38 +0000 (14:13 -0400)
committerethan jones <redacted>
Fri, 26 Sep 2014 18:13:38 +0000 (14:13 -0400)
pyva/pyva/src/main/python/trivia/trivia.py

index f59f6ee928fc5e599632f71c25a7bedd5b632456..a749ecafae61efc6032e1c6c1cf496dfd2626751 100644 (file)
@@ -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])