From 7196fe36e8089dde7bcaf0db4dd09cf524125e0c Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Fri, 12 May 2023 23:03:10 +0100 Subject: [PATCH] fix(AutocompleteInteraction): Prevent snake casing of locales (#9565) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(AutocompleteInteraction): prevent snake casing of locales * fix: avoid unnecessary overhead ops Co-authored-by: Aura Román --------- Co-authored-by: Aura Román --- .../discord.js/src/structures/AutocompleteInteraction.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/discord.js/src/structures/AutocompleteInteraction.js b/packages/discord.js/src/structures/AutocompleteInteraction.js index e54a71f0bd75..4b7e39eee69e 100644 --- a/packages/discord.js/src/structures/AutocompleteInteraction.js +++ b/packages/discord.js/src/structures/AutocompleteInteraction.js @@ -86,7 +86,12 @@ class AutocompleteInteraction extends BaseInteraction { await this.client.rest.post(Routes.interactionCallback(this.id, this.token), { body: { type: InteractionResponseType.ApplicationCommandAutocompleteResult, - data: { choices: this.client.options.jsonTransformer(options) }, + data: { + choices: options.map(({ nameLocalizations, ...option }) => ({ + ...this.client.options.jsonTransformer(option), + name_localizations: nameLocalizations, + })), + }, }, auth: false, });