Files
discordeno/transformers/applicationCommandOptionChoice.ts
ITOH 34a358f8bf feat(helpers,types)!: slash command localization (#2129)
* feat(helpers,types): slash command localization
Discord has documented the slash command localization feature now.
This adds the full functionality for those to Discordeno.

Additionally a `Locales` has also been added to allow for better typing.

Reference: https://github.com/discord/discord-api-docs/pull/4653

* suggestion

* better locales type

* f

* fix serializing

* stupid direct pushes

* b
2022-03-27 11:02:27 -04:00

16 lines
649 B
TypeScript

import { Bot } from "../bot.ts";
import { DiscordApplicationCommandOptionChoice } from "../types/discord.ts";
import { Camelize, Localization, Optionalize } from "../types/shared.ts";
export function transformApplicationCommandOptionChoice(bot: Bot, payload: DiscordApplicationCommandOptionChoice) {
const applicationCommandChoice = {
name: payload.name,
nameLocalizations: payload.name_localizations,
value: payload.value,
};
return applicationCommandChoice as Optionalize<typeof applicationCommandChoice>;
}
export interface ApplicationCommandOptionChoice extends ReturnType<typeof transformApplicationCommandOptionChoice> {}