From ebb1c752531f01b38e881bc810eff2c7f4868164 Mon Sep 17 00:00:00 2001 From: Cenngo Date: Sat, 23 Apr 2022 20:01:44 +0300 Subject: [PATCH] add missing inline docs --- .../ContextMenus/UserCommandBuilder.cs | 2 +- .../SlashCommands/SlashCommandBuilder.cs | 28 +++++++++++++++++++ src/Discord.Net.Core/IDiscordClient.cs | 1 + .../Extensions/LocalizationExtensions.cs | 9 ------ .../Interactions/RestApplicationCommand.cs | 18 ++++++++++++ .../RestApplicationCommandChoice.cs | 9 ++++++ .../RestApplicationCommandOption.cs | 18 ++++++++++++ .../SocketApplicationCommand.cs | 18 ++++++++++++ .../SocketApplicationCommandChoice.cs | 9 ++++++ .../SocketApplicationCommandOption.cs | 18 ++++++++++++ 10 files changed, 120 insertions(+), 10 deletions(-) delete mode 100644 src/Discord.Net.Interactions/Extensions/LocalizationExtensions.cs diff --git a/src/Discord.Net.Core/Entities/Interactions/ContextMenus/UserCommandBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/ContextMenus/UserCommandBuilder.cs index 7c94dcb25..51bf965fa 100644 --- a/src/Discord.Net.Core/Entities/Interactions/ContextMenus/UserCommandBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/ContextMenus/UserCommandBuilder.cs @@ -87,7 +87,7 @@ namespace Discord /// Sets the collection. /// /// Localization dictionary for the name field of this command. - /// + /// The current builder. /// Thrown if is null. /// Thrown if any dictionary key is an invalid locale string. public UserCommandBuilder WithNameLocalizations(IDictionary nameLocalizations) diff --git a/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs b/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs index 2a6862fd3..73445072f 100644 --- a/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs +++ b/src/Discord.Net.Core/Entities/Interactions/SlashCommands/SlashCommandBuilder.cs @@ -787,6 +787,13 @@ namespace Discord return this; } + /// + /// Sets the collection. + /// + /// Localization dictionary for the name field of this command. + /// The current builder. + /// Thrown if is null. + /// Thrown if any dictionary key is an invalid locale string. public SlashCommandOptionBuilder WithNameLocalizations(IDictionary nameLocalizations) { if (nameLocalizations is null) @@ -804,6 +811,13 @@ namespace Discord return this; } + /// + /// Sets the collection. + /// + /// Localization dictionary for the description field of this command. + /// The current builder. + /// Thrown if is null. + /// Thrown if any dictionary key is an invalid locale string. public SlashCommandOptionBuilder WithDescriptionLocalizations(IDictionary descriptionLocalizations) { if (descriptionLocalizations is null) @@ -821,6 +835,13 @@ namespace Discord return this; } + /// + /// Adds a new entry to the collection. + /// + /// Locale of the entry. + /// Localized string for the name field. + /// The current builder. + /// Thrown if is an invalid locale string. public SlashCommandOptionBuilder AddNameLocalization(string locale, string name) { if(!Regex.IsMatch(locale, @"^\w{2}(?:-\w{2})?$")) @@ -834,6 +855,13 @@ namespace Discord return this; } + /// + /// Adds a new entry to the collection. + /// + /// Locale of the entry. + /// Localized string for the description field. + /// The current builder. + /// Thrown if is an invalid locale string. public SlashCommandOptionBuilder AddDescriptionLocalization(string locale, string description) { if(!Regex.IsMatch(locale, @"^\w{2}(?:-\w{2})?$")) diff --git a/src/Discord.Net.Core/IDiscordClient.cs b/src/Discord.Net.Core/IDiscordClient.cs index 939c04f89..ed32b182a 100644 --- a/src/Discord.Net.Core/IDiscordClient.cs +++ b/src/Discord.Net.Core/IDiscordClient.cs @@ -155,6 +155,7 @@ namespace Discord /// /// Gets a collection of all global commands. /// + /// Whether to include full localization dictionaries in the returned objects, instead of the name localized and description localized fields. /// 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 global diff --git a/src/Discord.Net.Interactions/Extensions/LocalizationExtensions.cs b/src/Discord.Net.Interactions/Extensions/LocalizationExtensions.cs deleted file mode 100644 index 000996f87..000000000 --- a/src/Discord.Net.Interactions/Extensions/LocalizationExtensions.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Discord.Interactions.Extensions; - -public static class LocalizationExtensions -{ - public static void UseResxLocalization(this InteractionServiceConfig config) - { - - } -} diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs index 50d3f15e5..cd7b5d4b9 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs @@ -32,12 +32,30 @@ namespace Discord.Rest /// public IReadOnlyCollection Options { get; private set; } + /// + /// Gets the localization dictionary for the name field of this command. + /// public IReadOnlyDictionary? NameLocalizations { get; private set; } + /// + /// Gets the localization dictionary for the description field of this command. + /// public IReadOnlyDictionary? DescriptionLocalizations { get; private set; } + /// + /// Gets the localized name of this command. + /// + /// + /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// public string? NameLocalized { get; private set; } + /// + /// Gets the localized description of this command. + /// + /// + /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// public string? DescriptionLocalized { get; private set; } /// diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandChoice.cs b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandChoice.cs index 0c30b61a1..164e74019 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandChoice.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandChoice.cs @@ -15,8 +15,17 @@ namespace Discord.Rest /// public object Value { get; } + /// + /// Gets the localization dictionary for the name field of this command option choice. + /// public IReadOnlyDictionary? NameLocalizations { get; } + /// + /// Gets the localized name of this command option choice. + /// + /// + /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// public string? NameLocalized { get; } internal RestApplicationCommandChoice(Model model) diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs index e07911706..cf1fc0978 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs @@ -48,12 +48,30 @@ namespace Discord.Rest /// public IReadOnlyCollection ChannelTypes { get; private set; } + /// + /// Gets the localization dictionary for the name field of this command option. + /// public IReadOnlyDictionary? NameLocalizations { get; private set; } + /// + /// Gets the localization dictionary for the description field of this command option. + /// public IReadOnlyDictionary? DescriptionLocalizations { get; private set; } + /// + /// Gets the localized name of this command option. + /// + /// + /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// public string? NameLocalized { get; private set; } + /// + /// Gets the localized description of this command option. + /// + /// + /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// public string? DescriptionLocalized { get; private set; } internal RestApplicationCommandOption() { } diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs index 3ec37dbe1..d7832f4e3 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs @@ -44,12 +44,30 @@ namespace Discord.WebSocket /// public IReadOnlyCollection Options { get; private set; } + /// + /// Gets the localization dictionary for the name field of this command. + /// public IReadOnlyDictionary? NameLocalizations { get; private set; } + /// + /// Gets the localization dictionary for the description field of this command. + /// public IReadOnlyDictionary? DescriptionLocalizations { get; private set; } + /// + /// Gets the localized name of this command. + /// + /// + /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// public string? NameLocalized { get; private set; } + /// + /// Gets the localized description of this command. + /// + /// + /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// public string? DescriptionLocalized { get; private set; } /// diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandChoice.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandChoice.cs index 0a04b8fae..a369c74db 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandChoice.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandChoice.cs @@ -15,8 +15,17 @@ namespace Discord.WebSocket /// public object Value { get; private set; } + /// + /// Gets the localization dictionary for the name field of this command option choice. + /// public IReadOnlyDictionary? NameLocalizations { get; private set; } + /// + /// Gets the localized name of this command option choice. + /// + /// + /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// public string? NameLocalized { get; private set; } internal SocketApplicationCommandChoice() { } diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs index 7abdfcd51..0cf5cde56 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs @@ -48,12 +48,30 @@ namespace Discord.WebSocket /// public IReadOnlyCollection ChannelTypes { get; private set; } + /// + /// Gets the localization dictionary for the name field of this command option. + /// public IReadOnlyDictionary? NameLocalizations { get; private set; } + /// + /// Gets the localization dictionary for the description field of this command option. + /// public IReadOnlyDictionary? DescriptionLocalizations { get; private set; } + /// + /// Gets the localized name of this command option. + /// + /// + /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// public string? NameLocalized { get; private set; } + /// + /// Gets the localized description of this command option. + /// + /// + /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// public string? DescriptionLocalized { get; private set; } internal SocketApplicationCommandOption() { }