diff --git a/src/Discord.Net.Core/Discord.Net.Core.xml b/src/Discord.Net.Core/Discord.Net.Core.xml
index 582210832..803127009 100644
--- a/src/Discord.Net.Core/Discord.Net.Core.xml
+++ b/src/Discord.Net.Core/Discord.Net.Core.xml
@@ -3914,6 +3914,16 @@
A task that represents the asynchronous removal operation.
+
+
+ Gets this guilds slash commands commands
+
+ The options to be used when sending the request.
+
+ A task that represents the asynchronous get operation. The task result contains a read-only collection
+ of application commands found within the guild.
+
+
Holds information for a guild integration feature.
@@ -4504,13 +4514,6 @@
If the option is a subcommand or subcommand group type, this nested options will be the parameters.
-
-
- Deletes this command
-
- The options to be used when sending the request.
- A task that represents the asynchronous delete operation.
-
Represents data of an Interaction Command, see .
@@ -4644,6 +4647,58 @@
read-only property, always 1.
+
+
+ Responds to an Interaction with type .
+
+ The text of the message to be sent.
+ A array of embeds to send with this response. Max 10
+ if the message should be read out by a text-to-speech reader, otherwise .
+ if the response should be hidden to everyone besides the invoker of the command, otherwise .
+ The allowed mentions for this response.
+ The request options for this response.
+ A to be sent with this response
+ A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
+
+
+
+ Sends a followup message for this interaction.
+
+ The text of the message to be sent
+ A array of embeds to send with this response. Max 10
+ if the message should be read out by a text-to-speech reader, otherwise .
+ if the response should be hidden to everyone besides the invoker of the command, otherwise .
+ The allowed mentions for this response.
+ The request options for this response.
+ A to be sent with this response
+ A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
+
+ The sent message.
+
+
+
+
+ Gets the original response for this interaction.
+
+ The request options for this async request.
+ A that represents the initial response.
+
+
+
+ Edits original response for this interaction.
+
+ A delegate containing the properties to modify the message with.
+ The request options for this async request.
+ A that represents the initial response.
+
+
+
+ Acknowledges this interaction.
+
+
+ A task that represents the asynchronous operation of acknowledging the interaction.
+
+
Represents an interface used to specify classes that they are a vaild dataype of a class.
@@ -4794,6 +4849,11 @@
Represents a builder for creating a .
+
+
+ The max length of a .
+
+
The max length of a .
@@ -4921,7 +4981,7 @@
Gets or sets the label of the current button.
- length exceeds .
+ length exceeds .
@@ -5251,11 +5311,16 @@
The maximum length of a .
+
+
+ The maximum length of a .
+
+
Gets or sets the label of the current select menu.
- length exceeds
+ length exceeds
diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
index ad2e0317d..414b6fe73 100644
--- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
+++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
@@ -941,5 +941,15 @@ namespace Discord
/// A task that represents the asynchronous removal operation.
///
Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null);
+
+ ///
+ /// Gets this guilds slash commands commands
+ ///
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous get operation. The task result contains a read-only collection
+ /// of application commands found within the guild.
+ ///
+ Task> GetApplicationCommandsAsync (RequestOptions options = null);
}
}
diff --git a/src/Discord.Net.Core/Entities/Interactions/IApplicationCommand.cs b/src/Discord.Net.Core/Entities/Interactions/IApplicationCommand.cs
index eb61c539f..a1a33acea 100644
--- a/src/Discord.Net.Core/Entities/Interactions/IApplicationCommand.cs
+++ b/src/Discord.Net.Core/Entities/Interactions/IApplicationCommand.cs
@@ -9,7 +9,7 @@ namespace Discord
///
/// The base command model that belongs to an application. see
///
- public interface IApplicationCommand : ISnowflakeEntity
+ public interface IApplicationCommand : ISnowflakeEntity, IDeletable
{
///
/// Gets the unique id of the parent application.
@@ -35,12 +35,5 @@ namespace Discord
/// If the option is a subcommand or subcommand group type, this nested options will be the parameters.
///
IReadOnlyCollection Options { get; }
-
- ///
- /// Deletes this command
- ///
- /// The options to be used when sending the request.
- /// A task that represents the asynchronous delete operation.
- Task DeleteAsync(RequestOptions options = null);
}
}
diff --git a/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs b/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs
index 466bf3e91..b5afddca2 100644
--- a/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs
+++ b/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs
@@ -39,5 +39,59 @@ namespace Discord
/// read-only property, always 1.
///
int Version { get; }
+
+ ///
+ /// Responds to an Interaction with type .
+ ///
+ /// The text of the message to be sent.
+ /// A array of embeds to send with this response. Max 10
+ /// if the message should be read out by a text-to-speech reader, otherwise .
+ /// if the response should be hidden to everyone besides the invoker of the command, otherwise .
+ /// The allowed mentions for this response.
+ /// The request options for this response.
+ /// A to be sent with this response
+ /// A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
+ Task RespondAsync (string text = null, Embed[] embeds = null, bool isTTS = false,
+ bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null, Embed embed = null);
+
+ ///
+ /// Sends a followup message for this interaction.
+ ///
+ /// The text of the message to be sent
+ /// A array of embeds to send with this response. Max 10
+ /// if the message should be read out by a text-to-speech reader, otherwise .
+ /// if the response should be hidden to everyone besides the invoker of the command, otherwise .
+ /// The allowed mentions for this response.
+ /// The request options for this response.
+ /// A to be sent with this response
+ /// A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
+ ///
+ /// The sent message.
+ ///
+ Task FollowupAsync (string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
+ AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null, Embed embed = null);
+
+ ///
+ /// Gets the original response for this interaction.
+ ///
+ /// The request options for this async request.
+ /// A that represents the initial response.
+ Task GetOriginalResponseAsync (RequestOptions options = null);
+
+ ///
+ /// Edits original response for this interaction.
+ ///
+ /// A delegate containing the properties to modify the message with.
+ /// The request options for this async request.
+ /// A that represents the initial response.
+ Task ModifyOriginalResponseAsync (Action func, RequestOptions options = null);
+
+ ///
+ /// Acknowledges this interaction.
+ ///
+ ///
+ /// A task that represents the asynchronous operation of acknowledging the interaction.
+ ///
+ Task DeferAsync (RequestOptions options = null);
}
}
diff --git a/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs
index 4027db408..085c62cef 100644
--- a/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs
+++ b/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs
@@ -10,6 +10,11 @@ namespace Discord
///
public class ComponentBuilder
{
+ ///
+ /// The max length of a .
+ ///
+ public const int MaxButtonLabelLength = 80;
+
///
/// The max length of a .
///
@@ -310,14 +315,14 @@ namespace Discord
///
/// Gets or sets the label of the current button.
///
- /// length exceeds .
+ /// length exceeds .
public string Label
{
get => _label;
set
{
- if (value != null && value.Length > MaxLabelLength)
- throw new ArgumentException(message: $"Button label must be {MaxLabelLength} characters or less!", paramName: nameof(Label));
+ if (value != null && value.Length > ComponentBuilder.MaxButtonLabelLength)
+ throw new ArgumentException(message: $"Button label must be {ComponentBuilder.MaxButtonLabelLength} characters or less!", paramName: nameof(Label));
_label = value;
}
@@ -840,19 +845,24 @@ namespace Discord
/// The maximum length of a .
///
public const int MaxDescriptionLength = 100;
+
+ ///
+ /// The maximum length of a .
+ ///
+ public const int MaxSelectLabelLength = 100;
///
/// Gets or sets the label of the current select menu.
///
- /// length exceeds
+ /// length exceeds
public string Label
{
get => _label;
set
{
if (value != null)
- if (value.Length > MaxLabelLength)
- throw new ArgumentException(message: $"Button label must be {MaxLabelLength} characters or less!", paramName: nameof(Label));
+ if (value.Length > MaxSelectLabelLength)
+ throw new ArgumentException(message: $"Button label must be {MaxSelectLabelLength} characters or less!", paramName: nameof(Label));
_label = value;
}
diff --git a/src/Discord.Net.Rest/Discord.Net.Rest.xml b/src/Discord.Net.Rest/Discord.Net.Rest.xml
index 5d1949650..8aa36360f 100644
--- a/src/Discord.Net.Rest/Discord.Net.Rest.xml
+++ b/src/Discord.Net.Rest/Discord.Net.Rest.xml
@@ -3493,6 +3493,16 @@
of webhooks found within the guild.
+
+
+ Gets this guilds slash commands commands
+
+ The options to be used when sending the request.
+
+ A task that represents the asynchronous get operation. The task result contains a read-only collection
+ of application commands found within the guild.
+
+
Returns the name of the guild.
@@ -3650,6 +3660,9 @@
+
+
+
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
index 2fab63347..126a211c8 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
@@ -869,6 +869,18 @@ namespace Discord.Rest
public Task> GetWebhooksAsync(RequestOptions options = null)
=> GuildHelper.GetWebhooksAsync(this, Discord, options);
+ //Interactions
+ ///
+ /// Gets this guilds slash commands commands
+ ///
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous get operation. The task result contains a read-only collection
+ /// of application commands found within the guild.
+ ///
+ public async Task> GetApplicationCommandsAsync (RequestOptions options = null)
+ => await ClientHelper.GetGuildApplicationCommands(Discord, Id, options).ConfigureAwait(false);
+
///
/// Returns the name of the guild.
///
@@ -1154,6 +1166,8 @@ namespace Discord.Rest
///
async Task> IGuild.GetWebhooksAsync(RequestOptions options)
=> await GetWebhooksAsync(options).ConfigureAwait(false);
-
+ ///
+ async Task> IGuild.GetApplicationCommandsAsync (RequestOptions options)
+ => await GetApplicationCommandsAsync(options).ConfigureAwait(false);
}
}
diff --git a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
index 62019eab2..61e22ffaa 100644
--- a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
+++ b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
@@ -3599,6 +3599,9 @@
+
+
+
Represents a Websocket-based interaction type for Message Components.
@@ -3897,6 +3900,15 @@
A task that represents the asynchronous operation of acknowledging the interaction.
+
+
+
+
+
+
+
+
+
Represents a WebSocket-based invite to a guild.
diff --git a/src/Discord.Net.WebSocket/DiscordShardedClient.cs b/src/Discord.Net.WebSocket/DiscordShardedClient.cs
index 6847d8580..450145f1c 100644
--- a/src/Discord.Net.WebSocket/DiscordShardedClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordShardedClient.cs
@@ -30,7 +30,16 @@ namespace Discord.WebSocket
///
public override IActivity Activity { get => _shards[0].Activity; protected set { } }
- internal new DiscordSocketApiClient ApiClient => base.ApiClient as DiscordSocketApiClient;
+ internal new DiscordSocketApiClient ApiClient
+ {
+ get
+ {
+ if (base.ApiClient.CurrentUserId == null)
+ base.ApiClient.CurrentUserId = CurrentUser?.Id;
+
+ return base.ApiClient;
+ }
+ }
///
public override IReadOnlyCollection Guilds => GetGuilds().ToReadOnlyCollection(GetGuildCount);
///
diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
index c32bb3f49..5c385fe01 100644
--- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
+++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
@@ -1478,6 +1478,9 @@ namespace Discord.WebSocket
///
async Task> IGuild.GetWebhooksAsync(RequestOptions options)
=> await GetWebhooksAsync(options).ConfigureAwait(false);
+ ///
+ async Task> IGuild.GetApplicationCommandsAsync (RequestOptions options)
+ => await GetApplicationCommandsAsync(options).ConfigureAwait(false);
void IDisposable.Dispose()
{
diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs
index 11145fa2b..e7f5873d6 100644
--- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs
+++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs
@@ -173,5 +173,20 @@ namespace Discord.WebSocket
// Tokens last for 15 minutes according to https://discord.com/developers/docs/interactions/slash-commands#responding-to-an-interaction
return (DateTime.UtcNow - this.CreatedAt.UtcDateTime).TotalMinutes <= 15d;
}
+
+ // IDiscordInteraction
+
+ ///
+ async Task IDiscordInteraction.FollowupAsync (string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions,
+ RequestOptions options, MessageComponent component, Embed embed)
+ => await FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, options, component, embed).ConfigureAwait(false);
+
+ ///
+ async Task IDiscordInteraction.GetOriginalResponseAsync (RequestOptions options)
+ => await GetOriginalResponseAsync(options).ConfigureAwait(false);
+
+ ///
+ async Task IDiscordInteraction.ModifyOriginalResponseAsync (Action func, RequestOptions options)
+ => await ModifyOriginalResponseAsync(func, options).ConfigureAwait(false);
}
}