mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 16:30:08 +00:00
* 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
16 lines
649 B
TypeScript
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> {}
|