From 7d85b2ab670fd7be6a106900e7726f8247b8aaf9 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Fri, 4 Sep 2026 13:40:25 +0100 Subject: [PATCH] fix(applicationCommands): allow `X-Discord-Locale` (#11616) fix(applicationCommands): allow locale header --- packages/core/src/api/applicationCommands.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/src/api/applicationCommands.ts b/packages/core/src/api/applicationCommands.ts index 29fde7cea..7d9fc2a2a 100644 --- a/packages/core/src/api/applicationCommands.ts +++ b/packages/core/src/api/applicationCommands.ts @@ -3,6 +3,7 @@ import { makeURLSearchParams, type RequestData, type REST } from '@discordjs/rest'; import { Routes, + type Locale, type RESTGetAPIApplicationCommandPermissionsResult, type RESTGetAPIApplicationCommandResult, type RESTGetAPIApplicationCommandsQuery, @@ -42,9 +43,10 @@ export class ApplicationCommandsAPI { public async getGlobalCommands( applicationId: Snowflake, query: RESTGetAPIApplicationCommandsQuery = {}, - { signal }: Pick = {}, + { locale, signal }: Pick & { locale?: Locale } = {}, ) { return this.rest.get(Routes.applicationCommands(applicationId), { + headers: locale ? { 'X-Discord-Locale': locale } : {}, query: makeURLSearchParams(query), signal, }) as Promise; @@ -156,9 +158,10 @@ export class ApplicationCommandsAPI { applicationId: Snowflake, guildId: Snowflake, query: RESTGetAPIApplicationGuildCommandsQuery = {}, - { signal }: Pick = {}, + { locale, signal }: Pick & { locale?: Locale } = {}, ) { return this.rest.get(Routes.applicationGuildCommands(applicationId, guildId), { + headers: locale ? { 'X-Discord-Locale': locale } : {}, query: makeURLSearchParams(query), signal, }) as Promise;