Added doc strings for the approve and deny buttons.
build_develop / build (push) Successful in 1m24s
build_develop / build (push) Successful in 1m24s
This commit is contained in:
@@ -60,6 +60,15 @@ class UsernameRequest(nextcord.ui.View):
|
|||||||
|
|
||||||
@nextcord.ui.button(label="Approve", style=nextcord.ButtonStyle.green)
|
@nextcord.ui.button(label="Approve", style=nextcord.ButtonStyle.green)
|
||||||
async def approve(self, button: nextcord.ui.Button, interaction: nextcord.Interaction):
|
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)
|
user = interaction.guild.get_member(self.user_id)
|
||||||
if user is not None:
|
if user is not None:
|
||||||
try:
|
try:
|
||||||
@@ -83,5 +92,12 @@ class UsernameRequest(nextcord.ui.View):
|
|||||||
|
|
||||||
@nextcord.ui.button(label="Deny", style=nextcord.ButtonStyle.red)
|
@nextcord.ui.button(label="Deny", style=nextcord.ButtonStyle.red)
|
||||||
async def deny(self, button: nextcord.ui.Button, interaction: nextcord.Interaction):
|
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}.>"
|
content = interaction.message.content + f"\nDenied by <@{interaction.user.id}.>"
|
||||||
await interaction.response.edit_message(content=content, view=None)
|
await interaction.response.edit_message(content=content, view=None)
|
||||||
|
|||||||
Reference in New Issue
Block a user