@@ -80,8 +80,8 @@ def get_players(year: int = CURRENT_YEAR):
80
80
return players_cache [year ][1 ]
81
81
82
82
83
- async def output_leaderboard (context , leaderboard_lst , year = None ):
84
- output_str = f'Leaderboard for { year } : \n '
83
+ async def output_leaderboard (context , leaderboard_lst , title = None ):
84
+ output_str = "" if title is None else title
85
85
86
86
for i , player in enumerate (leaderboard_lst ):
87
87
if len (output_str ) + len (player ) > MAX_MESSAGE_LEN :
@@ -138,7 +138,7 @@ async def leaderboard(context, num_players: int = 20, year: int = CURRENT_YEAR):
138
138
await context .send (f'```No one has completed any stars yet for { year } ```' )
139
139
return
140
140
141
- await output_leaderboard (context , ranking , year )
141
+ await output_leaderboard (context , ranking , f'Leaderboard for { year } : \n ' )
142
142
143
143
144
144
@bot .command (name = 'rank' , help = 'Responds with the current ranking of the supplied player' )
@@ -183,7 +183,7 @@ async def keen(context):
183
183
# Find the first person who got the max stars
184
184
i , player = min (players , key = lambda t : t [1 ][3 ])
185
185
186
- result = 'Today\' s keenest bean is:\n ``` '
186
+ result = '``` Today\' s keenest bean is:\n '
187
187
result += PLAYER_STR_FORMAT .format (rank = i + 1 ,
188
188
name = player [0 ], name_pad = len (player [0 ]),
189
189
points = player [1 ], points_pad = len (str (player [1 ])),
@@ -259,7 +259,7 @@ async def daily(context, day: str = None, year: int = CURRENT_YEAR):
259
259
stars = player [3 ], stars_pad = max_stars_len ,
260
260
star_time = time .strftime ('%H:%M %d/%m' , time .localtime (player [2 ]))))
261
261
262
- await output_leaderboard (context , ranking )
262
+ await output_leaderboard (context , ranking , f'Leaderboard for { year } , day { day } : \n ' )
263
263
264
264
265
265
bot .run (TOKEN )
0 commit comments