diff options
Diffstat (limited to 'bot/seasons/christmas/adventofcode.py')
-rw-r--r-- | bot/seasons/christmas/adventofcode.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bot/seasons/christmas/adventofcode.py b/bot/seasons/christmas/adventofcode.py index ba1e3242..59467f20 100644 --- a/bot/seasons/christmas/adventofcode.py +++ b/bot/seasons/christmas/adventofcode.py @@ -428,7 +428,7 @@ class AocGlobalLeaderboard: aoc_url = f"https://adventofcode.com/{AocConfig.year}/leaderboard" - async with aiohttp.ClientSession(cookies=AOC_SESSION_COOKIE, headers=AOC_REQUEST_HEADER) as session: + async with aiohttp.ClientSession(headers=AOC_REQUEST_HEADER) as session: async with session.get(aoc_url) as resp: if resp.status == 200: raw_html = await resp.text() @@ -439,7 +439,7 @@ class AocGlobalLeaderboard: soup = BeautifulSoup(raw_html, "html.parser") ele = soup.find_all("div", class_="leaderboard-entry") - exp = r"(?:[ ]{,2}(\d+)\))?[ ]+(\d+)\s+([\w\(\)#\d ]+)" + exp = r"(?:[ ]{,2}(\d+)\))?[ ]+(\d+)\s+([\w\(\)#\-\d ]+)" lb_list = [] for entry in ele: @@ -475,7 +475,12 @@ class AocGlobalLeaderboard: header = f"{' '*4}{'Score'} {'Name':^25}\n{'-'*36}" table = "" for member in members_to_print: - table += f"{member[0]:3}) {member[1]:4} {member[2]:25.25}\n" + # In the event of a tie, rank is None + if member[0]: + rank = f"{member[0]:3})" + else: + rank = f"{' ':4}" + table += f"{rank} {member[1]:4} {member[2]:25.25}\n" else: table = f"```{header}\n{table}```" |