aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/moderation/clean.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/bot/exts/moderation/clean.py b/bot/exts/moderation/clean.py
index 123148e02..5a3481067 100644
--- a/bot/exts/moderation/clean.py
+++ b/bot/exts/moderation/clean.py
@@ -8,7 +8,7 @@ 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.ext.commands import Cog, Context, Converter, Greedy, group, has_any_role
+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
@@ -452,7 +452,7 @@ class Clean(Cog):
# region: Commands
- @group(invoke_without_command=True, name="clean", aliases=["clear", "purge"])
+ @group(invoke_without_command=True, name="clean", aliases=("clear",))
async def clean_group(
self,
ctx: Context,
@@ -619,6 +619,13 @@ class Clean(Cog):
await self._send_expiring_message(ctx, message)
await self._delete_invocation(ctx)
+ @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)."""
+ if age is None:
+ age = await Age().convert(ctx, "10M")
+ await self._clean_messages(ctx, channels="*", users=users, first_limit=age)
+
# endregion
async def cog_check(self, ctx: Context) -> bool: