Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no permission message to the handler #2

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/exts/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ async def handle_trash_button(inter: disnake.MessageInteraction) -> None:
# check if user is the allowed user OR check if the user has required permissions
# missing permissions message sent here if user cannot delete.
if not await has_permission_to_delete(inter, user_id, perms):
await inter.response.send_message(
"Sorry. You are not permitted to delete this message.",
ephemeral=True,
)
return

await inter.response.defer()
Expand Down Expand Up @@ -70,10 +74,6 @@ async def has_permission_to_delete(
if permissions.value & user_permissions.value:
return True

await inter.response.send_message(
"Sorry. You are not permitted to delete this message.",
ephemeral=True,
)
return False


Expand Down
Loading