Skip to content

Commit

Permalink
Delete global commands on ready. Remove unused using statements
Browse files Browse the repository at this point in the history
  • Loading branch information
GravityWolfNotAmused committed Oct 19, 2024
1 parent a2146db commit 4d3ff23
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 16 additions & 1 deletion DiscordPlayerCountBot/Bot/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions DiscordPlayerCountBot/Providers/RconProvider.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using PlayerCountBot.Enums;
using PlayerCountBot.Exceptions;
using PlayerCountBot.Services;
using PlayerCountBot.Exceptions;

namespace PlayerCountBot.Providers
{
Expand Down

0 comments on commit 4d3ff23

Please sign in to comment.