From 694d8d01decdc2fa844f7037e3bbfbcfcc83c0a7 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 21 Sep 2023 12:54:09 -0400 Subject: [PATCH] feat(suggestions): added more checking to approve/deny to prevent them from being used on random messages --- suggestions/suggestions.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/suggestions/suggestions.py b/suggestions/suggestions.py index 678763d..0a9965e 100644 --- a/suggestions/suggestions.py +++ b/suggestions/suggestions.py @@ -663,8 +663,14 @@ class SuggestionDenyModal(discord.ui.Modal, title="Denying suggestion..."): @app_commands.context_menu(name="Approve Suggestion") async def approve_context(interaction: discord.Interaction, message: discord.Message): - await interaction.response.send_modal(SuggestionApproveModal(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)) + else: + await interaction.response.send_message(content="This is not a suggestion!", ephemeral=True) @app_commands.context_menu(name="Deny Suggestion") async def deny_context(interaction: discord.Interaction, message: discord.Message): - await interaction.response.send_modal(SuggestionDenyModal(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)) + else: + await interaction.response.send_message(content="This is not a suggestion!", ephemeral=True)