aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2021-12-31 18:13:09 +0000
committerGravatar Chris Lovering <[email protected]>2022-02-16 22:12:03 +0000
commitcaaf0fa6d73ff6c8cfe54c7f8b952caf0aec97e2 (patch)
treee2ccc1121e33fbf5471de280eeb7d2111f4a47fe
parentReply with log url after cleaning messages (diff)
Support not deleting invoking message of a clean task
-rw-r--r--bot/exts/moderation/clean.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bot/exts/moderation/clean.py b/bot/exts/moderation/clean.py
index f8ba230b3..cb6836258 100644
--- a/bot/exts/moderation/clean.py
+++ b/bot/exts/moderation/clean.py
@@ -380,6 +380,7 @@ class Clean(Cog):
regex: Optional[re.Pattern] = None,
first_limit: Optional[CleanLimit] = None,
second_limit: Optional[CleanLimit] = None,
+ attempt_delete_invocation: bool = True,
) -> Optional[str]:
"""A helper function that does the actual message cleaning, returns the log url if logging was successful."""
self._validate_input(channels, bots_only, users, first_limit, second_limit)
@@ -404,8 +405,9 @@ class Clean(Cog):
# Needs to be called after standardizing the input.
predicate = self._build_predicate(first_limit, second_limit, bots_only, users, regex)
- # Delete the invocation first
- await self._delete_invocation(ctx)
+ if attempt_delete_invocation:
+ # Delete the invocation first
+ await self._delete_invocation(ctx)
if self._use_cache(first_limit):
log.trace(f"Messages for cleaning by {ctx.author.id} will be searched in the cache.")