From 267720bbba43b36a4d2baebd3e5137227fe1510e Mon Sep 17 00:00:00 2001 From: Red-GitHubBot <88117545+Red-GitHubBot@users.noreply.github.com> Date: Wed, 8 Sep 2021 21:41:28 +0200 Subject: [PATCH] [3.4] [Mutes] Fix NotFound error when trying to delete message (#5163) (#5269) * [Mutes] Fix NotFound error when trying to delete message * other occurances (cherry picked from commit c34f1e2f01539076547b22c16581c7a67126fa9d) Co-authored-by: Kreus Amredes <67752638+Kreusada@users.noreply.github.com> Co-authored-by: Kreus Amredes <67752638+Kreusada@users.noreply.github.com> --- redbot/cogs/mutes/mutes.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/redbot/cogs/mutes/mutes.py b/redbot/cogs/mutes/mutes.py index 275a596c2..ce39a8680 100644 --- a/redbot/cogs/mutes/mutes.py +++ b/redbot/cogs/mutes/mutes.py @@ -1030,12 +1030,14 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass): try: await ctx.bot.wait_for(event, check=pred, timeout=30) except asyncio.TimeoutError: - await query.delete() + with contextlib.suppress(discord.NotFound): + await query.delete() return False if not pred.result: if can_react: - await query.delete() + with contextlib.suppress(discord.NotFound): + await query.delete() else: await ctx.send(_("OK then.")) @@ -1242,12 +1244,14 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass): try: await ctx.bot.wait_for(event, check=pred, timeout=30) except asyncio.TimeoutError: - await query.delete() + with contextlib.suppress(discord.NotFound): + await query.delete() return if not pred.result: if can_react: - await query.delete() + with contextlib.suppress(discord.NotFound): + await query.delete() else: await ctx.send(_("OK then.")) return