From 92be9ca07380af0e803dd0568e0fe8c9fb384ef7 Mon Sep 17 00:00:00 2001 From: Noi Date: Tue, 9 Aug 2022 17:18:25 -0700 Subject: [PATCH] Sanity checking to command registration --- ShardInstance.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ShardInstance.cs b/ShardInstance.cs index 662525c..f00313a 100644 --- a/ShardInstance.cs +++ b/ShardInstance.cs @@ -116,14 +116,19 @@ public sealed class ShardInstance : IDisposable { #if !DEBUG // Update slash/interaction commands if (ShardId == 0) { - await _interactionService.RegisterCommandsGloballyAsync(true).ConfigureAwait(false); + await _interactionService.RegisterCommandsGloballyAsync(true); Log(nameof(ShardInstance), "Updated global command registration."); } #else // Debug: Register our commands locally instead, in each guild we're in - foreach (var g in DiscordClient.Guilds) { - await _interactionService.RegisterCommandsToGuildAsync(g.Id, true).ConfigureAwait(false); - Log(nameof(ShardInstance), $"Updated DEBUG command registration in guild {g.Id}."); + if (DiscordClient.Guilds.Count > 5) { + Program.Log(nameof(ShardInstance), "Are you debugging in production?! Skipping DEBUG command registration."); + return; + } else { + foreach (var g in DiscordClient.Guilds) { + await _interactionService.RegisterCommandsToGuildAsync(g.Id, true).ConfigureAwait(false); + Log(nameof(ShardInstance), $"Updated DEBUG command registration in guild {g.Id}."); + } } #endif }