diff options
author | 2022-01-12 14:06:50 +0000 | |
---|---|---|
committer | 2022-01-12 14:23:01 +0000 | |
commit | 5ef4b73a9d6f3d15d6fb22874e7de3af7d2928e3 (patch) | |
tree | 20ddda576ccb67dfd7afd057aee9913a6c03d07a /bot | |
parent | Merge pull request #1008 from python-discord/fix-aoc-join-logic (diff) |
Fix AoC name lookup for anon users
When a user doesn't set a name, the AoC API doesn't return a name key at all, so we need to make use of the ID field instead, to build the name based on a similar tempalte that AoC uses for it's leaderboard.
Co-authored-by: ToxicKidz <[email protected]>
Diffstat (limited to 'bot')
-rw-r--r-- | bot/exts/events/advent_of_code/_cog.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bot/exts/events/advent_of_code/_cog.py b/bot/exts/events/advent_of_code/_cog.py index 01161f26..3acfef39 100644 --- a/bot/exts/events/advent_of_code/_cog.py +++ b/bot/exts/events/advent_of_code/_cog.py @@ -96,7 +96,9 @@ class AdventOfCode(commands.Cog): # Only give the role to people who have completed all 50 stars continue - member_id = aoc_name_to_member_id.get(member_aoc_info["name"], None) + aoc_name = member_aoc_info["name"] or f"Anonymous #{member_aoc_info['id']}" + + member_id = aoc_name_to_member_id.get(aoc_name) if not member_id: log.debug(f"Could not find member_id for {member_aoc_info['name']}, not giving role.") continue |