Skip to content

Commit 0177384

Browse files
committed
Merge remote-tracking branch 'FrozenDude101/leaderboard-title'
2 parents 3851e15 + b5609c1 commit 0177384

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def get_players(year: int = CURRENT_YEAR):
8080
return players_cache[year][1]
8181

8282

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
8585

8686
for i, player in enumerate(leaderboard_lst):
8787
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):
138138
await context.send(f'```No one has completed any stars yet for {year}```')
139139
return
140140

141-
await output_leaderboard(context, ranking, year)
141+
await output_leaderboard(context, ranking, f'Leaderboard for {year}:\n')
142142

143143

144144
@bot.command(name='rank', help='Responds with the current ranking of the supplied player')
@@ -183,7 +183,7 @@ async def keen(context):
183183
# Find the first person who got the max stars
184184
i, player = min(players, key=lambda t: t[1][3])
185185

186-
result = 'Today\'s keenest bean is:\n```'
186+
result = '```Today\'s keenest bean is:\n'
187187
result += PLAYER_STR_FORMAT.format(rank=i+1,
188188
name=player[0], name_pad=len(player[0]),
189189
points=player[1], points_pad=len(str(player[1])),
@@ -259,7 +259,7 @@ async def daily(context, day: str = None, year: int = CURRENT_YEAR):
259259
stars=player[3], stars_pad=max_stars_len,
260260
star_time=time.strftime('%H:%M %d/%m', time.localtime(player[2]))))
261261

262-
await output_leaderboard(context, ranking)
262+
await output_leaderboard(context, ranking, f'Leaderboard for {year}, day {day}:\n')
263263

264264

265265
bot.run(TOKEN)

0 commit comments

Comments
 (0)