feat(suggestions): added more checking to approve/deny to prevent them from being used on random messages
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
Seaswimmer 2023-09-21 12:54:09 -04:00
parent 298bf8a3dc
commit 694d8d01de
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -663,8 +663,14 @@ class SuggestionDenyModal(discord.ui.Modal, title="Denying suggestion..."):
@app_commands.context_menu(name="Approve Suggestion") @app_commands.context_menu(name="Approve Suggestion")
async def approve_context(interaction: discord.Interaction, message: discord.Message): async def approve_context(interaction: discord.Interaction, message: discord.Message):
if message.author.id == interaction.client.user.id and len(message.embeds) == 1 and message.embeds[0].title.startswith('Suggestion #'):
await interaction.response.send_modal(SuggestionApproveModal(message)) await interaction.response.send_modal(SuggestionApproveModal(message))
else:
await interaction.response.send_message(content="This is not a suggestion!", ephemeral=True)
@app_commands.context_menu(name="Deny Suggestion") @app_commands.context_menu(name="Deny Suggestion")
async def deny_context(interaction: discord.Interaction, message: discord.Message): async def deny_context(interaction: discord.Interaction, message: discord.Message):
if message.author.id == interaction.client.user.id and len(message.embeds) == 1 and message.embeds[0].title.startswith('Suggestion #'):
await interaction.response.send_modal(SuggestionDenyModal(message)) await interaction.response.send_modal(SuggestionDenyModal(message))
else:
await interaction.response.send_message(content="This is not a suggestion!", ephemeral=True)