aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Shivansh <[email protected]>2021-05-05 17:34:24 +0530
committerGravatar Shivansh <[email protected]>2021-05-05 17:34:24 +0530
commitea900a4e06ed09525c9489887538811aff463108 (patch)
tree4054b0f462b0e56915168d43f64f84ed59916047
parentMerge pull request #1520 from python-discord/str-join-tag (diff)
(infractions): Apply tempban if duration is specified while banning a user
-rw-r--r--bot/exts/moderation/infraction/infractions.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/bot/exts/moderation/infraction/infractions.py b/bot/exts/moderation/infraction/infractions.py
index 38d1ffc0e..2d72a3db4 100644
--- a/bot/exts/moderation/infraction/infractions.py
+++ b/bot/exts/moderation/infraction/infractions.py
@@ -76,9 +76,20 @@ 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, then it would temporarily ban that user for the given duration.
+ """
+ await self.apply_ban(ctx, user, reason, expires_at=duration)
@command(aliases=('pban',))
async def purgeban(