From 5e169399485c246d208a560e470745db4cd1caf8 Mon Sep 17 00:00:00 2001 From: rina Date: Sun, 1 Dec 2024 14:54:05 +1000 Subject: [PATCH] slightly improve register messages still not ephemeral, because it's probably useful to see if people are having problems with the command. --- uqcsbot/advent.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/uqcsbot/advent.py b/uqcsbot/advent.py index 0814981..5efa603 100644 --- a/uqcsbot/advent.py +++ b/uqcsbot/advent.py @@ -669,7 +669,10 @@ async def register_command(self, interaction: discord.Interaction, aoc_name: str members = self._get_members(year) if aoc_name not in [member.name for member in members]: await interaction.edit_original_response( - content=f"Could not find the Advent of Code name `{aoc_name}` within the UQCS leaderboard." + content=( + f"Could not find the Advent of Code name `{aoc_name}` within the UQCS leaderboard. Make sure your name appears at: " + + LEADERBOARD_VIEW_URL.format(code=UQCS_LEADERBOARD, year=year) + ) ) return member = [member for member in members if member.name == aoc_name] @@ -687,13 +690,17 @@ async def register_command(self, interaction: discord.Interaction, aoc_name: str ) if query is not None: discord_user = self.bot.uqcs_server.get_member(query.discord_userid) + is_self = False if discord_user: discord_ping = discord_user.mention + is_self = discord_user.id == interaction.user.id else: discord_ping = f"someone who doesn't seem to be in the server (discord id = {query.discord_userid})" - await interaction.edit_original_response( - content=f"Advent of Code name `{aoc_name}` is already registered to {discord_ping}. Please contact committee if this is your Advent of Code name." - ) + if not is_self: + message = f"Advent of Code name `{aoc_name}` is already registered to {discord_ping}. Please contact committee if this is your Advent of Code name." + else: + message = f"Advent of Code name `{aoc_name}` is already registered to you ({discord_ping})! Please contact committee if this is incorrect." + await interaction.edit_original_response(content=message) return discord_id = interaction.user.id