@@ -7,6 +7,8 @@ | |||||
<Description>A Discord.Net extension adding support for bot commands.</Description> | <Description>A Discord.Net extension adding support for bot commands.</Description> | ||||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks> | <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks> | ||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks> | <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks> | ||||
<WarningLevel>5</WarningLevel> | |||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | <ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | ||||
@@ -1,4 +1,4 @@ | |||||
using System; | |||||
using System; | |||||
namespace Discord.Commands | namespace Discord.Commands | ||||
{ | { | ||||
@@ -12,7 +12,7 @@ namespace Discord.Commands | |||||
/// <summary> | /// <summary> | ||||
/// Gets on which pipeline stage the command may have matched or failed. | /// Gets on which pipeline stage the command may have matched or failed. | ||||
/// </summary> | /// </summary> | ||||
public IResult? Pipeline { get; } | |||||
public IResult Pipeline { get; } | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public CommandError? Error { get; } | public CommandError? Error { get; } | ||||
@@ -21,7 +21,7 @@ namespace Discord.Commands | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public bool IsSuccess => !Error.HasValue; | public bool IsSuccess => !Error.HasValue; | ||||
private MatchResult(CommandMatch? match, IResult? pipeline, CommandError? error, string errorReason) | |||||
private MatchResult(CommandMatch? match, IResult pipeline, CommandError? error, string errorReason) | |||||
{ | { | ||||
Match = match; | Match = match; | ||||
Error = error; | Error = error; | ||||
@@ -7,6 +7,8 @@ | |||||
<Description>The core components for the Discord.Net library.</Description> | <Description>The core components for the Discord.Net library.</Description> | ||||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks> | <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks> | ||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks> | <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks> | ||||
<WarningLevel>5</WarningLevel> | |||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||||
@@ -1173,7 +1173,6 @@ namespace Discord | |||||
/// in order to use this property. | /// in order to use this property. | ||||
/// </remarks> | /// </remarks> | ||||
/// </param> | /// </param> | ||||
/// <param name="speakers">A collection of speakers for the event.</param> | |||||
/// <param name="location">The location of the event; links are supported</param> | /// <param name="location">The location of the event; links are supported</param> | ||||
/// <param name="coverImage">The optional banner image for the event.</param> | /// <param name="coverImage">The optional banner image for the event.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
@@ -89,7 +89,7 @@ namespace Discord | |||||
/// Gets this events banner image url. | /// Gets this events banner image url. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="format">The format to return.</param> | /// <param name="format">The format to return.</param> | ||||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048. | |||||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048.</param> | |||||
/// <returns>The cover images url.</returns> | /// <returns>The cover images url.</returns> | ||||
string GetCoverImageUrl(ImageFormat format = ImageFormat.Auto, ushort size = 1024); | string GetCoverImageUrl(ImageFormat format = ImageFormat.Auto, ushort size = 1024); | ||||
@@ -56,7 +56,7 @@ namespace Discord | |||||
Number = 10, | Number = 10, | ||||
/// <summary> | /// <summary> | ||||
/// A <see cref="Discord.Attachment"/>. | |||||
/// A <see cref="IAttachment"/>. | |||||
/// </summary> | /// </summary> | ||||
Attachment = 11 | Attachment = 11 | ||||
} | } | ||||
@@ -55,7 +55,7 @@ namespace Discord | |||||
string UserLocale { get; } | string UserLocale { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the preferred locale of the guild this interaction was executed in. <see cref="null"/> if not executed in a guild. | |||||
/// Gets the preferred locale of the guild this interaction was executed in. <see langword="null"/> if not executed in a guild. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// Non-community guilds (With no locale setting available) will have en-US as the default value sent by Discord. | /// Non-community guilds (With no locale setting available) will have en-US as the default value sent by Discord. | ||||
@@ -1194,9 +1194,9 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Gets or sets the default value of the text input. | /// Gets or sets the default value of the text input. | ||||
/// </summary> | /// </summary> | ||||
/// <exception cref="ArgumentOutOfRangeException"><see cref="Value.Length"/> is less than 0.</exception> | |||||
/// <exception cref="ArgumentOutOfRangeException"><see cref="Value"/>.Length is less than 0.</exception> | |||||
/// <exception cref="ArgumentOutOfRangeException"> | /// <exception cref="ArgumentOutOfRangeException"> | ||||
/// <see cref="Value.Length"/> is greater than <see cref="LargestMaxLength"/> or <see cref="MaxLength"/>. | |||||
/// <see cref="Value"/>.Length is greater than <see cref="LargestMaxLength"/> or <see cref="MaxLength"/>. | |||||
/// </exception> | /// </exception> | ||||
public string Value | public string Value | ||||
{ | { | ||||
@@ -1306,18 +1306,18 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Sets the minimum length of the current builder. | /// Sets the minimum length of the current builder. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="placeholder">The value to set.</param> | |||||
/// <param name="minLength">The value to set.</param> | |||||
/// <returns>The current builder. </returns> | /// <returns>The current builder. </returns> | ||||
public TextInputBuilder WithMinLength(int minLength) | public TextInputBuilder WithMinLength(int minLength) | ||||
{ | { | ||||
MinLength = minLength; | MinLength = minLength; | ||||
return this; | return this; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Sets the maximum length of the current builder. | /// Sets the maximum length of the current builder. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="placeholder">The value to set.</param> | |||||
/// <param name="maxLength">The value to set.</param> | |||||
/// <returns>The current builder. </returns> | /// <returns>The current builder. </returns> | ||||
public TextInputBuilder WithMaxLength(int maxLength) | public TextInputBuilder WithMaxLength(int maxLength) | ||||
{ | { | ||||
@@ -64,18 +64,18 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Sets the custom id of the current modal. | /// Sets the custom id of the current modal. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="title">The value to set the custom id to.</param> | |||||
/// <param name="customId">The value to set the custom id to.</param> | |||||
/// <returns>The current builder.</returns> | /// <returns>The current builder.</returns> | ||||
public ModalBuilder WithCustomId(string customId) | public ModalBuilder WithCustomId(string customId) | ||||
{ | { | ||||
CustomId = customId; | CustomId = customId; | ||||
return this; | return this; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Adds a component to the current builder. | /// Adds a component to the current builder. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="title">The component to add.</param> | |||||
/// <param name="component">The component to add.</param> | |||||
/// <returns>The current builder.</returns> | /// <returns>The current builder.</returns> | ||||
public ModalBuilder AddTextInput(TextInputBuilder component) | public ModalBuilder AddTextInput(TextInputBuilder component) | ||||
{ | { | ||||
@@ -213,7 +213,7 @@ namespace Discord | |||||
/// Adds a <see cref="TextInputBuilder"/> to the <see cref="ModalComponentBuilder"/> at the specific row. | /// Adds a <see cref="TextInputBuilder"/> to the <see cref="ModalComponentBuilder"/> at the specific row. | ||||
/// If the row cannot accept the component then it will add it to a row that can. | /// If the row cannot accept the component then it will add it to a row that can. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="text">The <see cref="TextInputBuilder"> to add.</param> | |||||
/// <param name="text">The <see cref="TextInputBuilder"/> to add.</param> | |||||
/// <param name="row">The row to add the text input.</param> | /// <param name="row">The row to add the text input.</param> | ||||
/// <exception cref="InvalidOperationException">There are no more rows to add a text input to.</exception> | /// <exception cref="InvalidOperationException">There are no more rows to add a text input to.</exception> | ||||
/// <exception cref="ArgumentException"><paramref name="row"/> must be less than <see cref="MaxActionRowCount"/>.</exception> | /// <exception cref="ArgumentException"><paramref name="row"/> must be less than <see cref="MaxActionRowCount"/>.</exception> | ||||
@@ -79,7 +79,7 @@ namespace Discord | |||||
/// Sets a timestamp how long a user should be timed out for. | /// Sets a timestamp how long a user should be timed out for. | ||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// <see cref="null"/> or a time in the past to clear a currently existing timeout. | |||||
/// <see langword="null"/> or a time in the past to clear a currently existing timeout. | |||||
/// </remarks> | /// </remarks> | ||||
public Optional<DateTimeOffset?> TimedOutUntil { get; set; } | public Optional<DateTimeOffset?> TimedOutUntil { get; set; } | ||||
} | } | ||||
@@ -104,7 +104,7 @@ namespace Discord | |||||
/// Gets the date and time that indicates if and for how long a user has been timed out. | /// Gets the date and time that indicates if and for how long a user has been timed out. | ||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// <see cref="null"/> or a timestamp in the past if the user is not timed out. | |||||
/// <see langword="null"/> or a timestamp in the past if the user is not timed out. | |||||
/// </remarks> | /// </remarks> | ||||
/// <returns> | /// <returns> | ||||
/// A <see cref="DateTimeOffset"/> indicating how long the user will be timed out for. | /// A <see cref="DateTimeOffset"/> indicating how long the user will be timed out for. | ||||
@@ -116,7 +116,7 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
/// <example> | /// <example> | ||||
/// <para>The following example checks if the current user has the ability to send a message with attachment in | /// <para>The following example checks if the current user has the ability to send a message with attachment in | ||||
/// this channel; if so, uploads a file via <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference)"/>.</para> | |||||
/// this channel; if so, uploads a file via <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>.</para> | |||||
/// <code language="cs"> | /// <code language="cs"> | ||||
/// if (currentUser?.GetPermissions(targetChannel)?.AttachFiles) | /// if (currentUser?.GetPermissions(targetChannel)?.AttachFiles) | ||||
/// await targetChannel.SendFileAsync("fortnite.png"); | /// await targetChannel.SendFileAsync("fortnite.png"); | ||||
@@ -151,7 +151,7 @@ namespace Discord | |||||
/// If the user does not have a guild avatar, this will be the user's regular avatar. | /// If the user does not have a guild avatar, this will be the user's regular avatar. | ||||
/// </remarks> | /// </remarks> | ||||
/// <param name="format">The format to return.</param> | /// <param name="format">The format to return.</param> | ||||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048. | |||||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048.</param> | |||||
/// <returns> | /// <returns> | ||||
/// A string representing the URL of the displayed avatar for this user. <see langword="null"/> if the user does not have an avatar in place. | /// A string representing the URL of the displayed avatar for this user. <see langword="null"/> if the user does not have an avatar in place. | ||||
/// </returns> | /// </returns> | ||||
@@ -23,7 +23,7 @@ namespace Discord.Utils | |||||
/// <summary> | /// <summary> | ||||
/// Not full URL validation right now. Just Ensures the protocol is either http, https, or discord | /// Not full URL validation right now. Just Ensures the protocol is either http, https, or discord | ||||
/// <see cref="Validate(string)"/> should be used everything other than url buttons. | |||||
/// <see cref="Validate(string, bool)"/> should be used everything other than url buttons. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="url">The URL to validate before sending to discord.</param> | /// <param name="url">The URL to validate before sending to discord.</param> | ||||
/// <exception cref="InvalidOperationException">A URL must include a protocol (either http, https, or discord).</exception> | /// <exception cref="InvalidOperationException">A URL must include a protocol (either http, https, or discord).</exception> | ||||
@@ -3,7 +3,7 @@ using System; | |||||
namespace Discord.Interactions | namespace Discord.Interactions | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Set the <see cref="ApplicationCommandOptionProperties.Autocomplete"/> to <see langword="true"/>. | |||||
/// Set the <see cref="ApplicationCommandOptionProperties.IsAutocomplete"/> to <see langword="true"/>. | |||||
/// </summary> | /// </summary> | ||||
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] | [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] | ||||
public class AutocompleteAttribute : Attribute | public class AutocompleteAttribute : Attribute | ||||
@@ -14,7 +14,7 @@ namespace Discord.Interactions | |||||
public Type AutocompleteHandlerType { get; } | public Type AutocompleteHandlerType { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Set the <see cref="ApplicationCommandOptionProperties.Autocomplete"/> to <see langword="true"/> and define a <see cref="AutocompleteHandler"/> to handle | |||||
/// Set the <see cref="ApplicationCommandOptionProperties.IsAutocomplete"/> to <see langword="true"/> and define a <see cref="AutocompleteHandler"/> to handle | |||||
/// Autocomplete interactions targeting the parameter this <see cref="Attribute"/> is applied to. | /// Autocomplete interactions targeting the parameter this <see cref="Attribute"/> is applied to. | ||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
@@ -29,7 +29,7 @@ namespace Discord.Interactions | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Set the <see cref="ApplicationCommandOptionProperties.Autocomplete"/> to <see langword="true"/> without specifying a <see cref="AutocompleteHandler"/>. | |||||
/// Set the <see cref="ApplicationCommandOptionProperties.IsAutocomplete"/> to <see langword="true"/> without specifying a <see cref="AutocompleteHandler"/>. | |||||
/// </summary> | /// </summary> | ||||
public AutocompleteAttribute() { } | public AutocompleteAttribute() { } | ||||
} | } | ||||
@@ -21,9 +21,7 @@ namespace Discord.Interactions | |||||
/// <summary> | /// <summary> | ||||
/// Create a new <see cref="ModalInputAttribute"/>. | /// Create a new <see cref="ModalInputAttribute"/>. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="label">The label of the input.</param> | |||||
/// <param name="customId">The custom id of the input.</param> | /// <param name="customId">The custom id of the input.</param> | ||||
/// <param name="required">Whether the user is required to input a value.></param> | |||||
protected ModalInputAttribute(string customId) | protected ModalInputAttribute(string customId) | ||||
{ | { | ||||
CustomId = customId; | CustomId = customId; | ||||
@@ -36,7 +36,7 @@ namespace Discord.Interactions | |||||
/// <summary> | /// <summary> | ||||
/// Create a new <see cref="ModalTextInputAttribute"/>. | /// Create a new <see cref="ModalTextInputAttribute"/>. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="customId"The custom id of the text input.></param> | |||||
/// <param name="customId">The custom id of the text input.></param> | |||||
/// <param name="style">The style of the text input.</param> | /// <param name="style">The style of the text input.</param> | ||||
/// <param name="placeholder">The placeholder of the text input.</param> | /// <param name="placeholder">The placeholder of the text input.</param> | ||||
/// <param name="minLength">The minimum length of the text input's content.</param> | /// <param name="minLength">The minimum length of the text input's content.</param> | ||||
@@ -29,7 +29,7 @@ namespace Discord.Interactions | |||||
/// <remarks> | /// <remarks> | ||||
/// This precondition will always fail if the command is being invoked in a <see cref="IPrivateChannel"/>. | /// This precondition will always fail if the command is being invoked in a <see cref="IPrivateChannel"/>. | ||||
/// </remarks> | /// </remarks> | ||||
/// <param name="permission"> | |||||
/// <param name="guildPermission"> | |||||
/// The <see cref="Discord.GuildPermission" /> that the user must have. Multiple permissions can be | /// The <see cref="Discord.GuildPermission" /> that the user must have. Multiple permissions can be | ||||
/// specified by ORing the permissions together. | /// specified by ORing the permissions together. | ||||
/// </param> | /// </param> | ||||
@@ -41,7 +41,7 @@ namespace Discord.Interactions | |||||
/// <summary> | /// <summary> | ||||
/// Requires that the user invoking the command to have a specific <see cref="Discord.ChannelPermission"/>. | /// Requires that the user invoking the command to have a specific <see cref="Discord.ChannelPermission"/>. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="permission"> | |||||
/// <param name="channelPermission"> | |||||
/// The <see cref="Discord.ChannelPermission"/> that the user must have. Multiple permissions can be | /// The <see cref="Discord.ChannelPermission"/> that the user must have. Multiple permissions can be | ||||
/// specified by ORing the permissions together. | /// specified by ORing the permissions together. | ||||
/// </param> | /// </param> | ||||
@@ -56,7 +56,7 @@ namespace Discord.Interactions.Builders | |||||
/// <summary> | /// <summary> | ||||
/// Sets <see cref="DefaultPermission"/>. | /// Sets <see cref="DefaultPermission"/>. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="defaultPermision">New value of the <see cref="DefaultPermission"/>.</param> | |||||
/// <param name="permission">New value of the <see cref="DefaultPermission"/>.</param> | |||||
/// <returns> | /// <returns> | ||||
/// The builder instance. | /// The builder instance. | ||||
/// </returns> | /// </returns> | ||||
@@ -41,7 +41,7 @@ namespace Discord.Interactions.Builders | |||||
/// <summary> | /// <summary> | ||||
/// Sets <see cref="Style"/>. | /// Sets <see cref="Style"/>. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="style">New value of the <see cref="SetValue(string)"/>.</param> | |||||
/// <param name="style">New value of the <see cref="Style"/>.</param> | |||||
/// <returns> | /// <returns> | ||||
/// The builder instance. | /// The builder instance. | ||||
/// </returns> | /// </returns> | ||||
@@ -64,7 +64,7 @@ namespace Discord.Interactions.Builders | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Adds text components to <see cref="TextComponents"/>. | |||||
/// Adds text components to <see cref="Components"/>. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="configure">Text Component builder factory.</param> | /// <param name="configure">Text Component builder factory.</param> | ||||
/// <returns> | /// <returns> | ||||
@@ -357,7 +357,8 @@ namespace Discord.Interactions.Builders | |||||
return this; | return this; | ||||
} | } | ||||
/// <summary> | |||||
/// Adds a modal command builder to <see cref="ModalCommands"/>. | /// Adds a modal command builder to <see cref="ModalCommands"/>. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="configure"><see cref="ModalCommands"/> factory.</param> | /// <param name="configure"><see cref="ModalCommands"/> factory.</param> | ||||
@@ -122,7 +122,7 @@ namespace Discord.Interactions.Builders | |||||
/// <summary> | /// <summary> | ||||
/// Adds preconditions to <see cref="Preconditions"/> | /// Adds preconditions to <see cref="Preconditions"/> | ||||
/// </summary> | /// </summary> | ||||
/// <param name="preconditions">New attributes to be added to <see cref="Preconditions"/>.</param> | |||||
/// <param name="attributes">New attributes to be added to <see cref="Preconditions"/>.</param> | |||||
/// <returns> | /// <returns> | ||||
/// The builder instance. | /// The builder instance. | ||||
/// </returns> | /// </returns> | ||||
@@ -7,8 +7,10 @@ | |||||
<RootNamespace>Discord.Interactions</RootNamespace> | <RootNamespace>Discord.Interactions</RootNamespace> | ||||
<AssemblyName>Discord.Net.Interactions</AssemblyName> | <AssemblyName>Discord.Net.Interactions</AssemblyName> | ||||
<Description>A Discord.Net extension adding support for Application Commands.</Description> | <Description>A Discord.Net extension adding support for Application Commands.</Description> | ||||
<WarningLevel>5</WarningLevel> | |||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | <ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | ||||
<ProjectReference Include="..\Discord.Net.Rest\Discord.Net.Rest.csproj" /> | <ProjectReference Include="..\Discord.Net.Rest\Discord.Net.Rest.csproj" /> | ||||
@@ -24,8 +24,7 @@ namespace Discord.Interactions | |||||
/// </summary> | /// </summary> | ||||
/// <param name="client">The underlying client.</param> | /// <param name="client">The underlying client.</param> | ||||
/// <param name="interaction">The underlying interaction.</param> | /// <param name="interaction">The underlying interaction.</param> | ||||
/// <param name="user"><see cref="IUser"/> who executed the command.</param> | |||||
/// <param name="channel"><see cref="ISocketMessageChannel"/> the command originated from.</param> | |||||
/// <param name="channel"><see cref="IMessageChannel"/> the command originated from.</param> | |||||
public InteractionContext(IDiscordClient client, IDiscordInteraction interaction, IMessageChannel channel = null) | public InteractionContext(IDiscordClient client, IDiscordInteraction interaction, IMessageChannel channel = null) | ||||
{ | { | ||||
Client = client; | Client = client; | ||||
@@ -45,7 +45,7 @@ namespace Discord.Interactions | |||||
protected virtual async Task DeferAsync(bool ephemeral = false, RequestOptions options = null) => | protected virtual async Task DeferAsync(bool ephemeral = false, RequestOptions options = null) => | ||||
await Context.Interaction.DeferAsync(ephemeral, options).ConfigureAwait(false); | await Context.Interaction.DeferAsync(ephemeral, options).ConfigureAwait(false); | ||||
/// <inheritdoc cref="IDiscordInteraction.RespondAsync(string, Embed[], bool, bool, AllowedMentions, RequestOptions, MessageComponent, Embed)"/> | |||||
/// <inheritdoc cref="IDiscordInteraction.RespondAsync(string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/> | |||||
protected virtual async Task RespondAsync (string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, | protected virtual async Task RespondAsync (string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, | ||||
AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null) => | AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null) => | ||||
await Context.Interaction.RespondAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false); | await Context.Interaction.RespondAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false); | ||||
@@ -70,7 +70,7 @@ namespace Discord.Interactions | |||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null) | AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null) | ||||
=> Context.Interaction.RespondWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options); | => Context.Interaction.RespondWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options); | ||||
/// <inheritdoc cref="IDiscordInteraction.FollowupAsync(string, Embed[], bool, bool, AllowedMentions, RequestOptions, MessageComponent, Embed)"/> | |||||
/// <inheritdoc cref="IDiscordInteraction.FollowupAsync(string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/> | |||||
protected virtual async Task<IUserMessage> FollowupAsync (string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, | protected virtual async Task<IUserMessage> FollowupAsync (string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, | ||||
AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null) => | AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null) => | ||||
await Context.Interaction.FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false); | await Context.Interaction.FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false); | ||||
@@ -95,7 +95,7 @@ namespace Discord.Interactions | |||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null) | AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null) | ||||
=> Context.Interaction.FollowupWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options); | => Context.Interaction.FollowupWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options); | ||||
/// <inheritdoc cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[])"/> | |||||
/// <inheritdoc cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/> | |||||
protected virtual async Task<IUserMessage> ReplyAsync (string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, | protected virtual async Task<IUserMessage> ReplyAsync (string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, | ||||
AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null) => | AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null) => | ||||
await Context.Channel.SendMessageAsync(text, false, embed, options, allowedMentions, messageReference, components).ConfigureAwait(false); | await Context.Channel.SendMessageAsync(text, false, embed, options, allowedMentions, messageReference, components).ConfigureAwait(false); | ||||
@@ -118,9 +118,9 @@ namespace Discord.Interactions | |||||
/// <inheritdoc cref="IDiscordInteraction.RespondWithModalAsync(Modal, RequestOptions)"/> | /// <inheritdoc cref="IDiscordInteraction.RespondWithModalAsync(Modal, RequestOptions)"/> | ||||
protected virtual async Task RespondWithModalAsync(Modal modal, RequestOptions options = null) => await Context.Interaction.RespondWithModalAsync(modal); | protected virtual async Task RespondWithModalAsync(Modal modal, RequestOptions options = null) => await Context.Interaction.RespondWithModalAsync(modal); | ||||
/// <inheritdoc cref="IDiscordInteractionExtentions.RespondWithModalAsync(IDiscordInteraction, IModal, RequestOptions)"/> | |||||
protected virtual async Task RespondWithModalAsync<T>(string customId, RequestOptions options = null) where T : class, IModal | |||||
=> await Context.Interaction.RespondWithModalAsync<T>(customId, options); | |||||
/// <inheritdoc cref="IDiscordInteractionExtentions.RespondWithModalAsync{T}(IDiscordInteraction, string, RequestOptions, Action{ModalBuilder})"/> | |||||
protected virtual async Task RespondWithModalAsync<TModal>(string customId, RequestOptions options = null) where TModal : class, IModal | |||||
=> await Context.Interaction.RespondWithModalAsync<TModal>(customId, options); | |||||
//IInteractionModuleBase | //IInteractionModuleBase | ||||
@@ -421,7 +421,7 @@ namespace Discord.Interactions | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// Commands will be registered as standalone commands, if you want the <see cref="GroupAttribute"/> to take effect, | /// Commands will be registered as standalone commands, if you want the <see cref="GroupAttribute"/> to take effect, | ||||
/// use <see cref="AddModulesToGuildAsync(IGuild, ModuleInfo[])"/>. Registering a commands without group names might cause the command traversal to fail. | |||||
/// use <see cref="AddModulesToGuildAsync(IGuild, bool, ModuleInfo[])"/>. Registering a commands without group names might cause the command traversal to fail. | |||||
/// </remarks> | /// </remarks> | ||||
/// <param name="guild">The target guild.</param> | /// <param name="guild">The target guild.</param> | ||||
/// <param name="commands">Commands to be registered to Discord.</param> | /// <param name="commands">Commands to be registered to Discord.</param> | ||||
@@ -517,7 +517,7 @@ namespace Discord.Interactions | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// Commands will be registered as standalone commands, if you want the <see cref="GroupAttribute"/> to take effect, | /// Commands will be registered as standalone commands, if you want the <see cref="GroupAttribute"/> to take effect, | ||||
/// use <see cref="AddModulesToGuildAsync(IGuild, ModuleInfo[])"/>. Registering a commands without group names might cause the command traversal to fail. | |||||
/// use <see cref="AddModulesToGuildAsync(IGuild, bool, ModuleInfo[])"/>. Registering a commands without group names might cause the command traversal to fail. | |||||
/// </remarks> | /// </remarks> | ||||
/// <param name="commands">Commands to be registered to Discord.</param> | /// <param name="commands">Commands to be registered to Discord.</param> | ||||
/// <returns> | /// <returns> | ||||
@@ -965,7 +965,7 @@ namespace Discord.Interactions | |||||
/// Removes a type reader for the given type. | /// Removes a type reader for the given type. | ||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// Removing a <see cref="TypeReader"/> from the <see cref="CommandService"/> will not dereference the <see cref="TypeReader"/> from the loaded module/command instances. | |||||
/// Removing a <see cref="TypeReader"/> from the <see cref="InteractionService"/> will not dereference the <see cref="TypeReader"/> from the loaded module/command instances. | |||||
/// You need to reload the modules for the changes to take effect. | /// You need to reload the modules for the changes to take effect. | ||||
/// </remarks> | /// </remarks> | ||||
/// <param name="type">The type to remove the reader from.</param> | /// <param name="type">The type to remove the reader from.</param> | ||||
@@ -978,7 +978,7 @@ namespace Discord.Interactions | |||||
/// Removes a generic type reader from the type <typeparamref name="T"/>. | /// Removes a generic type reader from the type <typeparamref name="T"/>. | ||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// Removing a <see cref="TypeReader"/> from the <see cref="CommandService"/> will not dereference the <see cref="TypeReader"/> from the loaded module/command instances. | |||||
/// Removing a <see cref="TypeReader"/> from the <see cref="InteractionService"/> will not dereference the <see cref="TypeReader"/> from the loaded module/command instances. | |||||
/// You need to reload the modules for the changes to take effect. | /// You need to reload the modules for the changes to take effect. | ||||
/// </remarks> | /// </remarks> | ||||
/// <typeparam name="T">The type to remove the readers from.</typeparam> | /// <typeparam name="T">The type to remove the readers from.</typeparam> | ||||
@@ -991,7 +991,7 @@ namespace Discord.Interactions | |||||
/// Removes a generic type reader from the given type. | /// Removes a generic type reader from the given type. | ||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// Removing a <see cref="TypeReader"/> from the <see cref="CommandService"/> will not dereference the <see cref="TypeReader"/> from the loaded module/command instances. | |||||
/// Removing a <see cref="TypeReader"/> from the <see cref="InteractionService"/> will not dereference the <see cref="TypeReader"/> from the loaded module/command instances. | |||||
/// You need to reload the modules for the changes to take effect. | /// You need to reload the modules for the changes to take effect. | ||||
/// </remarks> | /// </remarks> | ||||
/// <param name="type">The type to remove the reader from.</param> | /// <param name="type">The type to remove the reader from.</param> | ||||
@@ -1004,7 +1004,7 @@ namespace Discord.Interactions | |||||
/// Serialize an object using a <see cref="TypeReader"/> into a <see cref="string"/> to be placed in a Component CustomId. | /// Serialize an object using a <see cref="TypeReader"/> into a <see cref="string"/> to be placed in a Component CustomId. | ||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// Removing a <see cref="TypeReader"/> from the <see cref="CommandService"/> will not dereference the <see cref="TypeReader"/> from the loaded module/command instances. | |||||
/// Removing a <see cref="TypeReader"/> from the <see cref="InteractionService"/> will not dereference the <see cref="TypeReader"/> from the loaded module/command instances. | |||||
/// You need to reload the modules for the changes to take effect. | /// You need to reload the modules for the changes to take effect. | ||||
/// </remarks> | /// </remarks> | ||||
/// <typeparam name="T">Type of the object to be serialized.</typeparam> | /// <typeparam name="T">Type of the object to be serialized.</typeparam> | ||||
@@ -87,12 +87,12 @@ namespace Discord.Interactions | |||||
await InteractionService._restResponseCallback(Context, payload).ConfigureAwait(false); | await InteractionService._restResponseCallback(Context, payload).ConfigureAwait(false); | ||||
} | } | ||||
protected override async Task RespondWithModalAsync<T>(string customId, RequestOptions options = null) | |||||
protected override async Task RespondWithModalAsync<TModal>(string customId, RequestOptions options = null) | |||||
{ | { | ||||
if (Context.Interaction is not RestInteraction restInteraction) | if (Context.Interaction is not RestInteraction restInteraction) | ||||
throw new InvalidOperationException($"Invalid interaction type. Interaction must be a type of {nameof(RestInteraction)} in order to execute this method"); | throw new InvalidOperationException($"Invalid interaction type. Interaction must be a type of {nameof(RestInteraction)} in order to execute this method"); | ||||
var payload = restInteraction.RespondWithModal<T>(customId, options); | |||||
var payload = restInteraction.RespondWithModal<TModal>(customId, options); | |||||
if (Context is IRestInteractionContext restContext && restContext.InteractionResponseCallback != null) | if (Context is IRestInteractionContext restContext && restContext.InteractionResponseCallback != null) | ||||
await restContext.InteractionResponseCallback.Invoke(payload).ConfigureAwait(false); | await restContext.InteractionResponseCallback.Invoke(payload).ConfigureAwait(false); | ||||
@@ -3,7 +3,7 @@ using System; | |||||
namespace Discord.Interactions | namespace Discord.Interactions | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Represents a result type for <see cref="TypeConverter.ReadAsync(IInteractionContext, WebSocket.SocketSlashCommandDataOption, IServiceProvider)"/>. | |||||
/// Represents a result type for <see cref="TypeConverter.ReadAsync(IInteractionContext, IApplicationCommandInteractionDataOption, IServiceProvider)"/>. | |||||
/// </summary> | /// </summary> | ||||
public struct TypeConverterResult : IResult | public struct TypeConverterResult : IResult | ||||
{ | { | ||||
@@ -7,6 +7,8 @@ | |||||
<Description>A core Discord.Net library containing the REST client and models.</Description> | <Description>A core Discord.Net library containing the REST client and models.</Description> | ||||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks> | <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks> | ||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks> | <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks> | ||||
<WarningLevel>5</WarningLevel> | |||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | <ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | ||||
@@ -1161,7 +1161,6 @@ namespace Discord.Rest | |||||
/// in order to use this property. | /// in order to use this property. | ||||
/// </remarks> | /// </remarks> | ||||
/// </param> | /// </param> | ||||
/// <param name="speakers">A collection of speakers for the event.</param> | |||||
/// <param name="location">The location of the event; links are supported</param> | /// <param name="location">The location of the event; links are supported</param> | ||||
/// <param name="coverImage">The optional banner image for the event.</param> | /// <param name="coverImage">The optional banner image for the event.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
@@ -333,7 +333,6 @@ namespace Discord.Rest | |||||
=> await FollowupWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false); | => await FollowupWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false); | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
Task IDiscordInteraction.RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options) => throw new NotSupportedException("REST-Based interactions don't support files."); | Task IDiscordInteraction.RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options) => throw new NotSupportedException("REST-Based interactions don't support files."); | ||||
/// <inheritdoc/> | |||||
#if NETCOREAPP3_0_OR_GREATER != true | #if NETCOREAPP3_0_OR_GREATER != true | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
Task IDiscordInteraction.RespondWithFileAsync(Stream fileStream, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options) => throw new NotSupportedException("REST-Based interactions don't support files."); | Task IDiscordInteraction.RespondWithFileAsync(Stream fileStream, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options) => throw new NotSupportedException("REST-Based interactions don't support files."); | ||||
@@ -25,7 +25,7 @@ namespace Discord.Rest | |||||
public string Name { get; private set; } | public string Name { get; private set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string Icon { get; private set; } | public string Icon { get; private set; } | ||||
/// <inheritdoc>/> | |||||
/// <inheritdoc /> | |||||
public Emoji Emoji { get; private set; } | public Emoji Emoji { get; private set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public GuildPermissions Permissions { get; private set; } | public GuildPermissions Permissions { get; private set; } | ||||
@@ -243,7 +243,7 @@ namespace Discord.Net.ED25519 | |||||
/// <summary> | /// <summary> | ||||
/// // Decode a base58-encoded string into byte array | /// // Decode a base58-encoded string into byte array | ||||
/// </summary> | /// </summary> | ||||
/// <param name="strBase58">Base58 data string</param> | |||||
/// <param name="input">Base58 data string</param> | |||||
/// <returns>Byte array</returns> | /// <returns>Byte array</returns> | ||||
public static byte[] Base58Decode(string input) | public static byte[] Base58Decode(string input) | ||||
{ | { | ||||
@@ -60,14 +60,9 @@ namespace Discord.Net.Queue | |||||
_clearToken?.Cancel(); | _clearToken?.Cancel(); | ||||
_clearToken?.Dispose(); | _clearToken?.Dispose(); | ||||
_clearToken = new CancellationTokenSource(); | _clearToken = new CancellationTokenSource(); | ||||
if (_parentToken != null) | |||||
{ | |||||
_requestCancelTokenSource?.Dispose(); | |||||
_requestCancelTokenSource = CancellationTokenSource.CreateLinkedTokenSource(_clearToken.Token, _parentToken); | |||||
_requestCancelToken = _requestCancelTokenSource.Token; | |||||
} | |||||
else | |||||
_requestCancelToken = _clearToken.Token; | |||||
_requestCancelTokenSource?.Dispose(); | |||||
_requestCancelTokenSource = CancellationTokenSource.CreateLinkedTokenSource(_clearToken.Token, _parentToken); | |||||
_requestCancelToken = _requestCancelTokenSource.Token; | |||||
} | } | ||||
finally { _tokenLock.Release(); } | finally { _tokenLock.Release(); } | ||||
} | } | ||||
@@ -8,6 +8,8 @@ | |||||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks> | <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks> | ||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks> | <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks> | ||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||||
<WarningLevel>5</WarningLevel> | |||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | <ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | ||||
@@ -1291,7 +1291,6 @@ namespace Discord.WebSocket | |||||
/// in order to use this property. | /// in order to use this property. | ||||
/// </remarks> | /// </remarks> | ||||
/// </param> | /// </param> | ||||
/// <param name="speakers">A collection of speakers for the event.</param> | |||||
/// <param name="location">The location of the event; links are supported</param> | /// <param name="location">The location of the event; links are supported</param> | ||||
/// <param name="coverImage">The optional banner image for the event.</param> | /// <param name="coverImage">The optional banner image for the event.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
@@ -6,6 +6,8 @@ | |||||
<RootNamespace>Discord.Webhook</RootNamespace> | <RootNamespace>Discord.Webhook</RootNamespace> | ||||
<Description>A core Discord.Net library containing the Webhook client and models.</Description> | <Description>A core Discord.Net library containing the Webhook client and models.</Description> | ||||
<TargetFrameworks>net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks> | <TargetFrameworks>net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks> | ||||
<WarningLevel>5</WarningLevel> | |||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | <ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | ||||