]> jfr.im git - erebus.git/commitdiff
trivia - add date to topstreaks
authorJohn Runyon <redacted>
Thu, 18 Jan 2024 16:17:12 +0000 (09:17 -0700)
committerJohn Runyon <redacted>
Thu, 18 Jan 2024 16:17:12 +0000 (09:17 -0700)
modules/trivia.py

index 555ad553e5f44dfd66d064131082b23307341913..9541f00dd3f844c4eaf0d62d424b42ae7ba5ba98 100644 (file)
@@ -904,10 +904,11 @@ def streak(bot, user, chan, realtarget, *args):
 @lib.hook(needchan=False)
 @lib.help(None, "shows top streaks of all time")
 def topstreaks(bot, user, chan, realtarget, *args):
+       time_format = "%Y-%m-%d"
        db = state.db['streaks']
        streaks = [(nick, db[nick][0], db[nick][1]) for nick in db.keys()]
        streaks.sort(key=lambda v: v[1], reverse=True)
-       return "Top streaks of all time: %s (%d), %s (%d), %s (%d)." % (streaks[0][0], streaks[0][1], streaks[1][0], streaks[1][1], streaks[2][0], streaks[2][1])
+       return "Top streaks of all time: %s (%d %s), %s (%d %s), %s (%d %s)." % (streaks[0][0], streaks[0][1], time.strftime(time_format, time.gmtime(streaks[0][2])), streaks[1][0], streaks[1][1], time.strftime(time_format, time.gmtime(streaks[1][2])), streaks[2][0], streaks[2][1], time.strftime(time_format, time.gmtime(streaks[2][2])))
 
 @lib.hook(glevel=lib.MANAGER, needchan=False)
 @lib.help("<nick> <new streak> [<timestamp>]", "set a user's max streak")