fix(AutocompleteInteraction): Prevent snake casing of locales (#9565)

* fix(AutocompleteInteraction): prevent snake casing of locales

* fix: avoid unnecessary overhead ops

Co-authored-by: Aura Román <kyradiscord@gmail.com>

---------

Co-authored-by: Aura Román <kyradiscord@gmail.com>
This commit is contained in:
Jiralite
2023-05-12 23:03:10 +01:00
committed by GitHub
parent 5351ab429b
commit 7196fe36e8

View File

@@ -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,
});