diff --git a/DiscordPlayerCountBot/Bot/Bot.cs b/DiscordPlayerCountBot/Bot/Bot.cs index f200a1d..3564547 100644 --- a/DiscordPlayerCountBot/Bot/Bot.cs +++ b/DiscordPlayerCountBot/Bot/Bot.cs @@ -69,7 +69,22 @@ private async Task DiscordClient_Ready() Description = $"This will show the player count for the server: {Information.Name}" }; - await DiscordClient.CreateGlobalApplicationCommandAsync(globalCommand.Build()); + try + { + await DiscordClient.Rest.DeleteAllGlobalCommandsAsync(); + }catch(Exception ex) + { + Error("Failed to delete global commands.", Information.Id.ToString(), ex); + } + + try + { + await DiscordClient.CreateGlobalApplicationCommandAsync(globalCommand.Build()); + } + catch (Exception ex) + { + Error("Failed to apply global commands.", Information.Id.ToString(), ex); + } } public async Task StartAsync(bool shouldStart) diff --git a/DiscordPlayerCountBot/Providers/RconProvider.cs b/DiscordPlayerCountBot/Providers/RconProvider.cs index c7e41ad..39d8222 100644 --- a/DiscordPlayerCountBot/Providers/RconProvider.cs +++ b/DiscordPlayerCountBot/Providers/RconProvider.cs @@ -1,6 +1,4 @@ -using PlayerCountBot.Enums; -using PlayerCountBot.Exceptions; -using PlayerCountBot.Services; +using PlayerCountBot.Exceptions; namespace PlayerCountBot.Providers {