aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ionite34 <[email protected]>2022-08-03 13:50:58 -0400
committerGravatar ionite34 <[email protected]>2022-08-03 13:50:58 -0400
commit2c5b85bba7f245c61905d5272444fc83329e3c1e (patch)
tree169cf4c6f3da5378c7ed40d585089dd53d4577ac
parentMerge pull request #2224 from python-discord/sid/feature/tags/print-return (diff)
Updated `purge` to require >1 users
-rw-r--r--bot/exts/moderation/clean.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/bot/exts/moderation/clean.py b/bot/exts/moderation/clean.py
index d7c2c7673..a6104d91c 100644
--- a/bot/exts/moderation/clean.py
+++ b/bot/exts/moderation/clean.py
@@ -7,7 +7,7 @@ from datetime import datetime
from itertools import takewhile
from typing import Callable, Iterable, Literal, Optional, TYPE_CHECKING, Union
-from discord import Colour, Message, NotFound, TextChannel, Thread, User, errors
+from discord import Colour, Embed, Message, NotFound, TextChannel, Thread, User, errors
from discord.ext.commands import Cog, Context, Converter, Greedy, command, group, has_any_role
from discord.ext.commands.converter import TextChannelConverter
from discord.ext.commands.errors import BadArgument
@@ -627,12 +627,18 @@ class Clean(Cog):
@command()
async def purge(self, ctx: Context, users: Greedy[User], age: Optional[Union[Age, ISODateTime]] = None) -> None:
"""
- Clean messages of users from all public channels up to a certain message age (10 minutes by default).
+ Clean messages of `users` from all public channels up to a certain message `age` (10 minutes by default).
- The age is *exclusive*, meaning that `10s` won't delete a message exactly 10 seconds old.
+ Requires 1 or more users to be specified. For channel-based cleaning, use `clean` instead.
+
+ The `age` is *exclusive*, meaning that `10s` won't delete a message exactly 10 seconds old.
"""
+ if not users:
+ raise BadArgument("At least one user must be specified.")
+
if age is None:
age = await Age().convert(ctx, "10M")
+
await self._clean_messages(ctx, channels="*", users=users, first_limit=age)
# endregion