From 8c20641041d69ffcda9ece90d736f366ca19e21f Mon Sep 17 00:00:00 2001 From: imcompiling Date: Sat, 29 Jul 2023 21:13:14 -0400 Subject: [PATCH] Added doc strings for the approve and deny buttons. --- cogs/commands/request.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cogs/commands/request.py b/cogs/commands/request.py index b505d86..7a4f69f 100644 --- a/cogs/commands/request.py +++ b/cogs/commands/request.py @@ -60,6 +60,15 @@ class UsernameRequest(nextcord.ui.View): @nextcord.ui.button(label="Approve", style=nextcord.ButtonStyle.green) async def approve(self, button: nextcord.ui.Button, interaction: nextcord.Interaction): + """ + Approve button for a nickname change request. Changes the target's nickname to self.new_nickname. + Catches an error if the target as a higher role than the bot. + Removes the view from the interaction message. + + Args: + button (nextcord.ui.Button): Unused. + interaction (nextcord.Interaction): The interaction of the user clicking the button. + """ user = interaction.guild.get_member(self.user_id) if user is not None: try: @@ -83,5 +92,12 @@ 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): + """ + Deny button for a nickname request. Just removes the view and logs who denied the request. + + Args: + button (nextcord.ui.Button): Unused. + interaction (nextcord.Interaction): The interaction of the user clicking the button. + """ content = interaction.message.content + f"\nDenied by <@{interaction.user.id}.>" await interaction.response.edit_message(content=content, view=None)