From 8cbb2424d7290d8d4e220f21c3b9b58f5a91cf9c Mon Sep 17 00:00:00 2001 From: spiral Date: Wed, 16 Jun 2021 08:56:52 -0400 Subject: [PATCH] Throw "no registered switches" error also with frontpercent --- PluralKit.Bot/Commands/Groups.cs | 3 +++ PluralKit.Bot/Commands/SystemFront.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/PluralKit.Bot/Commands/Groups.cs b/PluralKit.Bot/Commands/Groups.cs index d1c27ecb..e33b34b0 100644 --- a/PluralKit.Bot/Commands/Groups.cs +++ b/PluralKit.Bot/Commands/Groups.cs @@ -505,6 +505,9 @@ namespace PluralKit.Bot var targetSystem = await GetGroupSystem(ctx, target, conn); ctx.CheckSystemPrivacy(targetSystem, targetSystem.FrontHistoryPrivacy); + var totalSwitches = await _db.Execute(conn => _repo.GetSwitchCount(conn, targetSystem.Id)); + if (totalSwitches == 0) throw Errors.NoRegisteredSwitches; + string durationStr = ctx.RemainderOrNull() ?? "30d"; var now = SystemClock.Instance.GetCurrentInstant(); diff --git a/PluralKit.Bot/Commands/SystemFront.cs b/PluralKit.Bot/Commands/SystemFront.cs index 2129dcae..16520c31 100644 --- a/PluralKit.Bot/Commands/SystemFront.cs +++ b/PluralKit.Bot/Commands/SystemFront.cs @@ -117,6 +117,9 @@ namespace PluralKit.Bot if (system == null) throw Errors.NoSystemError; ctx.CheckSystemPrivacy(system, system.FrontHistoryPrivacy); + var totalSwitches = await _db.Execute(conn => _repo.GetSwitchCount(conn, system.Id)); + if (totalSwitches == 0) throw Errors.NoRegisteredSwitches; + string durationStr = ctx.RemainderOrNull() ?? "30d"; var now = SystemClock.Instance.GetCurrentInstant();