Browse Source

Merge remote-tracking branch 'origin/feature/interations' into release/3.x

pull/1923/head
quin lynch 3 years ago
parent
commit
6b01b69ae3
11 changed files with 223 additions and 25 deletions
  1. +74
    -9
      src/Discord.Net.Core/Discord.Net.Core.xml
  2. +10
    -0
      src/Discord.Net.Core/Entities/Guilds/IGuild.cs
  3. +1
    -8
      src/Discord.Net.Core/Entities/Interactions/IApplicationCommand.cs
  4. +54
    -0
      src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs
  5. +16
    -6
      src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs
  6. +13
    -0
      src/Discord.Net.Rest/Discord.Net.Rest.xml
  7. +15
    -1
      src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
  8. +12
    -0
      src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
  9. +10
    -1
      src/Discord.Net.WebSocket/DiscordShardedClient.cs
  10. +3
    -0
      src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
  11. +15
    -0
      src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs

+ 74
- 9
src/Discord.Net.Core/Discord.Net.Core.xml View File

@@ -3914,6 +3914,16 @@
A task that represents the asynchronous removal operation. A task that represents the asynchronous removal operation.
</returns> </returns>
</member> </member>
<member name="M:Discord.IGuild.GetApplicationCommandsAsync(Discord.RequestOptions)">
<summary>
Gets this guilds slash commands commands
</summary>
<param name="options">The options to be used when sending the request.</param>
<returns>
A task that represents the asynchronous get operation. The task result contains a read-only collection
of application commands found within the guild.
</returns>
</member>
<member name="T:Discord.IGuildIntegration"> <member name="T:Discord.IGuildIntegration">
<summary> <summary>
Holds information for a guild integration feature. 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. If the option is a subcommand or subcommand group type, this nested options will be the parameters.
</summary> </summary>
</member> </member>
<member name="M:Discord.IApplicationCommand.DeleteAsync(Discord.RequestOptions)">
<summary>
Deletes this command
</summary>
<param name="options">The options to be used when sending the request.</param>
<returns>A task that represents the asynchronous delete operation.</returns>
</member>
<member name="T:Discord.IApplicationCommandInteractionData"> <member name="T:Discord.IApplicationCommandInteractionData">
<summary> <summary>
Represents data of an Interaction Command, see <see href="https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondata"/>. Represents data of an Interaction Command, see <see href="https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondata"/>.
@@ -4644,6 +4647,58 @@
read-only property, always 1. read-only property, always 1.
</summary> </summary>
</member> </member>
<member name="M:Discord.IDiscordInteraction.RespondAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)">
<summary>
Responds to an Interaction with type <see cref="F:Discord.InteractionResponseType.ChannelMessageWithSource"/>.
</summary>
<param name="text">The text of the message to be sent.</param>
<param name="embeds">A array of embeds to send with this response. Max 10</param>
<param name="isTTS"><see langword="true"/> if the message should be read out by a text-to-speech reader, otherwise <see langword="false"/>.</param>
<param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
<param name="allowedMentions">The allowed mentions for this response.</param>
<param name="options">The request options for this response.</param>
<param name="component">A <see cref="T:Discord.MessageComponent"/> to be sent with this response</param>
<param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
</member>
<member name="M:Discord.IDiscordInteraction.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)">
<summary>
Sends a followup message for this interaction.
</summary>
<param name="text">The text of the message to be sent</param>
<param name="embeds">A array of embeds to send with this response. Max 10</param>
<param name="isTTS"><see langword="true"/> if the message should be read out by a text-to-speech reader, otherwise <see langword="false"/>.</param>
<param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
<param name="allowedMentions">The allowed mentions for this response.</param>
<param name="options">The request options for this response.</param>
<param name="component">A <see cref="T:Discord.MessageComponent"/> to be sent with this response</param>
<param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
<returns>
The sent message.
</returns>
</member>
<member name="M:Discord.IDiscordInteraction.GetOriginalResponseAsync(Discord.RequestOptions)">
<summary>
Gets the original response for this interaction.
</summary>
<param name="options">The request options for this async request.</param>
<returns>A <see cref="T:Discord.IUserMessage"/> that represents the initial response.</returns>
</member>
<member name="M:Discord.IDiscordInteraction.ModifyOriginalResponseAsync(System.Action{Discord.MessageProperties},Discord.RequestOptions)">
<summary>
Edits original response for this interaction.
</summary>
<param name="func">A delegate containing the properties to modify the message with.</param>
<param name="options">The request options for this async request.</param>
<returns>A <see cref="T:Discord.IUserMessage"/> that represents the initial response.</returns>
</member>
<member name="M:Discord.IDiscordInteraction.DeferAsync(Discord.RequestOptions)">
<summary>
Acknowledges this interaction.
</summary>
<returns>
A task that represents the asynchronous operation of acknowledging the interaction.
</returns>
</member>
<member name="T:Discord.IDiscordInteractionData"> <member name="T:Discord.IDiscordInteractionData">
<summary> <summary>
Represents an interface used to specify classes that they are a vaild dataype of a <see cref="T:Discord.IDiscordInteraction"/> class. Represents an interface used to specify classes that they are a vaild dataype of a <see cref="T:Discord.IDiscordInteraction"/> class.
@@ -4794,6 +4849,11 @@
Represents a builder for creating a <see cref="T:Discord.MessageComponent"/>. Represents a builder for creating a <see cref="T:Discord.MessageComponent"/>.
</summary> </summary>
</member> </member>
<member name="F:Discord.ComponentBuilder.MaxButtonLabelLength">
<summary>
The max length of a <see cref="P:Discord.ButtonComponent.Label"/>.
</summary>
</member>
<member name="F:Discord.ComponentBuilder.MaxCustomIdLength"> <member name="F:Discord.ComponentBuilder.MaxCustomIdLength">
<summary> <summary>
The max length of a <see cref="P:Discord.ButtonComponent.CustomId"/>. The max length of a <see cref="P:Discord.ButtonComponent.CustomId"/>.
@@ -4921,7 +4981,7 @@
<summary> <summary>
Gets or sets the label of the current button. Gets or sets the label of the current button.
</summary> </summary>
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.ButtonBuilder.Label"/> length exceeds <see cref="F:Discord.ButtonBuilder.MaxLabelLength"/>.</exception>
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.ButtonBuilder.Label"/> length exceeds <see cref="F:Discord.ComponentBuilder.MaxButtonLabelLength"/>.</exception>
</member> </member>
<member name="P:Discord.ButtonBuilder.CustomId"> <member name="P:Discord.ButtonBuilder.CustomId">
<summary> <summary>
@@ -5251,11 +5311,16 @@
The maximum length of a <see cref="P:Discord.SelectMenuOption.Description"/>. The maximum length of a <see cref="P:Discord.SelectMenuOption.Description"/>.
</summary> </summary>
</member> </member>
<member name="F:Discord.SelectMenuOptionBuilder.MaxSelectLabelLength">
<summary>
The maximum length of a <see cref="P:Discord.SelectMenuOption.Label"/>.
</summary>
</member>
<member name="P:Discord.SelectMenuOptionBuilder.Label"> <member name="P:Discord.SelectMenuOptionBuilder.Label">
<summary> <summary>
Gets or sets the label of the current select menu. Gets or sets the label of the current select menu.
</summary> </summary>
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuOptionBuilder.Label"/> length exceeds <see cref="F:Discord.SelectMenuOptionBuilder.MaxLabelLength"/></exception>
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuOptionBuilder.Label"/> length exceeds <see cref="F:Discord.SelectMenuOptionBuilder.MaxSelectLabelLength"/></exception>
</member> </member>
<member name="P:Discord.SelectMenuOptionBuilder.Value"> <member name="P:Discord.SelectMenuOptionBuilder.Value">
<summary> <summary>


