diff --git a/redbot/cogs/cleanup/cleanup.py b/redbot/cogs/cleanup/cleanup.py index a0a44fcec..3ab1df1f9 100644 --- a/redbot/cogs/cleanup/cleanup.py +++ b/redbot/cogs/cleanup/cleanup.py @@ -1,3 +1,4 @@ +import contextlib import logging from datetime import datetime, timedelta from typing import Callable, List, Optional, Set, Union @@ -61,11 +62,10 @@ class Cleanup(commands.Cog): response = await ctx.bot.wait_for("message", check=MessagePredicate.same_context(ctx)) if response.content.lower().startswith("y"): - await prompt.delete() - try: + with contextlib.suppress(discord.NotFound): + await prompt.delete() + with contextlib.suppress(discord.HTTPException): await response.delete() - except discord.HTTPException: - pass return True else: await ctx.send(_("Cancelled."))