feat(suggestions): added modals for approve and deny context menu commands
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
This commit is contained in:
parent
5cbc438a2b
commit
84c3dd4413
1 changed files with 42 additions and 0 deletions
|
@ -605,3 +605,45 @@ class Suggestions(commands.Cog):
|
||||||
await self.config.custom("SUGGESTION", server, suggestion_id).denied.set(
|
await self.config.custom("SUGGESTION", server, suggestion_id).denied.set(
|
||||||
True
|
True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class SuggestionApproveModal(discord.ui.Modal, title="Approving suggestion..."):
|
||||||
|
def __init__(self, cog_instance, message):
|
||||||
|
super().__init__()
|
||||||
|
self.cog_instance = cog_instance
|
||||||
|
self.message = message
|
||||||
|
|
||||||
|
reason = discord.ui.TextInput(
|
||||||
|
label="Approval Reason",
|
||||||
|
placeholder="Why are you approving this suggestion?",
|
||||||
|
style=discord.TextStyle.paragraph,
|
||||||
|
required=False,
|
||||||
|
max_length=1024
|
||||||
|
)
|
||||||
|
|
||||||
|
async def on_submit(self, interaction: discord.Interaction):
|
||||||
|
if self.reason.value != "":
|
||||||
|
await self.cog_instance.interaction_finish_suggestion(interaction, self.message, True, self.reason.value)
|
||||||
|
else:
|
||||||
|
await self.cog_instance.interaction_finish_suggestion(interaction, self.message, True, None)
|
||||||
|
await interaction.response.send_message(content="Suggestion approved!", ephemeral=True)
|
||||||
|
|
||||||
|
class SuggestionDenyModal(discord.ui.Modal, title="Denying suggestion..."):
|
||||||
|
def __init__(self, cog_instance, message):
|
||||||
|
super().__init__()
|
||||||
|
self.cog_instance = cog_instance
|
||||||
|
self.message = message
|
||||||
|
|
||||||
|
reason = discord.ui.TextInput(
|
||||||
|
label="Denial Reason",
|
||||||
|
placeholder="Why are you denying this suggestion?",
|
||||||
|
style=discord.TextStyle.paragraph,
|
||||||
|
required=False,
|
||||||
|
max_length=1024
|
||||||
|
)
|
||||||
|
|
||||||
|
async def on_submit(self, interaction: discord.Interaction):
|
||||||
|
if self.reason.value != "":
|
||||||
|
await self.cog_instance.interaction_finish_suggestion(interaction, self.message, False, self.reason.value)
|
||||||
|
else:
|
||||||
|
await self.cog_instance.interaction_finish_suggestion(interaction, self.message, False, None)
|
||||||
|
await interaction.response.send_message(content="Suggestion denied!", ephemeral=True)
|
||||||
|
|
Loading…
Reference in a new issue