+ 10
- 0
src/Discord.Net.Core/Entities/Guilds/IGuild.cs View File

@@ -941,5 +941,15 @@ namespace Discord
/// A task that represents the asynchronous removal operation. /// A task that represents the asynchronous removal operation.
/// </returns> /// </returns>
Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null); Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null);

/// <summary>
/// Gets this guilds slash commands commands
/// </summary>
/// <param name="options">The options to be used when sending the request.</param>
/// <returns>
/// A task that represents the asynchronous get operation. The task result contains a read-only collection
/// of application commands found within the guild.
/// </returns>
Task<IReadOnlyCollection<IApplicationCommand>> GetApplicationCommandsAsync (RequestOptions options = null);
} }
} }

+ 1
- 8
src/Discord.Net.Core/Entities/Interactions/IApplicationCommand.cs View File

@@ -9,7 +9,7 @@ namespace Discord
/// <summary> /// <summary>
/// The base command model that belongs to an application. see <see href="https://discord.com/developers/docs/interactions/slash-commands#applicationcommand"/> /// The base command model that belongs to an application. see <see href="https://discord.com/developers/docs/interactions/slash-commands#applicationcommand"/>
/// </summary> /// </summary>
public interface IApplicationCommand : ISnowflakeEntity
public interface IApplicationCommand : ISnowflakeEntity, IDeletable
{ {
/// <summary> /// <summary>
/// Gets the unique id of the parent application. /// 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. /// If the option is a subcommand or subcommand group type, this nested options will be the parameters.
/// </summary> /// </summary>
IReadOnlyCollection<IApplicationCommandOption> Options { get; } IReadOnlyCollection<IApplicationCommandOption> Options { get; }

/// <summary>
/// Deletes this command
/// </summary>
/// <param name="options">The options to be used when sending the request.</param>
/// <returns>A task that represents the asynchronous delete operation.</returns>
Task DeleteAsync(RequestOptions options = null);
} }
} }

