fix: export transformers na dhandler (#2959)

Co-authored-by: ITOH <to@itoh.at>
This commit is contained in:
Skillz4Killz
2023-04-03 17:28:11 +00:00
committed by GitHub
co-authored by ITOH
parent aff0d47acd
commit 04d7db89a5
6 changed files with 13 additions and 50 deletions
+2
View File
@@ -3,6 +3,8 @@ export * from '@discordeno/rest'
export * from '@discordeno/types'
export * from '@discordeno/utils'
export * from './bot.js'
export * from './handlers/index.js'
export * from './handlers.js'
export * from './transformers/index.js'
export * from './transformers.js'
export * from './utils.js'
+2 -4
View File
@@ -1,7 +1,5 @@
import type {
AllowedMentions,
ApplicationCommandOption,
ApplicationCommandOptionChoice,
BigString,
CreateApplicationCommand,
DiscordActivity,
@@ -48,8 +46,8 @@ import { bigintToSnowflake, snowflakeToBigint, type Bot } from './index.js'
import { transformActivity, type Activity } from './transformers/activity.js'
import { transformApplication, type Application } from './transformers/application.js'
import { transformApplicationCommand, type ApplicationCommand } from './transformers/applicationCommand.js'
import { transformApplicationCommandOption } from './transformers/applicationCommandOption.js'
import { transformApplicationCommandOptionChoice } from './transformers/applicationCommandOptionChoice.js'
import { transformApplicationCommandOption, type ApplicationCommandOption } from './transformers/applicationCommandOption.js'
import { transformApplicationCommandOptionChoice, type ApplicationCommandOptionChoice } from './transformers/applicationCommandOptionChoice.js'
import { transformApplicationCommandPermission, type ApplicationCommandPermission } from './transformers/applicationCommandPermission.js'
import { transformAttachment, type Attachment } from './transformers/attachment.js'
import { transformAuditLogEntry, type AuditLogEntry } from './transformers/auditLogEntry.js'
@@ -1,9 +1,9 @@
import type { Bot, DiscordApplicationCommandOptionChoice } from '../../index.js'
import type { Bot, Camelize, DiscordApplicationCommandOptionChoice } from '../../index.js'
import type { ApplicationCommandOptionChoice } from '../applicationCommandOptionChoice.js'
export function transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice(
bot: Bot,
payload: ApplicationCommandOptionChoice,
payload: ApplicationCommandOptionChoice | Camelize<DiscordApplicationCommandOptionChoice>,
): DiscordApplicationCommandOptionChoice {
return {
name: payload.name,
@@ -1,5 +1,5 @@
import { calculateBits } from '@discordeno/utils'
import type { Bot, CreateApplicationCommand, DiscordCreateApplicationCommand } from '../../index.js'
import type { ApplicationCommandOption, Bot, CreateApplicationCommand, DiscordCreateApplicationCommand } from '../../index.js'
import { isContextApplicationCommand } from '../../typings.js'
export function transformCreateApplicationCommandToDiscordCreateApplicationCommand(
@@ -24,7 +24,7 @@ export function transformCreateApplicationCommandToDiscordCreateApplicationComma
description: payload.description,
description_localizations: payload.descriptionLocalizations,
type: payload.type,
options: payload.options?.map((option) => bot.transformers.reverse.applicationCommandOption(bot, option)),
options: payload.options?.map((option) => bot.transformers.reverse.applicationCommandOption(bot, option as unknown as ApplicationCommandOption)),
default_member_permissions: payload.defaultMemberPermissions ? calculateBits(payload.defaultMemberPermissions) : null,
dm_permission: payload.dmPermission,
}
+1 -1
View File
@@ -1,7 +1,6 @@
import {
ApplicationCommandTypes,
type AllowedMentions,
type ApplicationCommandOptionChoice,
type ButtonStyles,
type CreateApplicationCommand,
type CreateContextApplicationCommand,
@@ -23,6 +22,7 @@ import {
} from '@discordeno/types'
import type * as handlers from './handlers/index.js'
import type { Embed } from './transformers/embed.js'
import type { ApplicationCommandOptionChoice } from './transformers/applicationCommandOptionChoice.js'
export function isContextApplicationCommand(command: CreateApplicationCommand): command is CreateContextApplicationCommand {
return command.type === ApplicationCommandTypes.Message || command.type === ApplicationCommandTypes.User