diff options
| author | 2020-05-31 23:36:28 +0200 | |
|---|---|---|
| committer | 2020-05-31 23:36:28 +0200 | |
| commit | 345fda6b88fef50e9bc47298085a10d8acb4fdff (patch) | |
| tree | e6feb1e69b46a6173d07a0dea4d10eea5d24f9b5 | |
| parent | Revert "Add a mod_log.ignore_all context manager." (diff) | |
Revert message ignore approach.
We're removing the context manager due to async concerns, so we'll go
back to the old approach again of ignoring specific messages and
iterating history.
Diffstat (limited to '')
| -rw-r--r-- | bot/cogs/clean.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/bot/cogs/clean.py b/bot/cogs/clean.py index 892c638b8..b164cf232 100644 --- a/bot/cogs/clean.py +++ b/bot/cogs/clean.py @@ -10,7 +10,7 @@ from discord.ext.commands import Cog, Context, group from bot.bot import Bot from bot.cogs.moderation import ModLog from bot.constants import ( - Channels, CleanMessages, Colours, Icons, MODERATION_ROLES, NEGATIVE_REPLIES + Channels, CleanMessages, Colours, Event, Icons, MODERATION_ROLES, NEGATIVE_REPLIES ) from bot.decorators import with_role @@ -114,11 +114,10 @@ class Clean(Cog): channels = [ctx.channel] # Delete the invocation first - with self.mod_log.ignore_all(): - await ctx.message.delete() + self.mod_log.ignore(Event.message_delete, ctx.message.id) + await ctx.message.delete() # Look through the history and retrieve message data - # This is only done so we can create a log to upload. messages = [] message_ids = [] self.cleaning = True @@ -138,12 +137,12 @@ class Clean(Cog): self.cleaning = False # Now let's delete the actual messages with purge. - with self.mod_log.ignore_all(): - for channel in channels: - await channel.purge( - limit=amount, - check=predicate - ) + self.mod_log.ignore(Event.message_delete, *message_ids) + for channel in channels: + await channel.purge( + limit=amount, + check=predicate + ) # Reverse the list to restore chronological order if messages: |