+ 54
- 0
src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs View File

@@ -39,5 +39,59 @@ namespace Discord
/// read-only property, always 1. /// read-only property, always 1.
/// </summary> /// </summary>
int Version { get; } int Version { get; }

/// <summary>
/// Responds to an Interaction with type <see cref="InteractionResponseType.ChannelMessageWithSource"/>.
/// </summary>
/// <param name="text">The text of the message to be sent.</param>
/// <param name="embeds">A array of embeds to send with this response. Max 10</param>
/// <param name="isTTS"><see langword="true"/> if the message should be read out by a text-to-speech reader, otherwise <see langword="false"/>.</param>
/// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
/// <param name="allowedMentions">The allowed mentions for this response.</param>
/// <param name="options">The request options for this response.</param>
/// <param name="component">A <see cref="MessageComponent"/> to be sent with this response</param>
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
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);

/// <summary>
/// Sends a followup message for this interaction.
/// </summary>
/// <param name="text">The text of the message to be sent</param>
/// <param name="embeds">A array of embeds to send with this response. Max 10</param>
/// <param name="isTTS"><see langword="true"/> if the message should be read out by a text-to-speech reader, otherwise <see langword="false"/>.</param>
/// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
/// <param name="allowedMentions">The allowed mentions for this response.</param>
/// <param name="options">The request options for this response.</param>
/// <param name="component">A <see cref="MessageComponent"/> to be sent with this response</param>
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
/// <returns>
/// The sent message.
/// </returns>
Task<IUserMessage> 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);

/// <summary>
/// Gets the original response for this interaction.
/// </summary>
/// <param name="options">The request options for this async request.</param>
/// <returns>A <see cref="IUserMessage"/> that represents the initial response.</returns>
Task<IUserMessage> GetOriginalResponseAsync (RequestOptions options = null);

/// <summary>
/// Edits original response for this interaction.
/// </summary>
/// <param name="func">A delegate containing the properties to modify the message with.</param>
/// <param name="options">The request options for this async request.</param>
/// <returns>A <see cref="IUserMessage"/> that represents the initial response.</returns>
Task<IUserMessage> ModifyOriginalResponseAsync (Action<MessageProperties> func, RequestOptions options = null);

/// <summary>
/// Acknowledges this interaction.
/// </summary>
/// <returns>
/// A task that represents the asynchronous operation of acknowledging the interaction.
/// </returns>
Task DeferAsync (RequestOptions options = null);
} }
} }

+ 16
- 6
src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs View File

