diff options
| author | 2021-04-16 11:41:33 +0200 | |
|---|---|---|
| committer | 2021-04-16 11:41:33 +0200 | |
| commit | 6c9e4f55a26f9903532a9b72f69fcab84c1a3370 (patch) | |
| tree | fe75835add5acdb4a660573c4910401020b4aee3 | |
| parent | Better response wording, added alias (diff) | |
Don't delete invocation in mod channel
| -rw-r--r-- | bot/exts/utils/clean.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bot/exts/utils/clean.py b/bot/exts/utils/clean.py index 985025afe..d9164738a 100644 --- a/bot/exts/utils/clean.py +++ b/bot/exts/utils/clean.py @@ -14,6 +14,7 @@ from bot.constants import ( Channels, CleanMessages, Colours, Event, Icons, MODERATION_ROLES, NEGATIVE_REPLIES ) from bot.exts.moderation.modlog import ModLog +from bot.utils.channel import is_mod_channel log = logging.getLogger(__name__) @@ -221,13 +222,15 @@ class Clean(Cog): if not channels: channels = [ctx.channel] - # Delete the invocation first - self.mod_log.ignore(Event.message_delete, ctx.message.id) - try: - await ctx.message.delete() - except errors.NotFound: - # Invocation message has already been deleted - log.info("Tried to delete invocation message, but it was already deleted.") + if not is_mod_channel(ctx.channel): + + # Delete the invocation first + self.mod_log.ignore(Event.message_delete, ctx.message.id) + try: + await ctx.message.delete() + except errors.NotFound: + # Invocation message has already been deleted + log.info("Tried to delete invocation message, but it was already deleted.") self.cleaning = True |