From 20b22a1f17048aac8fb194eb034ccaf02c0d63ed Mon Sep 17 00:00:00 2001 From: "Nyeki.py" <84998222+Nekidev@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:33:43 -0300 Subject: [PATCH] feat(bot): :sparkles: Add "Ongoing Bans" stat to `p.stats` and reduce default iterations to 4. --- payphone/cogs/mods/cog.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/payphone/cogs/mods/cog.py b/payphone/cogs/mods/cog.py index 67edf74..9ccb5c4 100644 --- a/payphone/cogs/mods/cog.py +++ b/payphone/cogs/mods/cog.py @@ -329,7 +329,7 @@ class Mods(base.Cog): @commands.command() @commands.is_owner() async def stats( - self, ctx: commands.Context, iterations: int = 5, wait: int = 5 + self, ctx: commands.Context, iterations: int = 4, wait: int = 5 ) -> None: """ Shows all Payphone's stats. @@ -362,6 +362,16 @@ class Mods(base.Cog): lambda: models.Call.filter(ended_at=None).count(), ), ("Bans", lambda: models.Ban.all().count()), + ( + "Ongoing Bans", + lambda: models.Ban.filter( + expressions.Q( + expires_at=None, + expires_at__gt=datetime.now(timezone.utc), + join_type="OR", + ) + ).count(), + ), ("Reports", lambda: models.Report.all().count()), ( "On-review Reports",