diff --git a/src/Discord.Net.Rest/Discord.Net.Rest.xml b/src/Discord.Net.Rest/Discord.Net.Rest.xml
index 5a70ac05f..da7b42842 100644
--- a/src/Discord.Net.Rest/Discord.Net.Rest.xml
+++ b/src/Discord.Net.Rest/Discord.Net.Rest.xml
@@ -2740,6 +2740,15 @@
+
+
+ Deletes all slash commands in the current guild.
+
+ The options to be used when sending the request.
+
+ A task that represents the asynchronous delete operation.
+
+
Gets a collection of slash commands created by the current user in this guild.
diff --git a/src/Discord.Net.Rest/DiscordRestClient.cs b/src/Discord.Net.Rest/DiscordRestClient.cs
index 0f93c3f65..a8849525e 100644
--- a/src/Discord.Net.Rest/DiscordRestClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestClient.cs
@@ -125,7 +125,8 @@ namespace Discord.Rest
=> InteractionHelper.BulkOverwriteGuildCommands(this, guildId, commandProperties, options);
public Task> BatchEditGuildCommandPermissions(ulong guildId, IDictionary permissions, RequestOptions options = null)
=> InteractionHelper.BatchEditGuildCommandPermissionsAsync(this, guildId, permissions, options);
-
+ public Task DeleteAllGlobalCommandsAsync(RequestOptions options = null)
+ => InteractionHelper.DeleteAllGlobalCommandsAsync(this, options);
public Task AddRoleAsync(ulong guildId, ulong userId, ulong roleId)
=> ClientHelper.AddRoleAsync(this, guildId, userId, roleId);
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
index 6c561002e..37491909c 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
@@ -256,6 +256,16 @@ namespace Discord.Rest
=> GuildHelper.LeaveAsync(this, Discord, options);
//Interactions
+ ///
+ /// Deletes all slash commands in the current guild.
+ ///
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous delete operation.
+ ///
+ public Task DeleteSlashCommandsAsync(RequestOptions options = null)
+ => InteractionHelper.DeleteAllGuildCommandsAsync(Discord, this.Id, options);
+
///
/// Gets a collection of slash commands created by the current user in this guild.
///
diff --git a/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs b/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs
index 38ba94275..22f12ff48 100644
--- a/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs
@@ -11,6 +11,16 @@ namespace Discord.Rest
{
internal static class InteractionHelper
{
+ public static Task DeleteAllGuildCommandsAsync(BaseDiscordClient client, ulong guildId, RequestOptions options = null)
+ {
+ return client.ApiClient.BulkOverwriteGuildApplicationCommands(guildId, new CreateApplicationCommandParams[0], options);
+ }
+
+ public static Task DeleteAllGlobalCommandsAsync(BaseDiscordClient client, RequestOptions options = null)
+ {
+ return client.ApiClient.BulkOverwriteGlobalApplicationCommands(new CreateApplicationCommandParams[0], options);
+ }
+
public static Task SendInteractionResponse(BaseDiscordClient client, IMessageChannel channel, InteractionResponse response,
ulong interactionId, string interactionToken, RequestOptions options = null)
{
@@ -348,7 +358,7 @@ namespace Discord.Rest
return new GuildApplicationCommandPermission(model.Id, model.ApplicationId, guildId, model.Permissions.Select(
y => new ApplicationCommandPermission(y.Id, y.Type, y.Permission)).ToArray());
}
- catch(HttpException x)
+ catch (HttpException x)
{
if (x.HttpCode == System.Net.HttpStatusCode.NotFound)
return null;
@@ -365,7 +375,7 @@ namespace Discord.Rest
List models = new List();
- foreach(var arg in args)
+ foreach (var arg in args)
{
var model = new ApplicationCommandPermissions()
{
@@ -391,7 +401,7 @@ namespace Discord.Rest
List models = new List();
- foreach(var arg in args)
+ foreach (var arg in args)
{
Preconditions.AtMost(arg.Value.Length, 10, nameof(args));
diff --git a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
index 344d7ab20..9df04c8a5 100644
--- a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
+++ b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
@@ -2843,6 +2843,15 @@
voice regions the guild can access.
+
+
+ Deletes all slash commands in the current guild.
+
+ The options to be used when sending the request.
+
+ A task that represents the asynchronous delete operation.
+
+
Gets a collection of slash commands created by the current user in this guild.
diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
index ef4e87305..e8748dda9 100644
--- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
+++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
@@ -724,6 +724,16 @@ namespace Discord.WebSocket
=> GuildHelper.CreateIntegrationAsync(this, Discord, id, type, options);
//Interactions
+ ///
+ /// Deletes all slash commands in the current guild.
+ ///
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous delete operation.
+ ///
+ public Task DeleteSlashCommandsAsync(RequestOptions options = null)
+ => InteractionHelper.DeleteAllGuildCommandsAsync(Discord, this.Id, options);
+
///
/// Gets a collection of slash commands created by the current user in this guild.
///
@@ -823,7 +833,7 @@ namespace Discord.WebSocket
if (_roles.TryGetValue(model.Id, out SocketRole role))
_roles[model.Id].Update(this.Discord.State, model);
else
- role = AddRole(model);
+ role = AddRole(model);
return role;
}
@@ -1289,7 +1299,7 @@ namespace Discord.WebSocket
Task> IGuild.GetVoiceChannelsAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult>(VoiceChannels);
///
- Task> IGuild.GetCategoriesAsync(CacheMode mode , RequestOptions options)
+ Task> IGuild.GetCategoriesAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult>(CategoryChannels);
///
Task IGuild.GetVoiceChannelAsync(ulong id, CacheMode mode, RequestOptions options)