@@ -10,6 +10,11 @@ namespace Discord
/// </summary> /// </summary>
public class ComponentBuilder public class ComponentBuilder
{ {
/// <summary>
/// The max length of a <see cref="ButtonComponent.Label"/>.
/// </summary>
public const int MaxButtonLabelLength = 80;

/// <summary> /// <summary>
/// The max length of a <see cref="ButtonComponent.CustomId"/>. /// The max length of a <see cref="ButtonComponent.CustomId"/>.
/// </summary> /// </summary>
@@ -310,14 +315,14 @@ namespace Discord
/// <summary> /// <summary>
/// Gets or sets the label of the current button. /// Gets or sets the label of the current button.
/// </summary> /// </summary>
/// <exception cref="ArgumentException" accessor="set"><see cref="Label"/> length exceeds <see cref="MaxLabelLength"/>.</exception>
/// <exception cref="ArgumentException" accessor="set"><see cref="Label"/> length exceeds <see cref="ComponentBuilder.MaxButtonLabelLength"/>.</exception>
public string Label public string Label
{ {
get => _label; get => _label;
set 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; _label = value;
} }
@@ -840,19 +845,24 @@ namespace Discord
/// The maximum length of a <see cref="SelectMenuOption.Description"/>. /// The maximum length of a <see cref="SelectMenuOption.Description"/>.
/// </summary> /// </summary>
public const int MaxDescriptionLength = 100; public const int MaxDescriptionLength = 100;
/// <summary>
/// The maximum length of a <see cref="SelectMenuOption.Label"/>.
/// </summary>
public const int MaxSelectLabelLength = 100;


/// <summary> /// <summary>
/// Gets or sets the label of the current select menu. /// Gets or sets the label of the current select menu.
/// </summary> /// </summary>
/// <exception cref="ArgumentException" accessor="set"><see cref="Label"/> length exceeds <see cref="MaxLabelLength"/></exception>
/// <exception cref="ArgumentException" accessor="set"><see cref="Label"/> length exceeds <see cref="MaxSelectLabelLength"/></exception>
public string Label public string Label
{ {
get => _label; get => _label;
set set
{ {
if (value != null) 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; _label = value;
} }


+ 13
- 0
src/Discord.Net.Rest/Discord.Net.Rest.xml View File

@@ -3493,6 +3493,16 @@
of webhooks found within the guild. of webhooks found within the guild.
</returns> </returns>
</member> </member>
<member name="M:Discord.Rest.RestGuild.GetApplicationCommandsAsync(Discord.RequestOptions)">
<summary>
Gets this guilds slash commands commands
</summary>
<param name="options">The options to be used when sending the request.</param>
<returns>
A task that represents the asynchronous get operation. The task result contains a read-only collection
of application commands found within the guild.
</returns>
</member>
<member name="M:Discord.Rest.RestGuild.ToString"> <member name="M:Discord.Rest.RestGuild.ToString">
<summary> <summary>
Returns the name of the guild. Returns the name of the guild.
@@ -3650,6 +3660,9 @@
<member name="M:Discord.Rest.RestGuild.Discord#IGuild#GetWebhooksAsync(Discord.RequestOptions)"> <member name="M:Discord.Rest.RestGuild.Discord#IGuild#GetWebhooksAsync(Discord.RequestOptions)">
<inheritdoc /> <inheritdoc />
</member> </member>
<member name="M:Discord.Rest.RestGuild.Discord#IGuild#GetApplicationCommandsAsync(Discord.RequestOptions)">
<inheritdoc />
</member>
<member name="P:Discord.Rest.RestGuildIntegration.Name"> <member name="P:Discord.Rest.RestGuildIntegration.Name">
<inheritdoc /> <inheritdoc />
</member> </member>


+ 15
- 1
src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs View File

@@ -869,6 +869,18 @@ namespace Discord.Rest
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null) public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null)
=> GuildHelper.GetWebhooksAsync(this, Discord, options); => GuildHelper.GetWebhooksAsync(this, Discord, options);


//Interactions
/// <summary>
/// Gets this guilds slash commands commands
/// </summary>
/// <param name="options">The options to be used when sending the request.</param>
/// <returns>
/// A task that represents the asynchronous get operation. The task result contains a read-only collection
/// of application commands found within the guild.
/// </returns>
public async Task<IReadOnlyCollection<RestApplicationCommand>> GetApplicationCommandsAsync (RequestOptions options = null)
=> await ClientHelper.GetGuildApplicationCommands(Discord, Id, options).ConfigureAwait(false);

/// <summary> /// <summary>
/// Returns the name of the guild. /// Returns the name of the guild.
/// </summary> /// </summary>
@@ -1154,6 +1166,8 @@ namespace Discord.Rest
/// <inheritdoc /> /// <inheritdoc />
async Task<IReadOnlyCollection<IWebhook>> IGuild.GetWebhooksAsync(RequestOptions options) async Task<IReadOnlyCollection<IWebhook>> IGuild.GetWebhooksAsync(RequestOptions options)
=> await GetWebhooksAsync(options).ConfigureAwait(false); => await GetWebhooksAsync(options).ConfigureAwait(false);
/// <inheritdoc />
async Task<IReadOnlyCollection<IApplicationCommand>> IGuild.GetApplicationCommandsAsync (RequestOptions options)
=> await GetApplicationCommandsAsync(options).ConfigureAwait(false);
} }
} }

