From eb7e3948cd6d953ea9d97a2b153ceb814e1a4e4f Mon Sep 17 00:00:00 2001 From: Noi Date: Tue, 9 Aug 2022 18:18:38 -0700 Subject: [PATCH] Sanity checking to command registration --- WorldTime.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/WorldTime.cs b/WorldTime.cs index fb8444b..0c47c95 100644 --- a/WorldTime.cs +++ b/WorldTime.cs @@ -170,10 +170,14 @@ internal class WorldTime : IDisposable { } #else // Debug: Register our commands locally instead, in each guild we're in - var iasrv = _services.GetRequiredService(); - foreach (var g in arg.Guilds) { - await iasrv.RegisterCommandsToGuildAsync(g.Id, true).ConfigureAwait(false); - Program.Log("Command registration", $"Updated DEBUG command registration in guild {g.Id}."); + if (arg.Guilds.Count > 5) { + Program.Log("Command registration", "Are you debugging in production?! Skipping DEBUG command registration."); + } else { + var iasrv = _services.GetRequiredService(); + foreach (var g in arg.Guilds) { + await iasrv.RegisterCommandsToGuildAsync(g.Id, true).ConfigureAwait(false); + Program.Log("Command registration", $"Updated DEBUG command registration in guild {g.Id}."); + } } #endif }