From 66acb9d8140135ce3aa36fc0c789e09e6c766546 Mon Sep 17 00:00:00 2001 From: Armano den Boef <68127614+Rozen4334@users.noreply.github.com> Date: Mon, 1 Aug 2022 18:25:31 +0200 Subject: [PATCH] Init --- .../Services/InteractionHandlingService.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 + } } }