aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/moderation/infraction/infractions.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/moderation/infraction/infractions.py')
-rw-r--r--bot/exts/moderation/infraction/infractions.py43
1 files changed, 32 insertions, 11 deletions
diff --git a/bot/exts/moderation/infraction/infractions.py b/bot/exts/moderation/infraction/infractions.py
index 38d1ffc0e..f19323c7c 100644
--- a/bot/exts/moderation/infraction/infractions.py
+++ b/bot/exts/moderation/infraction/infractions.py
@@ -76,31 +76,52 @@ class Infractions(InfractionScheduler, commands.Cog):
await self.apply_kick(ctx, user, reason)
@command()
- async def ban(self, ctx: Context, user: FetchedMember, *, reason: t.Optional[str] = None) -> None:
- """Permanently ban a user for the given reason and stop watching them with Big Brother."""
- await self.apply_ban(ctx, user, reason)
+ async def ban(
+ self,
+ ctx: Context,
+ user: FetchedMember,
+ duration: t.Optional[Expiry] = None,
+ *,
+ reason: t.Optional[str] = None
+ ) -> None:
+ """
+ Permanently ban a user for the given reason and stop watching them with Big Brother.
+
+ If duration is specified, it temporarily bans that user for the given duration.
+ """
+ await self.apply_ban(ctx, user, reason, expires_at=duration)
@command(aliases=('pban',))
async def purgeban(
self,
ctx: Context,
user: FetchedMember,
- purge_days: t.Optional[int] = 1,
+ duration: t.Optional[Expiry] = None,
*,
reason: t.Optional[str] = None
) -> None:
"""
- Same as ban but removes all their messages for the given number of days, default being 1.
+ Same as ban but removes all their messages of the last 24 hours.
- `purge_days` can only be values between 0 and 7.
- Anything outside these bounds are automatically adjusted to their respective limits.
+ If duration is specified, it temporarily bans that user for the given duration.
"""
- await self.apply_ban(ctx, user, reason, max(min(purge_days, 7), 0))
+ await self.apply_ban(ctx, user, reason, 1, expires_at=duration)
@command(aliases=('vban',))
- async def voiceban(self, ctx: Context, user: FetchedMember, *, reason: t.Optional[str]) -> None:
- """Permanently ban user from using voice channels."""
- await self.apply_voice_ban(ctx, user, reason)
+ async def voiceban(
+ self,
+ ctx: Context,
+ user: FetchedMember,
+ duration: t.Optional[Expiry] = None,
+ *,
+ reason: t.Optional[str]
+ ) -> None:
+ """
+ Permanently ban user from using voice channels.
+
+ If duration is specified, it temporarily voice bans that user for the given duration.
+ """
+ await self.apply_voice_ban(ctx, user, reason, expires_at=duration)
# endregion
# region: Temporary infractions