diff --git a/cogs/commands/request.py b/cogs/commands/request.py index d7c694d..b505d86 100644 --- a/cogs/commands/request.py +++ b/cogs/commands/request.py @@ -62,9 +62,20 @@ class UsernameRequest(nextcord.ui.View): async def approve(self, button: nextcord.ui.Button, interaction: nextcord.Interaction): user = interaction.guild.get_member(self.user_id) if user is not None: - await user.edit(nick=self.new_nickname) - content = interaction.message.content + f" Approved by <@{interaction.user.id}>." - await interaction.response.edit_message(content=content, view=None) + try: + await user.edit(nick=self.new_nickname) + content = interaction.message.content + f"\nApproved by <@{interaction.user.id}>." + await interaction.response.edit_message(content=content, view=None) + except nextcord.errors.Forbidden: + await interaction.response.send_message( + content="Please change manually.", + ephemeral=True, + ) + content = ( + interaction.message.content + + "\n\nFailed. User has too high permissions for bot to change nickname." + ) + await interaction.followup.edit_message(interaction.message.id, content=content, view=None) else: await interaction.response.edit_message( content="An error occured while changing the user's nickname.", view=None @@ -72,5 +83,5 @@ class UsernameRequest(nextcord.ui.View): @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}.>" + content = interaction.message.content + f"\nDenied by <@{interaction.user.id}.>" await interaction.response.edit_message(content=content, view=None)