From c997ac2779491ae8c634276b6558b735cd9f95e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Hjorth=C3=B8j?= Date: Fri, 24 Sep 2021 14:15:12 +0200 Subject: [PATCH] Fixed some warnings (#184) * Fixed some warnings * Another fixed warning * Changed the SSendFileAsync to SendFileAsync * Removed para AlwaysAcknowledgeInteractions * Moved it back to the previous version * Added periods to the end like quin requested!! :(( Co-authored-by: MrCakeSlayer <13650699+MrCakeSlayer@users.noreply.github.com> --- .../Discord.Net.Commands.xml | 6 +- src/Discord.Net.Commands/ModuleBase.cs | 4 +- src/Discord.Net.Core/CDN.cs | 2 +- src/Discord.Net.Core/Discord.Net.Core.xml | 70 ++++++++++--------- .../Entities/Channels/IMessageChannel.cs | 8 +-- .../Entities/Channels/INestedChannel.cs | 4 +- .../Entities/Channels/IStageChannel.cs | 2 +- .../Entities/Guilds/IGuild.cs | 2 +- .../Interactions/IApplicationCommandOption.cs | 2 +- .../Interactions/IDiscordInteraction.cs | 10 +-- .../Message Components/ComponentBuilder.cs | 22 +++--- .../Slash Commands/SlashCommandBuilder.cs | 1 + .../Entities/Users/IGuildUser.cs | 2 +- .../Extensions/MessageExtensions.cs | 10 ++- .../Extensions/UserExtensions.cs | 6 +- .../Net/ApplicationCommandException.cs | 4 -- src/Discord.Net.Core/Utils/UrlValidation.cs | 2 +- src/Discord.Net.Rest/Discord.Net.Rest.xml | 10 +-- .../Entities/Channels/IRestMessageChannel.cs | 8 +-- .../Entities/Guilds/RestGuild.cs | 3 +- .../API/Gateway/ExtendedGuild.cs | 2 +- .../Discord.Net.WebSocket.xml | 40 +++++------ .../Channels/ISocketMessageChannel.cs | 8 +-- .../Entities/Guilds/SocketGuild.cs | 6 +- .../Entities/Interaction/SocketInteraction.cs | 34 ++++----- .../Helpers/CodeFixVerifier.Helper.cs | 10 +-- .../Helpers/DiagnosticVerifier.Helper.cs | 24 +++---- .../Verifiers/CodeFixVerifier.cs | 34 ++++----- .../Verifiers/DiagnosticVerifier.cs | 42 +++++------ 29 files changed, 192 insertions(+), 186 deletions(-) diff --git a/src/Discord.Net.Commands/Discord.Net.Commands.xml b/src/Discord.Net.Commands/Discord.Net.Commands.xml index cf68f8786..4ef47930e 100644 --- a/src/Discord.Net.Commands/Discord.Net.Commands.xml +++ b/src/Discord.Net.Commands/Discord.Net.Commands.xml @@ -1138,13 +1138,15 @@ Specifies if Discord should read this aloud using text-to-speech. An embed to be displayed alongside the . - A array of s to send with this response. Max 10 /// + Specifies if notifications are sent for mentioned users and roles in the . If null, all mentioned roles and users will be notified. + The request options for this async request. The message references to be included. Used to reply to specific messages. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A collection of stickers to send with the file. + A array of s to send with this response. Max 10. diff --git a/src/Discord.Net.Commands/ModuleBase.cs b/src/Discord.Net.Commands/ModuleBase.cs index a44fb26c0..eb517e65d 100644 --- a/src/Discord.Net.Commands/ModuleBase.cs +++ b/src/Discord.Net.Commands/ModuleBase.cs @@ -38,9 +38,9 @@ namespace Discord.Commands /// /// The request options for this async request. /// The message references to be included. Used to reply to specific messages. - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// A collection of stickers to send with the file. - /// A array of s to send with this response. Max 10 + /// A array of s to send with this response. Max 10. protected virtual async Task ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) { return await Context.Channel.SendMessageAsync(message, isTTS, embed, options, allowedMentions, messageReference, component, stickers, embeds).ConfigureAwait(false); diff --git a/src/Discord.Net.Core/CDN.cs b/src/Discord.Net.Core/CDN.cs index a744c93fe..b48bef379 100644 --- a/src/Discord.Net.Core/CDN.cs +++ b/src/Discord.Net.Core/CDN.cs @@ -181,7 +181,7 @@ namespace Discord /// Gets a stickers url based off the id and format. /// /// The id of the sticker. - /// The format of the sticker + /// The format of the sticker. /// /// A URL to the sticker. /// diff --git a/src/Discord.Net.Core/Discord.Net.Core.xml b/src/Discord.Net.Core/Discord.Net.Core.xml index 9ee2ef458..695c14461 100644 --- a/src/Discord.Net.Core/Discord.Net.Core.xml +++ b/src/Discord.Net.Core/Discord.Net.Core.xml @@ -217,7 +217,7 @@ Gets a stickers url based off the id and format. The id of the sticker. - The format of the sticker + The format of the sticker. A URL to the sticker. @@ -1526,9 +1526,9 @@ If null, all mentioned roles and users will be notified. The message references to be included. Used to reply to specific messages. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A collection of stickers to send with the message. - A array of s to send with this response. Max 10 + A array of s to send with this response. Max 10. A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. @@ -1567,7 +1567,7 @@ If null, all mentioned roles and users will be notified. The message references to be included. Used to reply to specific messages. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A collection of stickers to send with the file. A task that represents an asynchronous send operation for delivering the message. The task result @@ -1604,7 +1604,7 @@ If null, all mentioned roles and users will be notified. The message references to be included. Used to reply to specific messages. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A collection of stickers to send with the file. A task that represents an asynchronous send operation for delivering the message. The task result @@ -1870,7 +1870,7 @@ await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3); - The id of the embedded application to open for this invite + The id of the embedded application to open for this invite. The time (in seconds) until the invite expires. Set to null to never expire. The max amount of times this invite may be used. Set to null to have unlimited uses. If true, the user accepting this invite will be kicked from the guild after closing their client. @@ -1892,7 +1892,7 @@ await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3); - The id of the user whose stream to display for this invite + The id of the user whose stream to display for this invite. The time (in seconds) until the invite expires. Set to null to never expire. The max amount of times this invite may be used. Set to null to have unlimited uses. If true, the user accepting this invite will be kicked from the guild after closing their client. @@ -1979,7 +1979,7 @@ Starts the stage, creating a stage instance. The topic for the stage/ - The privacy level of the stage + The privacy level of the stage. The options to be used when sending the request. A task that represents the asynchronous start operation. @@ -3996,7 +3996,7 @@ The description of the sticker. The tags of the sticker. The stream containing the file data. - The name of the file with the extension, ex: image.png + The name of the file with the extension, ex: image.png. The options to be used when sending the request. A task that represents the asynchronous creation operation. The task result contains the created sticker. @@ -5007,25 +5007,25 @@ Responds to an Interaction with type . The text of the message to be sent. - A array of embeds to send with this response. Max 10 + A array of embeds to send with this response. Max 10. if the message should be read out by a text-to-speech reader, otherwise . if the response should be hidden to everyone besides the invoker of the command, otherwise . The allowed mentions for this response. The request options for this response. - A to be sent with this response + A to be sent with this response. A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. Sends a followup message for this interaction. - The text of the message to be sent - A array of embeds to send with this response. Max 10 + The text of the message to be sent. + A array of embeds to send with this response. Max 10. if the message should be read out by a text-to-speech reader, otherwise . if the response should be hidden to everyone besides the invoker of the command, otherwise . The allowed mentions for this response. The request options for this response. - A to be sent with this response + A to be sent with this response. A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. The sent message. @@ -5414,10 +5414,10 @@ The label to use on the newly created link button. The url of this button. - The custom ID of this button - The custom ID of this button - The emote of this button - Disabled this button or not + The custom ID of this button. + The custom ID of this button. + The emote of this button. + Disabled this button or not. @@ -5430,7 +5430,7 @@ The label for this link button. The url for this link button to go to. - The emote for this link button + The emote for this link button. A builder with the newly created button. @@ -5439,7 +5439,7 @@ The label for this danger button. The custom id for this danger button. - The emote for this danger button + The emote for this danger button. A builder with the newly created button. @@ -5448,7 +5448,7 @@ The label for this primary button. The custom id for this primary button. - The emote for this primary button + The emote for this primary button. A builder with the newly created button. @@ -5457,7 +5457,7 @@ The label for this secondary button. The custom id for this secondary button. - The emote for this secondary button + The emote for this secondary button. A builder with the newly created button. @@ -5466,14 +5466,14 @@ The label for this success button. The custom id for this success button. - The emote for this success button + The emote for this success button. A builder with the newly created button. Sets the current buttons label to the specified text. - The text for the label + The text for the label. The current builder. @@ -9114,6 +9114,12 @@ If true, a user may create private threads in this guild. + + If true, a user may use public threads in this guild. + + + If true, a user may use private threads in this guild. + If true, a user may use external stickers in this guild. @@ -9129,10 +9135,10 @@ Creates a new with the provided packed value after converting to ulong. - + Creates a new structure with the provided permissions. - + Creates a new from this one, changing the provided non-null permissions. @@ -11058,7 +11064,7 @@ The message to add reactions to. - An array of reactions to add to the message + An array of reactions to add to the message. The options to be used when sending the request. A task that represents the asynchronous operation for adding a reaction to this message. @@ -11080,7 +11086,7 @@ The message to remove reactions from. - An array of reactions to remove from the message + An array of reactions to remove from the message. The options to be used when sending the request. A task that represents the asynchronous operation for removing a reaction to this message. @@ -11095,7 +11101,7 @@ The message to be sent. Determines whether the message should be read aloud by Discord or not. The to be sent. - A array of s to send with this response. Max 10 + A array of s to send with this response. Max 10. Specifies if notifications are sent for mentioned users and roles in the message . If null, all mentioned roles and users will be notified. @@ -11130,13 +11136,13 @@ The message to be sent. Whether the message should be read aloud by Discord or not. The to be sent. - A array of s to send with this response. Max 10 + A array of s to send with this response. Max 10. The options to be used when sending the request. Specifies if notifications are sent for mentioned users and roles in the message . If null, all mentioned roles and users will be notified. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A task that represents the asynchronous send operation. The task result contains the sent message. @@ -12782,7 +12788,7 @@ Not full URL validation right now. Just ensures protocol is present and that it's either http or https - url to validate before sending to Discord + url to validate before sending to Discord. A URL must include a protocol (http or https). true if url is valid by our standard, false if null, throws an error upon invalid diff --git a/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs b/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs index 49fc5f433..9e145a630 100644 --- a/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs +++ b/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs @@ -28,9 +28,9 @@ namespace Discord /// If null, all mentioned roles and users will be notified. /// /// The message references to be included. Used to reply to specific messages. - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// A collection of stickers to send with the message. - /// A array of s to send with this response. Max 10 + /// A array of s to send with this response. Max 10. /// /// A task that represents an asynchronous send operation for delivering the message. The task result /// contains the sent message. @@ -68,7 +68,7 @@ namespace Discord /// If null, all mentioned roles and users will be notified. /// /// The message references to be included. Used to reply to specific messages. - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// A collection of stickers to send with the file. /// /// A task that represents an asynchronous send operation for delivering the message. The task result @@ -104,7 +104,7 @@ namespace Discord /// If null, all mentioned roles and users will be notified. /// /// The message references to be included. Used to reply to specific messages. - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// A collection of stickers to send with the file. /// /// A task that represents an asynchronous send operation for delivering the message. The task result diff --git a/src/Discord.Net.Core/Entities/Channels/INestedChannel.cs b/src/Discord.Net.Core/Entities/Channels/INestedChannel.cs index d8072f94f..563acd4f8 100644 --- a/src/Discord.Net.Core/Entities/Channels/INestedChannel.cs +++ b/src/Discord.Net.Core/Entities/Channels/INestedChannel.cs @@ -67,7 +67,7 @@ namespace Discord /// await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3); /// /// - /// The id of the embedded application to open for this invite + /// The id of the embedded application to open for this invite. /// The time (in seconds) until the invite expires. Set to null to never expire. /// The max amount of times this invite may be used. Set to null to have unlimited uses. /// If true, the user accepting this invite will be kicked from the guild after closing their client. @@ -89,7 +89,7 @@ namespace Discord /// await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3); /// /// - /// The id of the user whose stream to display for this invite + /// The id of the user whose stream to display for this invite. /// The time (in seconds) until the invite expires. Set to null to never expire. /// The max amount of times this invite may be used. Set to null to have unlimited uses. /// If true, the user accepting this invite will be kicked from the guild after closing their client. diff --git a/src/Discord.Net.Core/Entities/Channels/IStageChannel.cs b/src/Discord.Net.Core/Entities/Channels/IStageChannel.cs index 1461d8e50..9e417a4f1 100644 --- a/src/Discord.Net.Core/Entities/Channels/IStageChannel.cs +++ b/src/Discord.Net.Core/Entities/Channels/IStageChannel.cs @@ -44,7 +44,7 @@ namespace Discord /// Starts the stage, creating a stage instance. /// /// The topic for the stage/ - /// The privacy level of the stage + /// The privacy level of the stage. /// The options to be used when sending the request. /// /// A task that represents the asynchronous start operation. diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs index 87c313700..9b5d6b23a 100644 --- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs +++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs @@ -1009,7 +1009,7 @@ namespace Discord /// The description of the sticker. /// The tags of the sticker. /// The stream containing the file data. - /// The name of the file with the extension, ex: image.png + /// The name of the file with the extension, ex: image.png. /// The options to be used when sending the request. /// /// A task that represents the asynchronous creation operation. The task result contains the created sticker. diff --git a/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOption.cs b/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOption.cs index 25e3c7dfc..0fc7fb4a3 100644 --- a/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOption.cs +++ b/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOption.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Discord { /// - /// Options for the , see The docs. + /// Options for the , see The docs. /// public interface IApplicationCommandOption { diff --git a/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs b/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs index ae015c2a6..0dea203ef 100644 --- a/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs +++ b/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs @@ -44,12 +44,12 @@ namespace Discord /// Responds to an Interaction with type . /// /// The text of the message to be sent. - /// A array of embeds to send with this response. Max 10 + /// A array of embeds to send with this response. Max 10. /// if the message should be read out by a text-to-speech reader, otherwise . /// if the response should be hidden to everyone besides the invoker of the command, otherwise . /// The allowed mentions for this response. /// The request options for this response. - /// A to be sent with this response + /// A to be sent with this response. /// A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. Task RespondAsync (string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null, Embed embed = null); @@ -57,13 +57,13 @@ namespace Discord /// /// Sends a followup message for this interaction. /// - /// The text of the message to be sent - /// A array of embeds to send with this response. Max 10 + /// The text of the message to be sent. + /// A array of embeds to send with this response. Max 10. /// if the message should be read out by a text-to-speech reader, otherwise . /// if the response should be hidden to everyone besides the invoker of the command, otherwise . /// The allowed mentions for this response. /// The request options for this response. - /// A to be sent with this response + /// A to be sent with this response. /// A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. /// /// The sent message. diff --git a/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs index be7f78304..8dbcb4319 100644 --- a/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs @@ -240,7 +240,7 @@ namespace Discord /// /// Builds this builder into a used to send your components. /// - /// A that can be sent with . + /// A that can be sent with . public MessageComponent Build() { if (this._actionRows != null) @@ -427,10 +427,10 @@ namespace Discord /// /// The label to use on the newly created link button. /// The url of this button. - /// The custom ID of this button - /// The custom ID of this button - /// The emote of this button - /// Disabled this button or not + /// The custom ID of this button. + /// The custom ID of this button. + /// The emote of this button. + /// Disabled this button or not. public ButtonBuilder(string label = null, string customId = null, ButtonStyle style = ButtonStyle.Primary, string url = null, IEmote emote = null, bool disabled = false) { this.CustomId = customId; @@ -459,7 +459,7 @@ namespace Discord /// /// The label for this link button. /// The url for this link button to go to. - /// The emote for this link button + /// The emote for this link button. /// A builder with the newly created button. public static ButtonBuilder CreateLinkButton(string label, string url, IEmote emote = null) => new ButtonBuilder(label, null, ButtonStyle.Link, url, emote: emote); @@ -469,7 +469,7 @@ namespace Discord /// /// The label for this danger button. /// The custom id for this danger button. - /// The emote for this danger button + /// The emote for this danger button. /// A builder with the newly created button. public static ButtonBuilder CreateDangerButton(string label, string customId, IEmote emote = null) => new ButtonBuilder(label, customId, ButtonStyle.Danger, emote: emote); @@ -479,7 +479,7 @@ namespace Discord /// /// The label for this primary button. /// The custom id for this primary button. - /// The emote for this primary button + /// The emote for this primary button. /// A builder with the newly created button. public static ButtonBuilder CreatePrimaryButton(string label, string customId, IEmote emote = null) => new ButtonBuilder(label, customId, emote: emote); @@ -489,7 +489,7 @@ namespace Discord /// /// The label for this secondary button. /// The custom id for this secondary button. - /// The emote for this secondary button + /// The emote for this secondary button. /// A builder with the newly created button. public static ButtonBuilder CreateSecondaryButton(string label, string customId, IEmote emote = null) => new ButtonBuilder(label, customId, ButtonStyle.Secondary, emote: emote); @@ -499,7 +499,7 @@ namespace Discord /// /// The label for this success button. /// The custom id for this success button. - /// The emote for this success button + /// The emote for this success button. /// A builder with the newly created button. public static ButtonBuilder CreateSuccessButton(string label, string customId, IEmote emote = null) => new ButtonBuilder(label, customId, ButtonStyle.Success, emote: emote); @@ -507,7 +507,7 @@ namespace Discord /// /// Sets the current buttons label to the specified text. /// - /// The text for the label + /// The text for the label. /// /// The current builder. public ButtonBuilder WithLabel(string label) diff --git a/src/Discord.Net.Core/Entities/Interactions/Slash Commands/SlashCommandBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/Slash Commands/SlashCommandBuilder.cs index 9581015d0..79afa410d 100644 --- a/src/Discord.Net.Core/Entities/Interactions/Slash Commands/SlashCommandBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/Slash Commands/SlashCommandBuilder.cs @@ -161,6 +161,7 @@ namespace Discord /// The description of this option. /// If this option is required for this command. /// If this option is the default option. + /// If this option is set to autocompleate. /// The options of the option to add. /// The choices of this option. /// The current builder. diff --git a/src/Discord.Net.Core/Entities/Users/IGuildUser.cs b/src/Discord.Net.Core/Entities/Users/IGuildUser.cs index e131a6a61..58a797c5f 100644 --- a/src/Discord.Net.Core/Entities/Users/IGuildUser.cs +++ b/src/Discord.Net.Core/Entities/Users/IGuildUser.cs @@ -84,7 +84,7 @@ namespace Discord /// /// 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 . - /// + /// /// if (currentUser?.GetPermissions(targetChannel)?.AttachFiles) /// await targetChannel.SendFileAsync("fortnite.png"); /// diff --git a/src/Discord.Net.Core/Extensions/MessageExtensions.cs b/src/Discord.Net.Core/Extensions/MessageExtensions.cs index be47c0587..3b21c128a 100644 --- a/src/Discord.Net.Core/Extensions/MessageExtensions.cs +++ b/src/Discord.Net.Core/Extensions/MessageExtensions.cs @@ -34,7 +34,7 @@ namespace Discord /// /// /// The message to add reactions to. - /// An array of reactions to add to the message + /// An array of reactions to add to the message. /// The options to be used when sending the request. /// /// A task that represents the asynchronous operation for adding a reaction to this message. @@ -59,7 +59,8 @@ namespace Discord /// /// /// The message to remove reactions from. - /// An array of reactions to remove from the message + /// The user who removed the reaction. + /// An array of reactions to remove from the message. /// The options to be used when sending the request. /// /// A task that represents the asynchronous operation for removing a reaction to this message. @@ -75,15 +76,18 @@ namespace Discord /// /// Sends an inline reply that references a message. /// + /// The message that is being replyed on. /// The message to be sent. /// Determines whether the message should be read aloud by Discord or not. /// The to be sent. - /// A array of s to send with this response. Max 10 + /// A array of s to send with this response. Max 10. /// /// Specifies if notifications are sent for mentioned users and roles in the message . /// If null, all mentioned roles and users will be notified. /// /// The options to be used when sending the request. + /// The message components to be included with this message. Used for interactions. + /// A collection of stickers to send with the message. /// /// A task that represents an asynchronous send operation for delivering the message. The task result /// contains the sent message. diff --git a/src/Discord.Net.Core/Extensions/UserExtensions.cs b/src/Discord.Net.Core/Extensions/UserExtensions.cs index 3f05b6361..aa807c073 100644 --- a/src/Discord.Net.Core/Extensions/UserExtensions.cs +++ b/src/Discord.Net.Core/Extensions/UserExtensions.cs @@ -27,13 +27,13 @@ namespace Discord /// The message to be sent. /// Whether the message should be read aloud by Discord or not. /// The to be sent. - /// A array of s to send with this response. Max 10 + /// A array of s to send with this response. Max 10. /// The options to be used when sending the request. /// /// Specifies if notifications are sent for mentioned users and roles in the message . /// If null, all mentioned roles and users will be notified. /// - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// /// A task that represents the asynchronous send operation. The task result contains the sent message. /// @@ -85,6 +85,7 @@ namespace Discord /// Whether the message should be read aloud by Discord or not. /// The to be sent. /// The options to be used when sending the request. + /// The message component to be included with this message. Used for interactions. /// /// A task that represents an asynchronous send operation for delivering the message. The task result /// contains the sent message. @@ -142,6 +143,7 @@ namespace Discord /// Whether the message should be read aloud by Discord or not. /// The to be sent. /// The options to be used when sending the request. + /// The message component to be included with this message. Used for interactions. /// /// A task that represents an asynchronous send operation for delivering the message. The task result /// contains the sent message. diff --git a/src/Discord.Net.Core/Net/ApplicationCommandException.cs b/src/Discord.Net.Core/Net/ApplicationCommandException.cs index 7e94293f4..acf19afe4 100644 --- a/src/Discord.Net.Core/Net/ApplicationCommandException.cs +++ b/src/Discord.Net.Core/Net/ApplicationCommandException.cs @@ -48,12 +48,8 @@ namespace Discord.Net /// /// Initializes a new instance of the class. /// - /// The request that was sent prior to the exception. /// /// - /// The Discord status code returned. - /// The reason behind the exception. - /// public ApplicationCommandException(string requestJson, HttpException httpError) : base("The application command failed to be created!", httpError) { diff --git a/src/Discord.Net.Core/Utils/UrlValidation.cs b/src/Discord.Net.Core/Utils/UrlValidation.cs index 7cc9bd8bd..f5d7d4ce7 100644 --- a/src/Discord.Net.Core/Utils/UrlValidation.cs +++ b/src/Discord.Net.Core/Utils/UrlValidation.cs @@ -7,7 +7,7 @@ namespace Discord.Utils /// /// Not full URL validation right now. Just ensures protocol is present and that it's either http or https /// - /// url to validate before sending to Discord + /// url to validate before sending to Discord. /// A URL must include a protocol (http or https). /// true if url is valid by our standard, false if null, throws an error upon invalid public static bool Validate(string url) diff --git a/src/Discord.Net.Rest/Discord.Net.Rest.xml b/src/Discord.Net.Rest/Discord.Net.Rest.xml index 28f8ab534..af46d06ad 100644 --- a/src/Discord.Net.Rest/Discord.Net.Rest.xml +++ b/src/Discord.Net.Rest/Discord.Net.Rest.xml @@ -1781,9 +1781,9 @@ If null, all mentioned roles and users will be notified. The message references to be included. Used to reply to specific messages. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A collection of stickers to send with the message. - A array of s to send with this response. Max 10 + A array of s to send with this response. Max 10. A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. @@ -1809,7 +1809,7 @@ If null, all mentioned roles and users will be notified. The message references to be included. Used to reply to specific messages. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A collection of stickers to send with the message. A task that represents an asynchronous send operation for delivering the message. The task result @@ -1836,7 +1836,7 @@ If null, all mentioned roles and users will be notified. The message references to be included. Used to reply to specific messages. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A collection of stickers to send with the message. A task that represents an asynchronous send operation for delivering the message. The task result @@ -3666,7 +3666,7 @@ The description of the sticker. The tags of the sticker. The stream containing the file data. - The name of the file with the extension, ex: image.png + The name of the file with the extension, ex: image.png. The options to be used when sending the request. A task that represents the asynchronous creation operation. The task result contains the created sticker. diff --git a/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs b/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs index 2b39e97d6..0198fea87 100644 --- a/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs @@ -25,9 +25,9 @@ namespace Discord.Rest /// If null, all mentioned roles and users will be notified. /// /// The message references to be included. Used to reply to specific messages. - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// A collection of stickers to send with the message. - /// A array of s to send with this response. Max 10 + /// A array of s to send with this response. Max 10. /// /// A task that represents an asynchronous send operation for delivering the message. The task result /// contains the sent message. @@ -52,7 +52,7 @@ namespace Discord.Rest /// If null, all mentioned roles and users will be notified. /// /// The message references to be included. Used to reply to specific messages. - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// A collection of stickers to send with the message. /// /// A task that represents an asynchronous send operation for delivering the message. The task result @@ -78,7 +78,7 @@ namespace Discord.Rest /// If null, all mentioned roles and users will be notified. /// /// The message references to be included. Used to reply to specific messages. - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// A collection of stickers to send with the message. /// /// A task that represents an asynchronous send operation for delivering the message. The task result diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs index a313de810..d78ff07cc 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs @@ -494,7 +494,6 @@ namespace Discord.Rest /// /// Gets a collection of all stage channels in this guild. /// - /// The that determines whether the object should be fetched from cache. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains a read-only collection of @@ -1044,7 +1043,7 @@ namespace Discord.Rest /// The description of the sticker. /// The tags of the sticker. /// The stream containing the file data. - /// The name of the file with the extension, ex: image.png + /// The name of the file with the extension, ex: image.png. /// The options to be used when sending the request. /// /// A task that represents the asynchronous creation operation. The task result contains the created sticker. diff --git a/src/Discord.Net.WebSocket/API/Gateway/ExtendedGuild.cs b/src/Discord.Net.WebSocket/API/Gateway/ExtendedGuild.cs index 203f2fd5b..8470c6d8f 100644 --- a/src/Discord.Net.WebSocket/API/Gateway/ExtendedGuild.cs +++ b/src/Discord.Net.WebSocket/API/Gateway/ExtendedGuild.cs @@ -27,6 +27,6 @@ namespace Discord.API.Gateway public DateTimeOffset JoinedAt { get; set; } [JsonProperty("threads")] - public Channel[] Threads { get; set; } + public new Channel[] Threads { get; set; } } } diff --git a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml index ae283b4d1..c194d00ef 100644 --- a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml +++ b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml @@ -1474,9 +1474,9 @@ If null, all mentioned roles and users will be notified. The message references to be included. Used to reply to specific messages. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A collection of stickers to send with the message. - A array of s to send with this response. Max 10 + A array of s to send with this response. Max 10. A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. @@ -1501,7 +1501,7 @@ If null, all mentioned roles and users will be notified. The message references to be included. Used to reply to specific messages. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A collection of stickers to send with the file. A task that represents an asynchronous send operation for delivering the message. The task result @@ -1528,7 +1528,7 @@ If null, all mentioned roles and users will be notified. The message references to be included. Used to reply to specific messages. - The message components to be included with this message. Used for interactions + The message components to be included with this message. Used for interactions. A collection of stickers to send with the file. A task that represents an asynchronous send operation for delivering the message. The task result @@ -3632,7 +3632,7 @@ The description of the sticker. The tags of the sticker. The stream containing the file data. - The name of the file with the extension, ex: image.png + The name of the file with the extension, ex: image.png. The options to be used when sending the request. A task that represents the asynchronous creation operation. The task result contains the created sticker. @@ -4292,12 +4292,12 @@ The text of the message to be sent. - A array of embeds to send with this response. Max 10 + A array of embeds to send with this response. Max 10. if the message should be read out by a text-to-speech reader, otherwise . if the response should be hidden to everyone besides the invoker of the command, otherwise . The allowed mentions for this response. The request options for this response. - A to be sent with this response + A to be sent with this response. A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. Message content is too long, length must be less or equal to . The parameters provided were invalid or the token was invalid. @@ -4306,13 +4306,13 @@ Sends a followup message for this interaction. - The text of the message to be sent - A array of embeds to send with this response. Max 10 + The text of the message to be sent. + A array of embeds to send with this response. Max 10. if the message should be read out by a text-to-speech reader, otherwise . if the response should be hidden to everyone besides the invoker of the command, otherwise . The allowed mentions for this response. The request options for this response. - A to be sent with this response + A to be sent with this response. A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. The sent message. @@ -4322,15 +4322,15 @@ Sends a followup message for this interaction. - The text of the message to be sent - The file to upload - The file name of the attachment - A array of embeds to send with this response. Max 10 + The text of the message to be sent. + The file to upload. + The file name of the attachment. + A array of embeds to send with this response. Max 10. if the message should be read out by a text-to-speech reader, otherwise . if the response should be hidden to everyone besides the invoker of the command, otherwise . The allowed mentions for this response. The request options for this response. - A to be sent with this response + A to be sent with this response. A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. The sent message. @@ -4340,15 +4340,15 @@ Sends a followup message for this interaction. - The text of the message to be sent - The file to upload - The file name of the attachment - A array of embeds to send with this response. Max 10 + The text of the message to be sent. + The file to upload. + The file name of the attachment. + A array of embeds to send with this response. Max 10. if the message should be read out by a text-to-speech reader, otherwise . if the response should be hidden to everyone besides the invoker of the command, otherwise . The allowed mentions for this response. The request options for this response. - A to be sent with this response + A to be sent with this response. A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. The sent message. diff --git a/src/Discord.Net.WebSocket/Entities/Channels/ISocketMessageChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/ISocketMessageChannel.cs index 8b60b18a1..5ced13628 100644 --- a/src/Discord.Net.WebSocket/Entities/Channels/ISocketMessageChannel.cs +++ b/src/Discord.Net.WebSocket/Entities/Channels/ISocketMessageChannel.cs @@ -34,9 +34,9 @@ namespace Discord.WebSocket /// If null, all mentioned roles and users will be notified. /// /// The message references to be included. Used to reply to specific messages. - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// A collection of stickers to send with the message. - /// A array of s to send with this response. Max 10 + /// A array of s to send with this response. Max 10. /// /// A task that represents an asynchronous send operation for delivering the message. The task result /// contains the sent message. @@ -60,7 +60,7 @@ namespace Discord.WebSocket /// If null, all mentioned roles and users will be notified. /// /// The message references to be included. Used to reply to specific messages. - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// A collection of stickers to send with the file. /// /// A task that represents an asynchronous send operation for delivering the message. The task result @@ -86,7 +86,7 @@ namespace Discord.WebSocket /// If null, all mentioned roles and users will be notified. /// /// The message references to be included. Used to reply to specific messages. - /// The message components to be included with this message. Used for interactions + /// The message components to be included with this message. Used for interactions. /// A collection of stickers to send with the file. /// /// A task that represents an asynchronous send operation for delivering the message. The task result diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs index efc3ab1b4..e4a03f818 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs @@ -1376,7 +1376,7 @@ namespace Discord.WebSocket /// The description of the sticker. /// The tags of the sticker. /// The stream containing the file data. - /// The name of the file with the extension, ex: image.png + /// The name of the file with the extension, ex: image.png. /// The options to be used when sending the request. /// /// A task that represents the asynchronous creation operation. The task result contains the created sticker. @@ -1666,10 +1666,10 @@ namespace Discord.WebSocket Task IGuild.GetVoiceChannelAsync(ulong id, CacheMode mode, RequestOptions options) => Task.FromResult(GetVoiceChannel(id)); /// - Task IGuild.GetStageChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) + Task IGuild.GetStageChannelAsync(ulong id, CacheMode mode, RequestOptions options) => Task.FromResult(GetStageChannel(id)); /// - Task> IGuild.GetStageChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) + Task> IGuild.GetStageChannelsAsync(CacheMode mode, RequestOptions options) => Task.FromResult>(StageChannels); /// Task IGuild.GetAFKChannelAsync(CacheMode mode, RequestOptions options) diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs index d88a7f004..e98999d11 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs @@ -117,18 +117,14 @@ namespace Discord.WebSocket /// /// Responds to an Interaction with type . - /// - /// If you have set to , You should use - /// instead. - /// /// /// The text of the message to be sent. - /// A array of embeds to send with this response. Max 10 + /// A array of embeds to send with this response. Max 10. /// if the message should be read out by a text-to-speech reader, otherwise . /// if the response should be hidden to everyone besides the invoker of the command, otherwise . /// The allowed mentions for this response. /// The request options for this response. - /// A to be sent with this response + /// A to be sent with this response. /// A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. /// Message content is too long, length must be less or equal to . /// The parameters provided were invalid or the token was invalid. @@ -138,13 +134,13 @@ namespace Discord.WebSocket /// /// Sends a followup message for this interaction. /// - /// The text of the message to be sent - /// A array of embeds to send with this response. Max 10 + /// The text of the message to be sent. + /// A array of embeds to send with this response. Max 10. /// if the message should be read out by a text-to-speech reader, otherwise . /// if the response should be hidden to everyone besides the invoker of the command, otherwise . /// The allowed mentions for this response. /// The request options for this response. - /// A to be sent with this response + /// A to be sent with this response. /// A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. /// /// The sent message. @@ -155,15 +151,15 @@ namespace Discord.WebSocket /// /// Sends a followup message for this interaction. /// - /// The text of the message to be sent - /// The file to upload - /// The file name of the attachment - /// A array of embeds to send with this response. Max 10 + /// The text of the message to be sent. + /// The file to upload. + /// The file name of the attachment. + /// A array of embeds to send with this response. Max 10. /// if the message should be read out by a text-to-speech reader, otherwise . /// if the response should be hidden to everyone besides the invoker of the command, otherwise . /// The allowed mentions for this response. /// The request options for this response. - /// A to be sent with this response + /// A to be sent with this response. /// A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. /// /// The sent message. @@ -174,15 +170,15 @@ namespace Discord.WebSocket /// /// Sends a followup message for this interaction. /// - /// The text of the message to be sent - /// The file to upload - /// The file name of the attachment - /// A array of embeds to send with this response. Max 10 + /// The text of the message to be sent. + /// The file to upload. + /// The file name of the attachment. + /// A array of embeds to send with this response. Max 10. /// if the message should be read out by a text-to-speech reader, otherwise . /// if the response should be hidden to everyone besides the invoker of the command, otherwise . /// The allowed mentions for this response. /// The request options for this response. - /// A to be sent with this response + /// A to be sent with this response. /// A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored. /// /// The sent message. diff --git a/test/Discord.Net.Analyzers.Tests/Helpers/CodeFixVerifier.Helper.cs b/test/Discord.Net.Analyzers.Tests/Helpers/CodeFixVerifier.Helper.cs index 0f73d0643..42f7b08c1 100644 --- a/test/Discord.Net.Analyzers.Tests/Helpers/CodeFixVerifier.Helper.cs +++ b/test/Discord.Net.Analyzers.Tests/Helpers/CodeFixVerifier.Helper.cs @@ -18,7 +18,7 @@ namespace TestHelper /// Apply the inputted CodeAction to the inputted document. /// Meant to be used to apply codefixes. /// - /// The Document to apply the fix on + /// The Document to apply the fix on. /// A CodeAction that will be applied to the Document. /// A Document with the changes from the CodeAction private static Document ApplyFix(Document document, CodeAction codeAction) @@ -33,8 +33,8 @@ namespace TestHelper /// Note: Considers Diagnostics to be the same if they have the same Ids. In the case of multiple diagnostics with the same Id in a row, /// this method may not necessarily return the new one. /// - /// The Diagnostics that existed in the code before the CodeFix was applied - /// The Diagnostics that exist in the code after the CodeFix was applied + /// The Diagnostics that existed in the code before the CodeFix was applied. + /// The Diagnostics that exist in the code after the CodeFix was applied. /// A list of Diagnostics that only surfaced in the code after the CodeFix was applied private static IEnumerable GetNewDiagnostics(IEnumerable diagnostics, IEnumerable newDiagnostics) { @@ -61,7 +61,7 @@ namespace TestHelper /// /// Get the existing compiler diagnostics on the inputted document. /// - /// The Document to run the compiler diagnostic analyzers on + /// The Document to run the compiler diagnostic analyzers on. /// The compiler diagnostics that were found in the code private static IEnumerable GetCompilerDiagnostics(Document document) { @@ -71,7 +71,7 @@ namespace TestHelper /// /// Given a document, turn it into a string based on the syntax root /// - /// The Document to be converted to a string + /// The Document to be converted to a string. /// A string containing the syntax of the Document after formatting private static string GetStringFromDocument(Document document) { diff --git a/test/Discord.Net.Analyzers.Tests/Helpers/DiagnosticVerifier.Helper.cs b/test/Discord.Net.Analyzers.Tests/Helpers/DiagnosticVerifier.Helper.cs index 43748aa93..23bb319a6 100644 --- a/test/Discord.Net.Analyzers.Tests/Helpers/DiagnosticVerifier.Helper.cs +++ b/test/Discord.Net.Analyzers.Tests/Helpers/DiagnosticVerifier.Helper.cs @@ -35,9 +35,9 @@ namespace TestHelper /// /// Given classes in the form of strings, their language, and an IDiagnosticAnlayzer to apply to it, return the diagnostics found in the string after converting it to a document. /// - /// Classes in the form of strings - /// The language the source classes are in - /// The analyzer to be run on the sources + /// Classes in the form of strings. + /// The language the source classes are in. + /// The analyzer to be run on the sources. /// An IEnumerable of Diagnostics that surfaced in the source code, sorted by Location private static Diagnostic[] GetSortedDiagnostics(string[] sources, string language, DiagnosticAnalyzer analyzer) { @@ -48,8 +48,8 @@ namespace TestHelper /// Given an analyzer and a document to apply it to, run the analyzer and gather an array of diagnostics found in it. /// The returned diagnostics are then ordered by location in the source document. /// - /// The analyzer to run on the documents - /// The Documents that the analyzer will be run on + /// The analyzer to run on the documents. + /// The Documents that the analyzer will be run on. /// An IEnumerable of Diagnostics that surfaced in the source code, sorted by Location protected static Diagnostic[] GetSortedDiagnosticsFromDocuments(DiagnosticAnalyzer analyzer, Document[] documents) { @@ -93,7 +93,7 @@ namespace TestHelper /// /// Sort diagnostics by location in source document /// - /// The list of Diagnostics to be sorted + /// The list of Diagnostics to be sorted. /// An IEnumerable containing the Diagnostics in order of Location private static Diagnostic[] SortDiagnostics(IEnumerable diagnostics) { @@ -106,8 +106,8 @@ namespace TestHelper /// /// Given an array of strings as sources and a language, turn them into a project and return the documents and spans of it. /// - /// Classes in the form of strings - /// The language the source code is in + /// Classes in the form of strings. + /// The language the source code is in. /// A Tuple containing the Documents produced from the sources and their TextSpans if relevant private static Document[] GetDocuments(string[] sources, string language) { @@ -130,8 +130,8 @@ namespace TestHelper /// /// Create a Document from a string through creating a project that contains it. /// - /// Classes in the form of a string - /// The language the source code is in + /// Classes in the form of a string. + /// The language the source code is in. /// A Document created from the source string protected static Document CreateDocument(string source, string language = LanguageNames.CSharp) { @@ -141,8 +141,8 @@ namespace TestHelper /// /// Create a project using the inputted strings as sources. /// - /// Classes in the form of strings - /// The language the source code is in + /// Classes in the form of strings. + /// The language the source code is in. /// A Project created out of the Documents created from the source strings private static Project CreateProject(string[] sources, string language = LanguageNames.CSharp) { diff --git a/test/Discord.Net.Analyzers.Tests/Verifiers/CodeFixVerifier.cs b/test/Discord.Net.Analyzers.Tests/Verifiers/CodeFixVerifier.cs index 5d057b610..d1cb6cd1b 100644 --- a/test/Discord.Net.Analyzers.Tests/Verifiers/CodeFixVerifier.cs +++ b/test/Discord.Net.Analyzers.Tests/Verifiers/CodeFixVerifier.cs @@ -1,4 +1,4 @@ -using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; @@ -38,10 +38,10 @@ namespace TestHelper /// /// Called to test a C# codefix when applied on the inputted string as a source /// - /// A class in the form of a string before the CodeFix was applied to it - /// A class in the form of a string after the CodeFix was applied to it - /// Index determining which codefix to apply if there are multiple - /// A bool controlling whether or not the test will fail if the CodeFix introduces other warnings after being applied + /// A class in the form of a string before the CodeFix was applied to it. + /// A class in the form of a string after the CodeFix was applied to it. + /// Index determining which codefix to apply if there are multiple. + /// A bool controlling whether or not the test will fail if the CodeFix introduces other warnings after being applied. protected void VerifyCSharpFix(string oldSource, string newSource, int? codeFixIndex = null, bool allowNewCompilerDiagnostics = false) { VerifyFix(LanguageNames.CSharp, GetCSharpDiagnosticAnalyzer(), GetCSharpCodeFixProvider(), oldSource, newSource, codeFixIndex, allowNewCompilerDiagnostics); @@ -50,10 +50,10 @@ namespace TestHelper /// /// Called to test a VB codefix when applied on the inputted string as a source /// - /// A class in the form of a string before the CodeFix was applied to it - /// A class in the form of a string after the CodeFix was applied to it - /// Index determining which codefix to apply if there are multiple - /// A bool controlling whether or not the test will fail if the CodeFix introduces other warnings after being applied + /// A class in the form of a string before the CodeFix was applied to it. + /// A class in the form of a string after the CodeFix was applied to it. + /// Index determining which codefix to apply if there are multiple. + /// A bool controlling whether or not the test will fail if the CodeFix introduces other warnings after being applied. protected void VerifyBasicFix(string oldSource, string newSource, int? codeFixIndex = null, bool allowNewCompilerDiagnostics = false) { VerifyFix(LanguageNames.VisualBasic, GetBasicDiagnosticAnalyzer(), GetBasicCodeFixProvider(), oldSource, newSource, codeFixIndex, allowNewCompilerDiagnostics); @@ -65,13 +65,13 @@ namespace TestHelper /// Then gets the string after the codefix is applied and compares it with the expected result. /// Note: If any codefix causes new diagnostics to show up, the test fails unless allowNewCompilerDiagnostics is set to true. /// - /// The language the source code is in - /// The analyzer to be applied to the source code - /// The codefix to be applied to the code wherever the relevant Diagnostic is found - /// A class in the form of a string before the CodeFix was applied to it - /// A class in the form of a string after the CodeFix was applied to it - /// Index determining which codefix to apply if there are multiple - /// A bool controlling whether or not the test will fail if the CodeFix introduces other warnings after being applied + /// The language the source code is in. + /// The analyzer to be applied to the source code. + /// The codefix to be applied to the code wherever the relevant Diagnostic is found. + /// A class in the form of a string before the CodeFix was applied to it. + /// A class in the form of a string after the CodeFix was applied to it. + /// Index determining which codefix to apply if there are multiple. + /// A bool controlling whether or not the test will fail if the CodeFix introduces other warnings after being applied. private void VerifyFix(string language, DiagnosticAnalyzer analyzer, CodeFixProvider codeFixProvider, string oldSource, string newSource, int? codeFixIndex, bool allowNewCompilerDiagnostics) { var document = CreateDocument(oldSource, language); @@ -126,4 +126,4 @@ namespace TestHelper Assert.Equal(newSource, actual); } } -} \ No newline at end of file +} diff --git a/test/Discord.Net.Analyzers.Tests/Verifiers/DiagnosticVerifier.cs b/test/Discord.Net.Analyzers.Tests/Verifiers/DiagnosticVerifier.cs index 3564093f8..9b0219a63 100644 --- a/test/Discord.Net.Analyzers.Tests/Verifiers/DiagnosticVerifier.cs +++ b/test/Discord.Net.Analyzers.Tests/Verifiers/DiagnosticVerifier.cs @@ -37,8 +37,8 @@ namespace TestHelper /// Called to test a C# DiagnosticAnalyzer when applied on the single inputted string as a source /// Note: input a DiagnosticResult for each Diagnostic expected /// - /// A class in the form of a string to run the analyzer on - /// DiagnosticResults that should appear after the analyzer is run on the source + /// A class in the form of a string to run the analyzer on. + /// DiagnosticResults that should appear after the analyzer is run on the source. protected void VerifyCSharpDiagnostic(string source, params DiagnosticResult[] expected) { VerifyDiagnostics(new[] { source }, LanguageNames.CSharp, GetCSharpDiagnosticAnalyzer(), expected); @@ -48,8 +48,8 @@ namespace TestHelper /// Called to test a VB DiagnosticAnalyzer when applied on the single inputted string as a source /// Note: input a DiagnosticResult for each Diagnostic expected /// - /// A class in the form of a string to run the analyzer on - /// DiagnosticResults that should appear after the analyzer is run on the source + /// A class in the form of a string to run the analyzer on. + /// DiagnosticResults that should appear after the analyzer is run on the source. protected void VerifyBasicDiagnostic(string source, params DiagnosticResult[] expected) { VerifyDiagnostics(new[] { source }, LanguageNames.VisualBasic, GetBasicDiagnosticAnalyzer(), expected); @@ -59,8 +59,8 @@ namespace TestHelper /// Called to test a C# DiagnosticAnalyzer when applied on the inputted strings as a source /// Note: input a DiagnosticResult for each Diagnostic expected /// - /// An array of strings to create source documents from to run the analyzers on - /// DiagnosticResults that should appear after the analyzer is run on the sources + /// An array of strings to create source documents from to run the analyzers on. + /// DiagnosticResults that should appear after the analyzer is run on the sources. protected void VerifyCSharpDiagnostic(string[] sources, params DiagnosticResult[] expected) { VerifyDiagnostics(sources, LanguageNames.CSharp, GetCSharpDiagnosticAnalyzer(), expected); @@ -70,8 +70,8 @@ namespace TestHelper /// Called to test a VB DiagnosticAnalyzer when applied on the inputted strings as a source /// Note: input a DiagnosticResult for each Diagnostic expected /// - /// An array of strings to create source documents from to run the analyzers on - /// DiagnosticResults that should appear after the analyzer is run on the sources + /// An array of strings to create source documents from to run the analyzers on. + /// DiagnosticResults that should appear after the analyzer is run on the sources. protected void VerifyBasicDiagnostic(string[] sources, params DiagnosticResult[] expected) { VerifyDiagnostics(sources, LanguageNames.VisualBasic, GetBasicDiagnosticAnalyzer(), expected); @@ -81,10 +81,10 @@ namespace TestHelper /// General method that gets a collection of actual diagnostics found in the source after the analyzer is run, /// then verifies each of them. /// - /// An array of strings to create source documents from to run the analyzers on - /// The language of the classes represented by the source strings - /// The analyzer to be run on the source code - /// DiagnosticResults that should appear after the analyzer is run on the sources + /// An array of strings to create source documents from to run the analyzers on. + /// The language of the classes represented by the source strings. + /// The analyzer to be run on the source code. + /// DiagnosticResults that should appear after the analyzer is run on the sources. private void VerifyDiagnostics(string[] sources, string language, DiagnosticAnalyzer analyzer, params DiagnosticResult[] expected) { var diagnostics = GetSortedDiagnostics(sources, language, analyzer); @@ -98,9 +98,9 @@ namespace TestHelper /// Checks each of the actual Diagnostics found and compares them with the corresponding DiagnosticResult in the array of expected results. /// Diagnostics are considered equal only if the DiagnosticResultLocation, Id, Severity, and Message of the DiagnosticResult match the actual diagnostic. /// - /// The Diagnostics found by the compiler after running the analyzer on the source code - /// The analyzer that was being run on the sources - /// Diagnostic Results that should have appeared in the code + /// The Diagnostics found by the compiler after running the analyzer on the source code. + /// The analyzer that was being run on the sources. + /// Diagnostic Results that should have appeared in the code. private static void VerifyDiagnosticResults(IEnumerable actualResults, DiagnosticAnalyzer analyzer, params DiagnosticResult[] expectedResults) { int expectedCount = expectedResults.Length; @@ -173,10 +173,10 @@ namespace TestHelper /// /// Helper method to VerifyDiagnosticResult that checks the location of a diagnostic and compares it with the location in the expected DiagnosticResult. /// - /// The analyzer that was being run on the sources - /// The diagnostic that was found in the code - /// The Location of the Diagnostic found in the code - /// The DiagnosticResultLocation that should have been found + /// The analyzer that was being run on the sources. + /// The diagnostic that was found in the code. + /// The Location of the Diagnostic found in the code. + /// The DiagnosticResultLocation that should have been found. private static void VerifyDiagnosticLocation(DiagnosticAnalyzer analyzer, Diagnostic diagnostic, Location actual, DiagnosticResultLocation expected) { var actualSpan = actual.GetLineSpan(); @@ -215,8 +215,8 @@ namespace TestHelper /// /// Helper method to format a Diagnostic into an easily readable string /// - /// The analyzer that this verifier tests - /// The Diagnostics to be formatted + /// The analyzer that this verifier tests. + /// The Diagnostics to be formatted. /// The Diagnostics formatted as a string private static string FormatDiagnostics(DiagnosticAnalyzer analyzer, params Diagnostic[] diagnostics) {