mirror of
https://github.com/discordjs/discord.js.git
synced 2026-09-17 08:47:27 +00:00
fix(applicationCommands): allow X-Discord-Locale (#11616)
fix(applicationCommands): allow locale header
This commit is contained in:
@@ -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<RequestData, 'signal'> = {},
|
||||
{ locale, signal }: Pick<RequestData, 'signal'> & { locale?: Locale } = {},
|
||||
) {
|
||||
return this.rest.get(Routes.applicationCommands(applicationId), {
|
||||
headers: locale ? { 'X-Discord-Locale': locale } : {},
|
||||
query: makeURLSearchParams(query),
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIApplicationCommandsResult>;
|
||||
@@ -156,9 +158,10 @@ export class ApplicationCommandsAPI {
|
||||
applicationId: Snowflake,
|
||||
guildId: Snowflake,
|
||||
query: RESTGetAPIApplicationGuildCommandsQuery = {},
|
||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||
{ locale, signal }: Pick<RequestData, 'signal'> & { locale?: Locale } = {},
|
||||
) {
|
||||
return this.rest.get(Routes.applicationGuildCommands(applicationId, guildId), {
|
||||
headers: locale ? { 'X-Discord-Locale': locale } : {},
|
||||
query: makeURLSearchParams(query),
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIApplicationGuildCommandsResult>;
|
||||
|
||||
Reference in New Issue
Block a user