From b1c3b37235199aaa2beaa3dabfbf034e3cca8af0 Mon Sep 17 00:00:00 2001 From: AAA3A <89632044+AAA3A-AAA3A@users.noreply.github.com> Date: Tue, 20 Jun 2023 13:09:01 +0200 Subject: [PATCH] Clear the view in `[p]set api` after timeout (#6166) --- redbot/core/core_commands.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index 0a9801271..05bdc390e 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -3602,13 +3602,11 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): - `` - The service you're adding tokens to. - `` - Pairs of token keys and values. The key and value should be separated by one of ` `, `,`, or `;`. """ - if service is None: # Handled in order of missing operations - await ctx.send(_("Click the button below to set your keys."), view=SetApiView()) - elif tokens is None: - await ctx.send( - _("Click the button below to set your keys."), - view=SetApiView(default_service=service), - ) + if service is None or tokens is None: + view = SetApiView(default_service=service) + msg = await ctx.send(_("Click the button below to set your keys."), view=view) + await view.wait() + await msg.edit(content=_("This API keys setup message has expired."), view=None) else: if ctx.bot_permissions.manage_messages: await ctx.message.delete()