diff --git a/src/Discord.Net.Core/Discord.Net.Core.xml b/src/Discord.Net.Core/Discord.Net.Core.xml index 1ab7ab78d..dfbb2fc50 100644 --- a/src/Discord.Net.Core/Discord.Net.Core.xml +++ b/src/Discord.Net.Core/Discord.Net.Core.xml @@ -3723,6 +3723,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. @@ -4293,13 +4303,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 . @@ -4433,6 +4436,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. @@ -4583,7 +4638,7 @@ Represents a builder for creating a . - + The max length of a . @@ -4710,7 +4765,7 @@ Gets or sets the label of the current button. - length exceeds . + length exceeds . @@ -5035,11 +5090,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 @@ -7554,10 +7614,38 @@ The message for when a news channel subscription is added to a text channel. + + + The message for when a guild is disqualified from discovery. + + + + + The message for when a guild is requalified for discovery. + + + + + The message for when the initial warning is sent for the initial grace period discovery. + + + + + The message for when the final warning is sent for the initial grace period discovery. + + + + + The message for when a thread is created. + + The message is an inline reply. + + Only available in API v8 + @@ -7567,6 +7655,19 @@ Only available in API v8 + + + The message that starts a thread. + + + Only available in API v9 + + + + + The message for a invite reminder + + A metadata containing reaction information. diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs index b8fd858df..fb26bdd36 100644 --- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs +++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs @@ -892,5 +892,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.Rest/Discord.Net.Rest.xml b/src/Discord.Net.Rest/Discord.Net.Rest.xml index eda180f01..a9630f382 100644 --- a/src/Discord.Net.Rest/Discord.Net.Rest.xml +++ b/src/Discord.Net.Rest/Discord.Net.Rest.xml @@ -3403,6 +3403,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. @@ -3548,6 +3558,9 @@ + + + diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs index 37491909c..9c6f6011e 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs @@ -808,6 +808,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. /// @@ -1061,5 +1073,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 b17f73024..72ec97e58 100644 --- a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml +++ b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml @@ -3477,6 +3477,9 @@ + + + Represents a Websocket-based interaction type for Message Components. @@ -3492,7 +3495,7 @@ The message that contained the trigger for this interaction. - + @@ -3503,7 +3506,7 @@ The request options for this async request. A task that represents the asynchronous operation of updating the message. - + @@ -3619,10 +3622,10 @@ The data associated with this interaction. - + - + @@ -3708,12 +3711,12 @@ if the token is valid for replying to, otherwise . - + Responds to an Interaction with type . If you have set to , You should use - instead. + instead. The text of the message to be sent. @@ -3723,10 +3726,11 @@ 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. Message content is too long, length must be less or equal to . The parameters provided were invalid or the token was invalid. - + Sends a followup message for this interaction. @@ -3737,6 +3741,7 @@ 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. @@ -3772,6 +3777,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/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs index f720db018..ce188e707 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs @@ -1436,6 +1436,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 4b2e3baec..5547fed1e 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs @@ -171,5 +171,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); } }