diff options
author | 2023-08-18 19:49:24 +0800 | |
---|---|---|
committer | 2023-08-26 23:44:16 +0800 | |
commit | 24fb1b452f4a1af1e424678dc3c19a0ac9b8a1fc (patch) | |
tree | 773aa69c5be0252bc0a969941965a5645b13f51f | |
parent | Specify which action is being performed in confirmation message (diff) |
Ensure view gets deleted if view times out
-rw-r--r-- | bot/exts/utils/reminders.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bot/exts/utils/reminders.py b/bot/exts/utils/reminders.py index 5159db71f..f7d29eff2 100644 --- a/bot/exts/utils/reminders.py +++ b/bot/exts/utils/reminders.py @@ -585,11 +585,14 @@ class Reminders(Cog): modify_action = "edit" confirmation_view = ModifyReminderConfirmationView(ctx.author) - await ctx.reply( + confirmation_message = await ctx.reply( f"Are you sure you want to {modify_action} <@{owner_id}>'s reminder?", view=confirmation_view, ) - await confirmation_view.wait() + view_timed_out = await confirmation_view.wait() + # We don't have access to the message in `on_timeout` so we have to delete the view here + if view_timed_out: + await confirmation_message.edit(view=None) if confirmation_view.result: log.debug(f"{ctx.author} has confirmed reminder modification.") |