From ca58e9ac26e97154ff628709e2e9739d326462e1 Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Fri, 12 Aug 2022 22:38:24 -0400 Subject: [PATCH] Create initial update_username command. --- cogs/commands/data_management.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/cogs/commands/data_management.py b/cogs/commands/data_management.py index dd42021..9d28f37 100644 --- a/cogs/commands/data_management.py +++ b/cogs/commands/data_management.py @@ -43,3 +43,33 @@ class DataManagement(commands.Cog, name="Table Management"): await interaction.response.send_message( "You shouldn't be using this message.", ephemeral=True ) + + @nextcord.slash_command(description="Request a username update. Admins must approve.") + async def update_username( + self, + interaction: nextcord.Interaction, + old_username: str = nextcord.SlashOption( + description="Username currently stored in highscores.", required=True + ), + new_username: str = nextcord.SlashOption( + description="Username to update to.", required=True + ), + ): + """ + _summary_ + + Args: + interaction (nextcord.Interaction): Interaction that invoked the command + old_username (str): Username to replace. + new_username (str): Username to replace old with. + """ + guild = highscores_data.get_guild(interaction.guild_id) + verify_channel = interaction.guild.get_channel(guild.verification_channel) + + embed: nextcord.Embed = nextcord.Embed(title="Username change request.") + embed.add_field(name="Old username", value=old_username) + embed.add_field(name="New username", value=new_username) + await verify_channel.send( + content=f"Username change request from <@{interaction.user.id}>", embed=embed + ) + await interaction.send("Request sent to admins for verification.", ephemeral=True)