From 24fb1b452f4a1af1e424678dc3c19a0ac9b8a1fc Mon Sep 17 00:00:00 2001 From: n0Oo0Oo0b Date: Fri, 18 Aug 2023 19:49:24 +0800 Subject: Ensure view gets deleted if view times out --- bot/exts/utils/reminders.py | 7 +++++-- 1 file 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.") -- cgit v1.2.3