Skip to content

Commit

Permalink
Allow SimpleMenu to delete ephemeral responses (#6304)
Browse files Browse the repository at this point in the history
  • Loading branch information
yamikaitou authored Jul 18, 2024
1 parent bf8c0d0 commit 601816a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions redbot/core/utils/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ def __init__(self, style: discord.ButtonStyle, emoji: Union[str, discord.Partial
async def callback(self, interaction: discord.Interaction):
self.view.stop()
if interaction.message.flags.ephemeral:
await interaction.response.edit_message(view=None)
return
await interaction.message.delete()
await interaction.response.defer(thinking=False)
await interaction.delete_original_response()
else:
await interaction.message.delete()


class SimpleMenu(discord.ui.View):
Expand Down Expand Up @@ -208,7 +209,7 @@ def author(self, value: Optional[discord.abc.User]) -> None:

async def on_timeout(self):
try:
if self.delete_after_timeout and not self.message.flags.ephemeral:
if self.delete_after_timeout:
await self.message.delete()
elif self.disable_after_timeout:
for child in self.children:
Expand Down

0 comments on commit 601816a

Please sign in to comment.