diff --git a/src/Discord.Net.Core/Entities/Interactions/IApplicationCommand.cs b/src/Discord.Net.Core/Entities/Interactions/IApplicationCommand.cs index e30d795ff..daa80cfff 100644 --- a/src/Discord.Net.Core/Entities/Interactions/IApplicationCommand.cs +++ b/src/Discord.Net.Core/Entities/Interactions/IApplicationCommand.cs @@ -53,7 +53,7 @@ namespace Discord /// Gets the localized name of this command. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// string? NameLocalized { get; } @@ -61,7 +61,7 @@ namespace Discord /// Gets the localized description of this command. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// string? DescriptionLocalized { get; } diff --git a/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOption.cs b/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOption.cs index 68bf00ebf..f3064abda 100644 --- a/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOption.cs +++ b/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOption.cs @@ -76,7 +76,7 @@ namespace Discord /// Gets the localized name of this command. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// string? NameLocalized { get; } diff --git a/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOptionChoice.cs b/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOptionChoice.cs index 66d0f1b9b..4d420cc9e 100644 --- a/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOptionChoice.cs +++ b/src/Discord.Net.Core/Entities/Interactions/IApplicationCommandOptionChoice.cs @@ -26,7 +26,7 @@ namespace Discord /// Gets the localized name of this command. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// string? NameLocalized { get; } } diff --git a/src/Discord.Net.Core/RequestOptions.cs b/src/Discord.Net.Core/RequestOptions.cs index 46aa2681f..6ae3dd8dc 100644 --- a/src/Discord.Net.Core/RequestOptions.cs +++ b/src/Discord.Net.Core/RequestOptions.cs @@ -1,5 +1,6 @@ using Discord.Net; using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -19,7 +20,7 @@ namespace Discord /// Gets or sets the maximum time to wait for this request to complete. /// /// - /// Gets or set the max time, in milliseconds, to wait for this request to complete. If + /// Gets or set the max time, in milliseconds, to wait for this request to complete. If /// null, a request will not time out. If a rate limit has been triggered for this request's bucket /// and will not be unpaused in time, this request will fail immediately. /// @@ -53,7 +54,7 @@ namespace Discord /// /// /// This property can also be set in . - /// On a per-request basis, the system clock should only be disabled + /// On a per-request basis, the system clock should only be disabled /// when millisecond precision is especially important, and the /// hosting system is known to have a desynced clock. /// @@ -64,6 +65,8 @@ namespace Discord /// public Func RatelimitCallback { get; set; } + public IEnumerable>> RequestHeaders { get; } = new Dictionary>(); + internal bool IgnoreState { get; set; } internal BucketId BucketId { get; set; } internal bool IsClientBucket { get; set; } @@ -71,7 +74,7 @@ namespace Discord internal bool IsGatewayBucket { get; set; } internal static RequestOptions CreateOrClone(RequestOptions options) - { + { if (options == null) return new RequestOptions(); else @@ -97,7 +100,7 @@ namespace Discord { Timeout = DiscordConfig.DefaultRequestTimeout; } - + public RequestOptions Clone() => MemberwiseClone() as RequestOptions; } } diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs index 9b09d5157..709d4785f 100644 --- a/src/Discord.Net.Rest/DiscordRestApiClient.cs +++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs @@ -1193,7 +1193,8 @@ namespace Discord.API { options = RequestOptions.CreateOrClone(options); - return await SendAsync("GET", () => $"applications/{CurrentApplicationId}/commands?with_localizations={withLocalizations}", + //with_localizations=false doesnt return localized names and descriptions + return await SendAsync("GET", () => $"applications/{CurrentApplicationId}/commands{(withLocalizations ? "?with_localizations=true" : string.Empty)}", new BucketIds(), options: options).ConfigureAwait(false); } @@ -1265,7 +1266,8 @@ namespace Discord.API var bucket = new BucketIds(guildId: guildId); - return await SendAsync("GET", () => $"applications/{CurrentApplicationId}/guilds/{guildId}/commands?with_localizations={withLocalizations}", + //with_localizations=false doesnt return localized names and descriptions + return await SendAsync("GET", () => $"applications/{CurrentApplicationId}/commands{(withLocalizations ? "?with_localizations=true" : string.Empty)}", bucket, options: options).ConfigureAwait(false); } diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs index cd7b5d4b9..dc5bc2374 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs @@ -46,7 +46,7 @@ namespace Discord.Rest /// Gets the localized name of this command. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// public string? NameLocalized { get; private set; } @@ -54,7 +54,7 @@ namespace Discord.Rest /// Gets the localized description of this command. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to 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 164e74019..14e1e33ab 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandChoice.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandChoice.cs @@ -24,7 +24,7 @@ namespace Discord.Rest /// Gets the localized name of this command option choice. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// public string? NameLocalized { get; } diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs index cf1fc0978..d566de869 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs @@ -62,7 +62,7 @@ namespace Discord.Rest /// Gets the localized name of this command option. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// public string? NameLocalized { get; private set; } @@ -70,7 +70,7 @@ namespace Discord.Rest /// Gets the localized description of this command option. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// public string? DescriptionLocalized { get; private set; } diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs index d7832f4e3..0162e76d0 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs @@ -58,7 +58,7 @@ namespace Discord.WebSocket /// Gets the localized name of this command. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// public string? NameLocalized { get; private set; } @@ -66,7 +66,7 @@ namespace Discord.WebSocket /// Gets the localized description of this command. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to 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 a369c74db..83b75d060 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandChoice.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandChoice.cs @@ -24,7 +24,7 @@ namespace Discord.WebSocket /// Gets the localized name of this command option choice. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// public string? NameLocalized { get; private set; } diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs index 0cf5cde56..38cb92e03 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs @@ -62,7 +62,7 @@ namespace Discord.WebSocket /// Gets the localized name of this command option. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// public string? NameLocalized { get; private set; } @@ -70,7 +70,7 @@ namespace Discord.WebSocket /// Gets the localized description of this command option. /// /// - /// Only returned when the `withLocalizations` query parameter is set to true when requesting the command. + /// Only returned when the `withLocalizations` query parameter is set to when requesting the command. /// public string? DescriptionLocalized { get; private set; }