Skip to content

Commit

Permalink
Add no permission message to the handler (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
OseSem authored Apr 24, 2024
1 parent af45162 commit e1a7699
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit e1a7699

Please sign in to comment.