@@ -1 +1,3 @@ | |||||
github: quinchs | |||||
open_collective: discordnet | open_collective: discordnet | ||||
custom: https://paypal.me/quinchs |
@@ -1,5 +1,18 @@ | |||||
# Changelog | # Changelog | ||||
## [3.6.1] - 2022-04-30 | |||||
### Added | |||||
- #2272 add 50080 Error code (503e720) | |||||
### Fixed | |||||
- #2267 Permissions v2 Invalid Operation Exception (a8f6075) | |||||
- #2271 null user on interaction without bot scope (f2bb55e) | |||||
- #2274 Implement fix for Custom Id Segments NRE (0d74c5c) | |||||
### Misc | |||||
- 3.6.0 (27226f0) | |||||
## [3.6.0] - 2022-04-28 | ## [3.6.0] - 2022-04-28 | ||||
### Added | ### Added | ||||
- #2136 Passing CustomId matches into contexts (4ce1801) | - #2136 Passing CustomId matches into contexts (4ce1801) | ||||
@@ -1,6 +1,6 @@ | |||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
<PropertyGroup> | <PropertyGroup> | ||||
<VersionPrefix>3.6.0</VersionPrefix> | |||||
<VersionPrefix>3.6.1</VersionPrefix> | |||||
<LangVersion>latest</LangVersion> | <LangVersion>latest</LangVersion> | ||||
<Authors>Discord.Net Contributors</Authors> | <Authors>Discord.Net Contributors</Authors> | ||||
<PackageTags>discord;discordapp</PackageTags> | <PackageTags>discord;discordapp</PackageTags> | ||||
@@ -60,7 +60,7 @@ | |||||
"overwrite": "_overwrites/**/**.md", | "overwrite": "_overwrites/**/**.md", | ||||
"globalMetadata": { | "globalMetadata": { | ||||
"_appTitle": "Discord.Net Documentation", | "_appTitle": "Discord.Net Documentation", | ||||
"_appFooter": "Discord.Net (c) 2015-2022 3.6.0", | |||||
"_appFooter": "Discord.Net (c) 2015-2022 3.6.1", | |||||
"_enableSearch": true, | "_enableSearch": true, | ||||
"_appLogoPath": "marketing/logo/SVG/Logomark Purple.svg", | "_appLogoPath": "marketing/logo/SVG/Logomark Purple.svg", | ||||
"_appFaviconPath": "favicon.ico" | "_appFaviconPath": "favicon.ico" | ||||
@@ -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" /> | ||||
@@ -152,6 +152,7 @@ namespace Discord | |||||
InvalidMessageType = 50068, | InvalidMessageType = 50068, | ||||
PaymentSourceRequiredForGift = 50070, | PaymentSourceRequiredForGift = 50070, | ||||
CannotDeleteRequiredCommunityChannel = 50074, | CannotDeleteRequiredCommunityChannel = 50074, | ||||
CannotEditStickersWithinAMessage = 50080, | |||||
InvalidSticker = 50081, | InvalidSticker = 50081, | ||||
CannotExecuteOnArchivedThread = 50083, | CannotExecuteOnArchivedThread = 50083, | ||||
InvalidThreadNotificationSettings = 50084, | InvalidThreadNotificationSettings = 50084, | ||||
@@ -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> | ||||
@@ -27,6 +27,12 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
public Optional<ulong> GuildId { get; internal set; } | public Optional<ulong> GuildId { get; internal set; } | ||||
/// <summary> | |||||
/// Gets whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message | |||||
/// Defaults to true. | |||||
/// </summary> | |||||
public Optional<bool> FailIfNotExists { get; internal set; } | |||||
/// <summary> | /// <summary> | ||||
/// Initializes a new instance of the <see cref="MessageReference"/> class. | /// Initializes a new instance of the <see cref="MessageReference"/> class. | ||||
/// </summary> | /// </summary> | ||||
@@ -39,16 +45,21 @@ namespace Discord | |||||
/// <param name="guildId"> | /// <param name="guildId"> | ||||
/// The ID of the guild that will be referenced. It will be validated if sent. | /// The ID of the guild that will be referenced. It will be validated if sent. | ||||
/// </param> | /// </param> | ||||
public MessageReference(ulong? messageId = null, ulong? channelId = null, ulong? guildId = null) | |||||
/// <param name="failIfNotExists"> | |||||
/// Whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message. Defaults to true. | |||||
/// </param> | |||||
public MessageReference(ulong? messageId = null, ulong? channelId = null, ulong? guildId = null, bool? failIfNotExists = null) | |||||
{ | { | ||||
MessageId = messageId ?? Optional.Create<ulong>(); | MessageId = messageId ?? Optional.Create<ulong>(); | ||||
InternalChannelId = channelId ?? Optional.Create<ulong>(); | InternalChannelId = channelId ?? Optional.Create<ulong>(); | ||||
GuildId = guildId ?? Optional.Create<ulong>(); | GuildId = guildId ?? Optional.Create<ulong>(); | ||||
FailIfNotExists = failIfNotExists ?? Optional.Create<bool>(); | |||||
} | } | ||||
private string DebuggerDisplay | private string DebuggerDisplay | ||||
=> $"Channel ID: ({ChannelId}){(GuildId.IsSpecified ? $", Guild ID: ({GuildId.Value})" : "")}" + | => $"Channel ID: ({ChannelId}){(GuildId.IsSpecified ? $", Guild ID: ({GuildId.Value})" : "")}" + | ||||
$"{(MessageId.IsSpecified ? $", Message ID: ({MessageId.Value})" : "")}"; | |||||
$"{(MessageId.IsSpecified ? $", Message ID: ({MessageId.Value})" : "")}" + | |||||
$"{(FailIfNotExists.IsSpecified ? $", FailIfNotExists: ({FailIfNotExists.Value})" : "")}"; | |||||
public override string ToString() | public override string ToString() | ||||
=> DebuggerDisplay; | => DebuggerDisplay; | ||||
@@ -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> | ||||
@@ -834,11 +834,16 @@ namespace Discord.Interactions | |||||
if (!searchResult.Command.SupportsWildCards || context is not IRouteMatchContainer matchContainer) | if (!searchResult.Command.SupportsWildCards || context is not IRouteMatchContainer matchContainer) | ||||
return; | return; | ||||
var matches = new RouteSegmentMatch[searchResult.RegexCaptureGroups.Length]; | |||||
for (var i = 0; i < searchResult.RegexCaptureGroups.Length; i++) | |||||
matches[i] = new RouteSegmentMatch(searchResult.RegexCaptureGroups[i]); | |||||
if (searchResult.RegexCaptureGroups?.Length > 0) | |||||
{ | |||||
var matches = new RouteSegmentMatch[searchResult.RegexCaptureGroups.Length]; | |||||
for (var i = 0; i < searchResult.RegexCaptureGroups.Length; i++) | |||||
matches[i] = new RouteSegmentMatch(searchResult.RegexCaptureGroups[i]); | |||||
matchContainer.SetSegmentMatches(matches); | |||||
matchContainer.SetSegmentMatches(matches); | |||||
} | |||||
else | |||||
matchContainer.SetSegmentMatches(Array.Empty<RouteSegmentMatch>()); | |||||
} | } | ||||
internal TypeConverter GetTypeConverter(Type type, IServiceProvider services = null) | internal TypeConverter GetTypeConverter(Type type, IServiceProvider services = null) | ||||
@@ -960,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> | ||||
@@ -973,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> | ||||
@@ -986,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> | ||||
@@ -999,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 | ||||
{ | { | ||||
@@ -12,5 +12,8 @@ namespace Discord.API | |||||
[JsonProperty("guild_id")] | [JsonProperty("guild_id")] | ||||
public Optional<ulong> GuildId { get; set; } | public Optional<ulong> GuildId { get; set; } | ||||
[JsonProperty("fail_if_not_exists")] | |||||
public Optional<bool> FailIfNotExists { get; set; } | |||||
} | } | ||||
} | } |
@@ -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" /> | ||||
@@ -144,7 +144,8 @@ namespace Discord.Rest | |||||
{ | { | ||||
GuildId = model.Reference.Value.GuildId, | GuildId = model.Reference.Value.GuildId, | ||||
InternalChannelId = model.Reference.Value.ChannelId, | InternalChannelId = model.Reference.Value.ChannelId, | ||||
MessageId = model.Reference.Value.MessageId | |||||
MessageId = model.Reference.Value.MessageId, | |||||
FailIfNotExists = model.Reference.Value.FailIfNotExists | |||||
}; | }; | ||||
} | } | ||||
@@ -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; } | ||||
@@ -87,6 +87,7 @@ namespace Discord.Rest | |||||
ChannelId = entity.InternalChannelId, | ChannelId = entity.InternalChannelId, | ||||
GuildId = entity.GuildId, | GuildId = entity.GuildId, | ||||
MessageId = entity.MessageId, | MessageId = entity.MessageId, | ||||
FailIfNotExists = entity.FailIfNotExists | |||||
}; | }; | ||||
} | } | ||||
public static IEnumerable<string> EnumerateMentionTypes(this AllowedMentionTypes mentionTypes) | public static IEnumerable<string> EnumerateMentionTypes(this AllowedMentionTypes mentionTypes) | ||||
@@ -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" /> | ||||
@@ -2331,7 +2331,9 @@ namespace Discord.WebSocket | |||||
SocketUser user = data.User.IsSpecified | SocketUser user = data.User.IsSpecified | ||||
? State.GetOrAddUser(data.User.Value.Id, (_) => SocketGlobalUser.Create(this, State, data.User.Value)) | ? State.GetOrAddUser(data.User.Value.Id, (_) => SocketGlobalUser.Create(this, State, data.User.Value)) | ||||
: guild?.AddOrUpdateUser(data.Member.Value); // null if the bot scope isn't set, so the guild cannot be retrieved. | |||||
: guild != null | |||||
? guild.AddOrUpdateUser(data.Member.Value) // null if the bot scope isn't set, so the guild cannot be retrieved. | |||||
: State.GetOrAddUser(data.Member.Value.User.Id, (_) => SocketGlobalUser.Create(this, State, data.Member.Value.User)); | |||||
SocketChannel channel = null; | SocketChannel channel = null; | ||||
if(data.ChannelId.IsSpecified) | if(data.ChannelId.IsSpecified) | ||||
@@ -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> | ||||
@@ -182,7 +182,8 @@ namespace Discord.WebSocket | |||||
{ | { | ||||
GuildId = model.Reference.Value.GuildId, | GuildId = model.Reference.Value.GuildId, | ||||
InternalChannelId = model.Reference.Value.ChannelId, | InternalChannelId = model.Reference.Value.ChannelId, | ||||
MessageId = model.Reference.Value.MessageId | |||||
MessageId = model.Reference.Value.MessageId, | |||||
FailIfNotExists = model.Reference.Value.FailIfNotExists | |||||
}; | }; | ||||
} | } | ||||
@@ -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" /> | ||||
@@ -2,57 +2,57 @@ | |||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||||
<metadata> | <metadata> | ||||
<id>Discord.Net</id> | <id>Discord.Net</id> | ||||
<version>3.6.0$suffix$</version> | |||||
<version>3.6.1$suffix$</version> | |||||
<title>Discord.Net</title> | <title>Discord.Net</title> | ||||
<authors>Discord.Net Contributors</authors> | <authors>Discord.Net Contributors</authors> | ||||
<owners>foxbot</owners> | <owners>foxbot</owners> | ||||
<description>An asynchronous API wrapper for Discord. This metapackage includes all of the optional Discord.Net components.</description> | <description>An asynchronous API wrapper for Discord. This metapackage includes all of the optional Discord.Net components.</description> | ||||
<tags>discord;discordapp</tags> | <tags>discord;discordapp</tags> | ||||
<projectUrl>https://github.com/RogueException/Discord.Net</projectUrl> | |||||
<projectUrl>https://github.com/discord-net/Discord.Net</projectUrl> | |||||
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl> | <licenseUrl>http://opensource.org/licenses/MIT</licenseUrl> | ||||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | <requireLicenseAcceptance>false</requireLicenseAcceptance> | ||||
<iconUrl>https://github.com/RogueException/Discord.Net/raw/dev/docs/marketing/logo/PackageLogo.png</iconUrl> | |||||
<iconUrl>https://github.com/discord-net/Discord.Net/raw/dev/docs/marketing/logo/PackageLogo.png</iconUrl> | |||||
<dependencies> | <dependencies> | ||||
<group targetFramework="net6.0"> | <group targetFramework="net6.0"> | ||||
<dependency id="Discord.Net.Core" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Rest" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.WebSocket" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Commands" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Webhook" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Interactions" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Core" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Rest" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.WebSocket" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Commands" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Webhook" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Interactions" version="3.6.1$suffix$" /> | |||||
</group> | </group> | ||||
<group targetFramework="net5.0"> | <group targetFramework="net5.0"> | ||||
<dependency id="Discord.Net.Core" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Rest" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.WebSocket" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Commands" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Webhook" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Interactions" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Core" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Rest" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.WebSocket" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Commands" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Webhook" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Interactions" version="3.6.1$suffix$" /> | |||||
</group> | </group> | ||||
<group targetFramework="net461"> | <group targetFramework="net461"> | ||||
<dependency id="Discord.Net.Core" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Rest" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.WebSocket" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Commands" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Webhook" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Interactions" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Core" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Rest" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.WebSocket" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Commands" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Webhook" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Interactions" version="3.6.1$suffix$" /> | |||||
</group> | </group> | ||||
<group targetFramework="netstandard2.0"> | <group targetFramework="netstandard2.0"> | ||||
<dependency id="Discord.Net.Core" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Rest" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.WebSocket" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Commands" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Webhook" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Interactions" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Core" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Rest" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.WebSocket" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Commands" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Webhook" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Interactions" version="3.6.1$suffix$" /> | |||||
</group> | </group> | ||||
<group targetFramework="netstandard2.1"> | <group targetFramework="netstandard2.1"> | ||||
<dependency id="Discord.Net.Core" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Rest" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.WebSocket" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Commands" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Webhook" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Interactions" version="3.6.0$suffix$" /> | |||||
<dependency id="Discord.Net.Core" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Rest" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.WebSocket" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Commands" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Webhook" version="3.6.1$suffix$" /> | |||||
<dependency id="Discord.Net.Interactions" version="3.6.1$suffix$" /> | |||||
</group> | </group> | ||||
</dependencies> | </dependencies> | ||||
</metadata> | </metadata> | ||||
</package> | |||||
</package> |