aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/constants.py2
-rw-r--r--bot/resources/advent_of_code/about.json2
-rw-r--r--bot/seasons/christmas/adventofcode.py11
3 files changed, 11 insertions, 4 deletions
diff --git a/bot/constants.py b/bot/constants.py
index cb191da9..0ffc9081 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -15,7 +15,7 @@ log = logging.getLogger(__name__)
class AdventOfCode:
leaderboard_cache_age_threshold_seconds = 3600
leaderboard_id = 363275
- leaderboard_join_code = "363275-442b6939"
+ leaderboard_join_code = str(environ.get("AOC_JOIN_CODE", None))
leaderboard_max_displayed_members = 10
year = 2018
channel_id = int(environ.get("AOC_CHANNEL_ID", 517745814039166986))
diff --git a/bot/resources/advent_of_code/about.json b/bot/resources/advent_of_code/about.json
index 3fe6fcc9..4abf9145 100644
--- a/bot/resources/advent_of_code/about.json
+++ b/bot/resources/advent_of_code/about.json
@@ -21,7 +21,7 @@
},
{
"name": "Join our private leaderboard!",
- "value": "In addition to the global leaderboard, AoC also offers private leaderboards, where you can compete against a smaller group of friends!\n\nHead over to AoC's [private leaderboard page](https://adventofcode.com/leaderboard/private) and enter code `363275-442b6939` to join the PyDis private leaderboard!",
+ "value": "In addition to the global leaderboard, AoC also offers private leaderboards, where you can compete against a smaller group of friends!\n\nGet the join code using `.aoc join` and head over to AoC's [private leaderboard page](https://adventofcode.com/leaderboard/private) to join the PyDis private leaderboard!",
"inline": false
}
] \ No newline at end of file
diff --git a/bot/seasons/christmas/adventofcode.py b/bot/seasons/christmas/adventofcode.py
index 3b199a4a..a926a6cb 100644
--- a/bot/seasons/christmas/adventofcode.py
+++ b/bot/seasons/christmas/adventofcode.py
@@ -205,14 +205,21 @@ class AdventOfCode:
@adventofcode_group.command(name="join", aliases=("j",), brief="Learn how to join PyDis' private AoC leaderboard")
async def join_leaderboard(self, ctx: commands.Context):
"""
- Retrieve the link to join the PyDis AoC private leaderboard
+ DM the user the information for joining the PyDis AoC private leaderboard
"""
+ author = ctx.message.author
+ log.info(f"{author.name} ({author.id}) has requested the PyDis AoC leaderboard code")
+
info_str = (
"Head over to https://adventofcode.com/leaderboard/private "
f"with code `{AocConfig.leaderboard_join_code}` to join the PyDis private leaderboard!"
)
- await ctx.send(info_str)
+ try:
+ await author.send(info_str)
+ except discord.errors.Forbidden:
+ log.debug(f"{author.name} ({author.id}) has disabled DMs from server members")
+ await ctx.send(f":x: {author.mention}, please (temporarily) enable DMs to receive the join code")
@adventofcode_group.command(
name="leaderboard",