+ 12
- 0
src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml View File

@@ -3599,6 +3599,9 @@
<member name="M:Discord.WebSocket.SocketGuild.Discord#IGuild#GetWebhooksAsync(Discord.RequestOptions)"> <member name="M:Discord.WebSocket.SocketGuild.Discord#IGuild#GetWebhooksAsync(Discord.RequestOptions)">
<inheritdoc /> <inheritdoc />
</member> </member>
<member name="M:Discord.WebSocket.SocketGuild.Discord#IGuild#GetApplicationCommandsAsync(Discord.RequestOptions)">
<inheritdoc />
</member>
<member name="T:Discord.WebSocket.SocketMessageComponent"> <member name="T:Discord.WebSocket.SocketMessageComponent">
<summary> <summary>
Represents a Websocket-based interaction type for Message Components. Represents a Websocket-based interaction type for Message Components.
@@ -3897,6 +3900,15 @@
A task that represents the asynchronous operation of acknowledging the interaction. A task that represents the asynchronous operation of acknowledging the interaction.
</returns> </returns>
</member> </member>
<member name="M:Discord.WebSocket.SocketInteraction.Discord#IDiscordInteraction#FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)">
<inheritdoc/>
</member>
<member name="M:Discord.WebSocket.SocketInteraction.Discord#IDiscordInteraction#GetOriginalResponseAsync(Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="M:Discord.WebSocket.SocketInteraction.Discord#IDiscordInteraction#ModifyOriginalResponseAsync(System.Action{Discord.MessageProperties},Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="T:Discord.WebSocket.SocketInvite"> <member name="T:Discord.WebSocket.SocketInvite">
<summary> <summary>
Represents a WebSocket-based invite to a guild. Represents a WebSocket-based invite to a guild.


+ 10
- 1
src/Discord.Net.WebSocket/DiscordShardedClient.cs View File

@@ -30,7 +30,16 @@ namespace Discord.WebSocket
/// <inheritdoc /> /// <inheritdoc />
public override IActivity Activity { get => _shards[0].Activity; protected set { } } 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;
}
}
/// <inheritdoc /> /// <inheritdoc />
public override IReadOnlyCollection<SocketGuild> Guilds => GetGuilds().ToReadOnlyCollection(GetGuildCount); public override IReadOnlyCollection<SocketGuild> Guilds => GetGuilds().ToReadOnlyCollection(GetGuildCount);
/// <inheritdoc /> /// <inheritdoc />


+ 3
- 0
src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs View File

@@ -1478,6 +1478,9 @@ namespace Discord.WebSocket
/// <inheritdoc /> /// <inheritdoc />
async Task<IReadOnlyCollection<IWebhook>> IGuild.GetWebhooksAsync(RequestOptions options) async Task<IReadOnlyCollection<IWebhook>> IGuild.GetWebhooksAsync(RequestOptions options)
=> await GetWebhooksAsync(options).ConfigureAwait(false); => await GetWebhooksAsync(options).ConfigureAwait(false);
/// <inheritdoc />
async Task<IReadOnlyCollection<IApplicationCommand>> IGuild.GetApplicationCommandsAsync (RequestOptions options)
=> await GetApplicationCommandsAsync(options).ConfigureAwait(false);


void IDisposable.Dispose() void IDisposable.Dispose()
{ {


+ 15
- 0
src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs View File

@@ -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 // 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; return (DateTime.UtcNow - this.CreatedAt.UtcDateTime).TotalMinutes <= 15d;
} }

// IDiscordInteraction

/// <inheritdoc/>
async Task<IUserMessage> 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);

/// <inheritdoc/>
async Task<IUserMessage> IDiscordInteraction.GetOriginalResponseAsync (RequestOptions options)
=> await GetOriginalResponseAsync(options).ConfigureAwait(false);

/// <inheritdoc/>
async Task<IUserMessage> IDiscordInteraction.ModifyOriginalResponseAsync (Action<MessageProperties> func, RequestOptions options)
=> await ModifyOriginalResponseAsync(func, options).ConfigureAwait(false);
} }
} }

Loading…
Cancel
Save