aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2021-08-31 20:49:15 +0300
committerGravatar mbaruh <[email protected]>2021-08-31 20:49:15 +0300
commitf2fb9f3dd449d58162471525ecaccc6db7d721f0 (patch)
tree8ca4b288fccdd7f68a819e23347789e342b2f474
parentAdded master command (diff)
Disallow time range cleaning in multiple channels
Cleaning in the same time range across several channels seems like an arbitrary decision.
-rw-r--r--bot/exts/moderation/clean.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bot/exts/moderation/clean.py b/bot/exts/moderation/clean.py
index bf018e8aa..1148b3eb5 100644
--- a/bot/exts/moderation/clean.py
+++ b/bot/exts/moderation/clean.py
@@ -91,6 +91,9 @@ class Clean(Cog):
if traverse > CleanMessages.message_limit:
raise BadArgument(f"Cannot traverse more than {CleanMessages.message_limit} messages.")
+ if first_limit and channels and (channels == "*" or len(channels) > 1):
+ raise BadArgument("Message or time range specified across multiple channels.")
+
if (isinstance(first_limit, Message) or isinstance(first_limit, Message)) and channels:
raise BadArgument("Both a message limit and channels specified.")
@@ -424,6 +427,7 @@ class Clean(Cog):
`users`: A series of user mentions, ID's, or names.
`first_limit` and `second_limit`: A message, a duration delta, or an ISO datetime.
If a message is provided, cleaning will happen in that channel, and channels cannot be provided.
+ If a limit is provided, multiple channels cannot be provided.
If only one of them is provided, acts as `clean until`. If both are provided, acts as `clean between`.
`use_cache`: Whether to use the message cache.
If not provided, will default to False unless an asterisk is used for the channels.