mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 00:40:07 +00:00
Currently we import from `index.js` files where we could simply import the actual file(s) or module we need. This also creates a bit of confusion since it isn't obvious from where stuff is coming from, especially when we are importing types such as `Discord<XYZ>` types both from `@discordeno/types` and a `index.js` in the same file, one such example is `transformers/reverse/component.ts`. As far as I can tell, this does not have any specific advantage beside readability, maybe something with tree-shaking. (and for us, tree-shaking doesn't really matter) The only files that still import index.js files are: - index.js files themself - bot/src/handlers.js since it does a `import * as handlers from './handlers/index.js'` and the alternative is like 90 lines of imports Co-authored-by: Link <link20050703@gmail.com>
14 lines
643 B
TypeScript
14 lines
643 B
TypeScript
import type { DiscordApplicationCommandOptionChoice } from '@discordeno/types'
|
|
import type { Bot } from '../bot.js'
|
|
import type { ApplicationCommandOptionChoice } from './types.js'
|
|
|
|
export function transformApplicationCommandOptionChoice(bot: Bot, payload: DiscordApplicationCommandOptionChoice): ApplicationCommandOptionChoice {
|
|
const applicationCommandOptionChoice = {
|
|
name: payload.name,
|
|
nameLocalizations: payload.name_localizations ?? undefined,
|
|
value: payload.value,
|
|
} as ApplicationCommandOptionChoice
|
|
|
|
return bot.transformers.customizers.applicationCommandOptionChoice(bot, payload, applicationCommandOptionChoice)
|
|
}
|