diff options
| -rw-r--r-- | bot/decorators.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bot/decorators.py b/bot/decorators.py index 0e372671a..1ba2cd59e 100644 --- a/bot/decorators.py +++ b/bot/decorators.py @@ -2,10 +2,12 @@ import logging import random import typing from asyncio import Lock, sleep +from contextlib import suppress from functools import wraps from weakref import WeakValueDictionary from discord import Colour, Embed +from discord.errors import NotFound from discord.ext import commands from discord.ext.commands import CheckFailure, Context @@ -134,7 +136,13 @@ def redirect_output(destination_channel: int, bypass_roles: typing.Container[int if RedirectOutput.delete_invocation: await sleep(RedirectOutput.delete_delay) - await message.delete() - await ctx.message.delete() + + with suppress(NotFound): + await message.delete() + log.trace("Redirect output: Deleted user redirection message") + + with suppress(NotFound): + await ctx.message.delete() + log.trace("Redirect output: Deleted invocation message") return inner return wrap |