From d2f0f3230c3a1b303bcc4aa3b7b77d80635b4209 Mon Sep 17 00:00:00 2001 From: mudkipdev Date: Sun, 7 May 2023 15:40:22 -0600 Subject: [PATCH] fix button permission bug --- scnewsbot/extensions/announcements.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scnewsbot/extensions/announcements.py b/scnewsbot/extensions/announcements.py index 7f9bfc2..e2f1f17 100644 --- a/scnewsbot/extensions/announcements.py +++ b/scnewsbot/extensions/announcements.py @@ -303,6 +303,12 @@ class AnnouncementBuilderView(discord.ui.View): async def toggle_private( self, interaction: discord.Interaction, button: discord.ui.Button ) -> None: + if not self._has_permission(interaction.user): + await interaction.response.send_message( + "You cannot use this menu.", ephemeral=True + ) + return + self.announcement_builder.announcement.is_private = ( not self.announcement_builder.announcement.is_private ) @@ -319,6 +325,12 @@ class AnnouncementBuilderView(discord.ui.View): async def toggle_notification( self, interaction: discord.Interaction, button: discord.ui.Button ) -> None: + if not self._has_permission(interaction.user): + await interaction.response.send_message( + "You cannot use this menu.", ephemeral=True + ) + return + self.announcement_builder.announcement.will_notify = ( not self.announcement_builder.announcement.will_notify )