aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar shtlrs <[email protected]>2023-03-12 15:09:55 +0100
committerGravatar shtlrs <[email protected]>2023-03-12 15:09:55 +0100
commitf535a5ace04d7bc0610dc0ffd8c07eb943aaad1c (patch)
tree0e5d88c862f035ba420d89a5f5c3089e20a6ae87
parentremove custom ids that handle routing to the view (diff)
bring back the interaction_check
This one is still needed for the `!subscribe` text command to work properly
-rw-r--r--bot/exts/info/subscribe.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/bot/exts/info/subscribe.py b/bot/exts/info/subscribe.py
index db66069b6..3cde07aee 100644
--- a/bot/exts/info/subscribe.py
+++ b/bot/exts/info/subscribe.py
@@ -82,6 +82,16 @@ class RoleButtonView(discord.ui.View):
row = index // ITEMS_PER_ROW
self.add_item(SingleRoleButton(role, role.role_id in author_roles, row))
+ async def interaction_check(self, interaction: Interaction) -> bool:
+ """Ensure that the user clicking the button is the member who invoked the command."""
+ if interaction.user != self.interaction_owner:
+ await interaction.response.send_message(
+ ":x: This is not your command to react to!",
+ ephemeral=True
+ )
+ return False
+ return True
+
class SingleRoleButton(discord.ui.Button):
"""A button that adds or removes a role from the member depending on its current state."""