| @@ -87,7 +87,7 @@ namespace Discord | |||
| /// Sets the <see cref="NameLocalizations"/> collection. | |||
| /// </summary> | |||
| /// <param name="nameLocalizations">Localization dictionary for the name field of this command.</param> | |||
| /// <returns></returns> | |||
| /// <returns>The current builder.</returns> | |||
| /// <exception cref="ArgumentNullException">Thrown if <paramref name="nameLocalizations"/> is null.</exception> | |||
| /// <exception cref="ArgumentException">Thrown if any dictionary key is an invalid locale string.</exception> | |||
| public UserCommandBuilder WithNameLocalizations(IDictionary<string, string> nameLocalizations) | |||
| @@ -787,6 +787,13 @@ namespace Discord | |||
| return this; | |||
| } | |||
| /// <summary> | |||
| /// Sets the <see cref="NameLocalizations"/> collection. | |||
| /// </summary> | |||
| /// <param name="nameLocalizations">Localization dictionary for the name field of this command.</param> | |||
| /// <returns>The current builder.</returns> | |||
| /// <exception cref="ArgumentNullException">Thrown if <paramref name="nameLocalizations"/> is null.</exception> | |||
| /// <exception cref="ArgumentException">Thrown if any dictionary key is an invalid locale string.</exception> | |||
| public SlashCommandOptionBuilder WithNameLocalizations(IDictionary<string, string> nameLocalizations) | |||
| { | |||
| if (nameLocalizations is null) | |||
| @@ -804,6 +811,13 @@ namespace Discord | |||
| return this; | |||
| } | |||
| /// <summary> | |||
| /// Sets the <see cref="DescriptionLocalizations"/> collection. | |||
| /// </summary> | |||
| /// <param name="descriptionLocalizations">Localization dictionary for the description field of this command.</param> | |||
| /// <returns>The current builder.</returns> | |||
| /// <exception cref="ArgumentNullException">Thrown if <paramref name="nameLocalizations"/> is null.</exception> | |||
| /// <exception cref="ArgumentException">Thrown if any dictionary key is an invalid locale string.</exception> | |||
| public SlashCommandOptionBuilder WithDescriptionLocalizations(IDictionary<string, string> descriptionLocalizations) | |||
| { | |||
| if (descriptionLocalizations is null) | |||
| @@ -821,6 +835,13 @@ namespace Discord | |||
| return this; | |||
| } | |||
| /// <summary> | |||
| /// Adds a new entry to the <see cref="NameLocalizations"/> collection. | |||
| /// </summary> | |||
| /// <param name="locale">Locale of the entry.</param> | |||
| /// <param name="name">Localized string for the name field.</param> | |||
| /// <returns>The current builder.</returns> | |||
| /// <exception cref="ArgumentException">Thrown if <paramref name="locale"/> is an invalid locale string.</exception> | |||
| public SlashCommandOptionBuilder AddNameLocalization(string locale, string name) | |||
| { | |||
| if(!Regex.IsMatch(locale, @"^\w{2}(?:-\w{2})?$")) | |||
| @@ -834,6 +855,13 @@ namespace Discord | |||
| return this; | |||
| } | |||
| /// <summary> | |||
| /// Adds a new entry to the <see cref="DescriptionLocalizations"/> collection. | |||
| /// </summary> | |||
| /// <param name="locale">Locale of the entry.</param> | |||
| /// <param name="description">Localized string for the description field.</param> | |||
| /// <returns>The current builder.</returns> | |||
| /// <exception cref="ArgumentException">Thrown if <paramref name="locale"/> is an invalid locale string.</exception> | |||
| public SlashCommandOptionBuilder AddDescriptionLocalization(string locale, string description) | |||
| { | |||
| if(!Regex.IsMatch(locale, @"^\w{2}(?:-\w{2})?$")) | |||
| @@ -155,6 +155,7 @@ namespace Discord | |||
| /// <summary> | |||
| /// Gets a collection of all global commands. | |||
| /// </summary> | |||
| /// <param name="withLocalizations">Whether to include full localization dictionaries in the returned objects, instead of the name localized and description localized fields.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <returns> | |||
| /// A task that represents the asynchronous get operation. The task result contains a read-only collection of global | |||
| @@ -1,9 +0,0 @@ | |||
| namespace Discord.Interactions.Extensions; | |||
| public static class LocalizationExtensions | |||
| { | |||
| public static void UseResxLocalization(this InteractionServiceConfig config) | |||
| { | |||
| } | |||
| } | |||
| @@ -32,12 +32,30 @@ namespace Discord.Rest | |||
| /// </summary> | |||
| public IReadOnlyCollection<RestApplicationCommandOption> Options { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localization dictionary for the name field of this command. | |||
| /// </summary> | |||
| public IReadOnlyDictionary<string, string>? NameLocalizations { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localization dictionary for the description field of this command. | |||
| /// </summary> | |||
| public IReadOnlyDictionary<string, string>? DescriptionLocalizations { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localized name of this command. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. | |||
| /// </remarks> | |||
| public string? NameLocalized { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localized description of this command. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. | |||
| /// </remarks> | |||
| public string? DescriptionLocalized { get; private set; } | |||
| /// <inheritdoc/> | |||
| @@ -15,8 +15,17 @@ namespace Discord.Rest | |||
| /// <inheritdoc/> | |||
| public object Value { get; } | |||
| /// <summary> | |||
| /// Gets the localization dictionary for the name field of this command option choice. | |||
| /// </summary> | |||
| public IReadOnlyDictionary<string, string>? NameLocalizations { get; } | |||
| /// <summary> | |||
| /// Gets the localized name of this command option choice. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. | |||
| /// </remarks> | |||
| public string? NameLocalized { get; } | |||
| internal RestApplicationCommandChoice(Model model) | |||
| @@ -48,12 +48,30 @@ namespace Discord.Rest | |||
| /// <inheritdoc/> | |||
| public IReadOnlyCollection<ChannelType> ChannelTypes { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localization dictionary for the name field of this command option. | |||
| /// </summary> | |||
| public IReadOnlyDictionary<string, string>? NameLocalizations { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localization dictionary for the description field of this command option. | |||
| /// </summary> | |||
| public IReadOnlyDictionary<string, string>? DescriptionLocalizations { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localized name of this command option. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. | |||
| /// </remarks> | |||
| public string? NameLocalized { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localized description of this command option. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. | |||
| /// </remarks> | |||
| public string? DescriptionLocalized { get; private set; } | |||
| internal RestApplicationCommandOption() { } | |||
| @@ -44,12 +44,30 @@ namespace Discord.WebSocket | |||
| /// </remarks> | |||
| public IReadOnlyCollection<SocketApplicationCommandOption> Options { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localization dictionary for the name field of this command. | |||
| /// </summary> | |||
| public IReadOnlyDictionary<string, string>? NameLocalizations { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localization dictionary for the description field of this command. | |||
| /// </summary> | |||
| public IReadOnlyDictionary<string, string>? DescriptionLocalizations { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localized name of this command. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. | |||
| /// </remarks> | |||
| public string? NameLocalized { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localized description of this command. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. | |||
| /// </remarks> | |||
| public string? DescriptionLocalized { get; private set; } | |||
| /// <inheritdoc/> | |||
| @@ -15,8 +15,17 @@ namespace Discord.WebSocket | |||
| /// <inheritdoc/> | |||
| public object Value { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localization dictionary for the name field of this command option choice. | |||
| /// </summary> | |||
| public IReadOnlyDictionary<string, string>? NameLocalizations { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localized name of this command option choice. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. | |||
| /// </remarks> | |||
| public string? NameLocalized { get; private set; } | |||
| internal SocketApplicationCommandChoice() { } | |||
| @@ -48,12 +48,30 @@ namespace Discord.WebSocket | |||
| /// </summary> | |||
| public IReadOnlyCollection<ChannelType> ChannelTypes { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localization dictionary for the name field of this command option. | |||
| /// </summary> | |||
| public IReadOnlyDictionary<string, string>? NameLocalizations { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localization dictionary for the description field of this command option. | |||
| /// </summary> | |||
| public IReadOnlyDictionary<string, string>? DescriptionLocalizations { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localized name of this command option. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. | |||
| /// </remarks> | |||
| public string? NameLocalized { get; private set; } | |||
| /// <summary> | |||
| /// Gets the localized description of this command option. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. | |||
| /// </remarks> | |||
| public string? DescriptionLocalized { get; private set; } | |||
| internal SocketApplicationCommandOption() { } | |||