diff options
author | 2019-03-05 17:51:55 +0100 | |
---|---|---|
committer | 2019-03-05 17:51:55 +0100 | |
commit | 6bd2060c86ccf84f7ddb59c891c0669f784e18fd (patch) | |
tree | 4169497f62491f2ce6372ce737c04004af7157ea /bot/seasons/christmas/adventofcode.py | |
parent | Merge pull request #112 from RohanJnr/be-my-valentine-iceman (diff) | |
parent | Review-directed reformatting (diff) |
Merge pull request #91 from python-discord/join-code-dm
AoC Join Code Refactor
Diffstat (limited to 'bot/seasons/christmas/adventofcode.py')
-rw-r--r-- | bot/seasons/christmas/adventofcode.py | 11 |
1 files changed, 9 insertions, 2 deletions
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", |