Create initial update_username command.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user