From: John Runyon Date: Thu, 18 Jan 2024 16:17:12 +0000 (-0700) Subject: trivia - add date to topstreaks X-Git-Url: https://jfr.im/git/erebus.git/commitdiff_plain/32106b67cfd425550bc0a937a805926157cdef48 trivia - add date to topstreaks --- diff --git a/modules/trivia.py b/modules/trivia.py index 555ad55..9541f00 100644 --- a/modules/trivia.py +++ b/modules/trivia.py @@ -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(" []", "set a user's max streak")