From 25bf0d85d4750556f977b7f36e78aa7dc9859c4d Mon Sep 17 00:00:00 2001 From: dusk Date: Wed, 26 Nov 2025 17:03:01 +0000 Subject: [PATCH] duration can be passed as null from the parser so handle that in frontpercent --- PluralKit.Bot/Commands/SystemFront.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Commands/SystemFront.cs b/PluralKit.Bot/Commands/SystemFront.cs index 330a9f77..7b8021c8 100644 --- a/PluralKit.Bot/Commands/SystemFront.cs +++ b/PluralKit.Bot/Commands/SystemFront.cs @@ -104,7 +104,7 @@ public class SystemFront ); } - public async Task FrontPercent(Context ctx, PKSystem? system = null, string durationStr = "30d", bool ignoreNoFronters = false, bool showFlat = false, PKGroup? group = null) + public async Task FrontPercent(Context ctx, PKSystem? system, string? durationStr, bool ignoreNoFronters = false, bool showFlat = false, PKGroup? group = null) { if (system == null && group == null) throw Errors.NoSystemError(ctx.DefaultPrefix); if (system == null) system = await GetGroupSystem(ctx, group); @@ -114,6 +114,9 @@ public class SystemFront var totalSwitches = await ctx.Repository.GetSwitchCount(system.Id); if (totalSwitches == 0) throw Errors.NoRegisteredSwitches; + if (durationStr == null) + durationStr = "30d"; + // Picked the UNIX epoch as a random date // even though we don't store switch timestamps in UNIX time // I assume most people won't have switches logged previously to that (?)