diff --git a/cogs/commands/request.py b/cogs/commands/request.py index 94c2035..5083504 100644 --- a/cogs/commands/request.py +++ b/cogs/commands/request.py @@ -2,8 +2,6 @@ Contains commands and views for request commands. """ -from typing import Optional - import nextcord from nextcord.ext import commands @@ -44,7 +42,7 @@ class RequestCog(commands.Cog, name="Request Commands"): """ config: DakinyConfig = self.bot.config - content = f'<@{interaction.user.id}> would like to change their username to "{new_nickname}"' + content = f'<@{interaction.user.id}> would like to change their username to "{new_nickname}."' view = UsernameRequest(interaction.user.id, new_nickname) await self.bot.get_channel(config.params.admin_channel_id).send(content=content, view=view) await interaction.response.send_message("Request sent to admins.", ephemeral=True) @@ -55,22 +53,24 @@ class UsernameRequest(nextcord.ui.View): View provides approve and deny buttons and action for a username change request. """ - def __init__(self, id: int, new_nickname: str, *, timeout: float | None = 180, auto_defer: bool = True): + def __init__(self, user_id: int, new_nickname: str, *, timeout: float | None = 180, auto_defer: bool = True): super().__init__(timeout=timeout, auto_defer=auto_defer) - self.id = id + self.user_id = user_id self.new_nickname = new_nickname @nextcord.ui.button(label="Approve", style=nextcord.ButtonStyle.green) async def approve(self, button: nextcord.ui.Button, interaction: nextcord.Interaction): - user = interaction.guild.get_member(self.id) + user = interaction.guild.get_member(self.user_id) if user is not None: user.edit(nick=self.new_nickname) - content = interaction.message.content + f" Approved by <@{interaction.user.id}>" - await interaction.response.send_message(content=content, view=None) + content = interaction.message.content + f" Approved by <@{interaction.user.id}.>" + await interaction.response.edit_message(content=content, view=None) else: - await interaction.response.send_message("An error occured while changing the user's nickname.", view=None) + await interaction.response.edit_message( + content="An error occured while changing the user's nickname.", view=None + ) @nextcord.ui.button(label="Deny", style=nextcord.ButtonStyle.red) async def deny(self, button: nextcord.ui.Button, interaction: nextcord.Interaction): - content = interaction.message.content + f" Denied by <@{interaction.user.id}>" - await interaction.response.send_message(content=content, view=None) + content = interaction.message.content + f" Denied by <@{interaction.user.id}.>" + await interaction.response.edit_message(content=content, view=None)