diff --git a/samples/ShardedClient/Services/InteractionHandlingService.cs b/samples/ShardedClient/Services/InteractionHandlingService.cs index 3c41d7f33..fc2af8150 100644 --- a/samples/ShardedClient/Services/InteractionHandlingService.cs +++ b/samples/ShardedClient/Services/InteractionHandlingService.cs @@ -22,6 +22,7 @@ namespace ShardedClient.Services _service.Log += LogAsync; _client.InteractionCreated += OnInteractionAsync; + _client.ShardReady += ReadyAsync; // For examples on how to handle post execution, // see the InteractionFramework samples. } @@ -30,11 +31,6 @@ namespace ShardedClient.Services public async Task InitializeAsync() { await _service.AddModulesAsync(typeof(InteractionHandlingService).Assembly, _provider); -#if DEBUG - await _service.RegisterCommandsToGuildAsync(1 /* implement */); -#else - await _service.RegisterCommandsGloballyAsync(); -#endif } private async Task OnInteractionAsync(SocketInteraction interaction) @@ -53,5 +49,14 @@ namespace ShardedClient.Services return Task.CompletedTask; } + + private async Task ReadyAsync(DiscordSocketClient _) + { +#if DEBUG + await _service.RegisterCommandsToGuildAsync(1 /* implement */); +#else + await _service.RegisterCommandsGloballyAsync(); +#endif + } } }