Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions bot/exts/advent_of_code/_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def __init__(self, bot: SirRobin):
self.bot = bot

self._base_url = f"https://adventofcode.com/{AocConfig.year}"
self.global_leaderboard_url = f"https://adventofcode.com/{AocConfig.year}/leaderboard"

self.about_aoc_filepath = Path("./bot/exts/advent_of_code/about.json")
self.cached_about_aoc = self._build_about_embed()
self.cached_no_global = self._build_no_global_leaderboard_embed()

self.scheduler = scheduling.Scheduler(self.__class__.__name__)

Expand Down Expand Up @@ -434,22 +434,15 @@ async def aoc_leaderboard(self, ctx: commands.Context, *, aoc_name: str | None =
await ctx.send(content=f"{header}\n\n{table}", embed=info_embed)
return

@in_month(Month.DECEMBER, Month.JANUARY, Month.FEBRUARY)
@adventofcode_group.command(
name="global",
aliases=("globalboard", "gb"),
brief="Get a link to the global leaderboard",
hidden=True, # Global leaderboard no longer exists
)
@in_whitelist(channels=AOC_WHITELIST_RESTRICTED, redirect=AOC_REDIRECT)
async def aoc_global_leaderboard(self, ctx: commands.Context) -> None:
"""Get a link to the global Advent of Code leaderboard."""
url = self.global_leaderboard_url
global_leaderboard = discord.Embed(
title="Advent of Code — Global Leaderboard",
description=f"You can find the global leaderboard [here]({url})."
)
global_leaderboard.set_thumbnail(url=_helpers.AOC_EMBED_THUMBNAIL)
await ctx.send(embed=global_leaderboard)
"""Send an embed notifying about the changes to the global leaderboard."""
await ctx.send(embed=self.cached_no_global)

@in_month(Month.DECEMBER, Month.JANUARY, Month.FEBRUARY)
@adventofcode_group.command(
Expand Down Expand Up @@ -511,11 +504,27 @@ def _build_about_embed(self) -> discord.Embed:
title=self._base_url,
colour=Colours.soft_green,
url=self._base_url,
timestamp=datetime.now(tz=UTC)
)
about_embed.set_author(name="Advent of Code", url=self._base_url)
for field in embed_fields:
about_embed.add_field(**field)

about_embed.set_footer(text="Last Updated")
return about_embed

@staticmethod
def _build_no_global_leaderboard_embed() -> discord.Embed:
"""Build and return an embed notifying about the changes to the global leaderboard."""
faq_link = "https://adventofcode.com/2025/about#faq_leaderboard"
description = (
f"To read about this change, head over to the [AoC FAQ]({faq_link}).\n\n"
"You can still access the global leaderboards of previous years by heading over to "
"https://adventofcode.com/events, choosing the desired year, and heading over to "
"the `[Leaderboards]` tab."
)

return discord.Embed(
title="The global leaderboard is no more",
description=description,
colour=Colours.soft_red,
)
2 changes: 1 addition & 1 deletion bot/exts/advent_of_code/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

AOC_EMBED_THUMBNAIL = (
"https://raw.githubusercontent.com/python-discord"
"/branding/main/seasonal/christmas/server_icons/festive_256.gif"
"/branding/main/events/christmas/server_icons/festive_256.gif"
)

# Create an easy constant for the EST timezone
Expand Down
6 changes: 3 additions & 3 deletions bot/exts/advent_of_code/about.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
},
{
"name": "How does scoring work?",
"value": "For the [global leaderboard](https://adventofcode.com/leaderboard), the first person to get a star first gets 100 points, the second person gets 99 points, and so on down to 1 point at 100th place.\n\nFor private leaderboards, the first person to get a star gets N points, where N is the number of people on the leaderboard. The second person to get the star gets N-1 points and so on and so forth.",
"value": "AoC has private leaderboards. In these, the first person to get a star gets N points, where N is the number of people on the leaderboard. The second person to get the star gets N-1 points and so on and so forth. As the size of a leaderboard is limited, and Python Discord has many people who want to participate, we merge several leaderboards into one.\n\nTherefore, while you may see your standing in a specific leaderboard on the website, to get your total Python Discord standings you need to run the `&aoc lb` command.",
"inline": false
},
{
"name": "Join our private leaderboard!",
"value": "Come join the Python Discord private leaderboard and compete against other people in the community! Get the join code using `.aoc join` and visit the [private leaderboard page](https://adventofcode.com/leaderboard/private) to join our leaderboard.",
"name": "Join our leaderboard!",
"value": "Come join the Python Discord leaderboard and compete against other people in the community! Get the join code using </aoc join:1312458389388787853> and visit the [leaderboard page](https://adventofcode.com/leaderboard/private) to join our leaderboard.",
"inline": false
}
]