diff --git a/src/Discord.Net.Rest/DiscordRestClient.cs b/src/Discord.Net.Rest/DiscordRestClient.cs
index 0549fdcb..de9f2313 100644
--- a/src/Discord.Net.Rest/DiscordRestClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestClient.cs
@@ -371,6 +371,12 @@ namespace Discord.Rest
///
async Task IDiscordClient.GetGlobalApplicationCommandAsync(ulong id, RequestOptions options)
=> await ClientHelper.GetGlobalApplicationCommandAsync(this, id, options).ConfigureAwait(false);
+ ///
+ async Task IDiscordClient.CreateGlobalApplicationCommand(ApplicationCommandProperties properties, RequestOptions options)
+ => await CreateGlobalCommand(properties, options).ConfigureAwait(false);
+ ///
+ async Task> IDiscordClient.BulkOverwriteGlobalApplicationCommand(ApplicationCommandProperties[] properties, RequestOptions options)
+ => await BulkOverwriteGlobalCommands(properties, options).ConfigureAwait(false);
#endregion
}
}
diff --git a/src/Discord.Net.WebSocket/DiscordShardedClient.cs b/src/Discord.Net.WebSocket/DiscordShardedClient.cs
index fdccee1f..8b859c0f 100644
--- a/src/Discord.Net.WebSocket/DiscordShardedClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordShardedClient.cs
@@ -519,6 +519,49 @@ namespace Discord.WebSocket
client.WebhooksUpdated += (arg1, arg2) => _webhooksUpdated.InvokeAsync(arg1, arg2);
client.AuditLogCreated += (arg1, arg2) => _auditLogCreated.InvokeAsync(arg1, arg2);
}
+
+ public async Task CreateGlobalApplicationCommandAsync(ApplicationCommandProperties properties, RequestOptions options = null)
+ {
+ var model = await InteractionHelper.CreateGlobalCommandAsync(this, properties, options).ConfigureAwait(false);
+
+ SocketApplicationCommand entity = null;
+
+ foreach (var shard in _shards)
+ {
+ entity = shard.State.GetOrAddCommand(model.Id, (id) => SocketApplicationCommand.Create(shard, model));
+
+ //Update it in case it was cached
+ entity.Update(model);
+ }
+
+ System.Diagnostics.Debug.Assert(entity != null, "There should be at least one shard to get the entity");
+
+ return entity;
+ }
+
+ public async Task> BulkOverwriteGlobalApplicationCommandsAsync(
+ ApplicationCommandProperties[] properties, RequestOptions options = null)
+ {
+ var models = await InteractionHelper.BulkOverwriteGlobalCommandsAsync(this, properties, options);
+
+ IEnumerable entities = null;
+
+ foreach (var shard in _shards)
+ {
+ entities = models.Select(x => SocketApplicationCommand.Create(shard, x));
+ //Purge our previous commands
+ shard.State.PurgeCommands(x => x.IsGlobalCommand);
+
+ foreach (var entity in entities)
+ {
+ shard.State.AddCommand(entity);
+ }
+ }
+
+ System.Diagnostics.Debug.Assert(entities != null, "There should be at least one shard to get the entities");
+ return entities.ToImmutableArray();
+ }
+
#endregion
#region IDiscordClient
@@ -578,6 +621,12 @@ namespace Discord.WebSocket
{
return await GetVoiceRegionAsync(id).ConfigureAwait(false);
}
+ ///
+ async Task IDiscordClient.CreateGlobalApplicationCommand(ApplicationCommandProperties properties, RequestOptions options)
+ => await CreateGlobalApplicationCommandAsync(properties, options).ConfigureAwait(false);
+ ///
+ async Task> IDiscordClient.BulkOverwriteGlobalApplicationCommand(ApplicationCommandProperties[] properties, RequestOptions options)
+ => await BulkOverwriteGlobalApplicationCommandsAsync(properties, options);
#endregion
#region Dispose
diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
index d589b137..2356f226 100644
--- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
@@ -3442,6 +3442,12 @@ namespace Discord.WebSocket
///
async Task> IDiscordClient.GetGlobalApplicationCommandsAsync(bool withLocalizations, string locale, RequestOptions options)
=> await GetGlobalApplicationCommandsAsync(withLocalizations, locale, options);
+ ///
+ async Task IDiscordClient.CreateGlobalApplicationCommand(ApplicationCommandProperties properties, RequestOptions options)
+ => await CreateGlobalApplicationCommandAsync(properties, options).ConfigureAwait(false);
+ ///
+ async Task> IDiscordClient.BulkOverwriteGlobalApplicationCommand(ApplicationCommandProperties[] properties, RequestOptions options)
+ => await BulkOverwriteGlobalApplicationCommandsAsync(properties, options);
///
async Task IDiscordClient.StartAsync()