mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix: export transformers na dhandler (#2959)
Co-authored-by: ITOH <to@itoh.at>
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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,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
|
||||
|
||||
@@ -2,6 +2,8 @@ import type {
|
||||
AutoModerationActionType,
|
||||
AutoModerationEventTypes,
|
||||
AutoModerationTriggerTypes,
|
||||
DiscordApplicationCommandOption,
|
||||
DiscordApplicationCommandOptionChoice,
|
||||
DiscordAttachment,
|
||||
DiscordAutoModerationRuleTriggerMetadataPresets,
|
||||
DiscordChannel,
|
||||
@@ -10,7 +12,6 @@ import type {
|
||||
} from './discord.js'
|
||||
import type {
|
||||
AllowedMentionsTypes,
|
||||
ApplicationCommandOptionTypes,
|
||||
ApplicationCommandPermissionTypes,
|
||||
ApplicationCommandTypes,
|
||||
AuditLogEvents,
|
||||
@@ -401,7 +402,7 @@ export interface CreateSlashApplicationCommand {
|
||||
/** Type of command, defaults `ApplicationCommandTypes.ChatInput` if not set */
|
||||
type?: ApplicationCommandTypes
|
||||
/** Parameters for the command */
|
||||
options?: ApplicationCommandOption[]
|
||||
options?: Camelize<DiscordApplicationCommandOption[]>
|
||||
/** Set of permissions represented as a bit set */
|
||||
defaultMemberPermissions?: PermissionStrings[]
|
||||
/** Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. */
|
||||
@@ -437,14 +438,7 @@ export interface InteractionCallbackData {
|
||||
/** Message flags combined as a bit field (only SUPPRESS_EMBEDS and EPHEMERAL can be set) */
|
||||
flags?: number
|
||||
/** Autocomplete choices (max of 25 choices) */
|
||||
choices?: ApplicationCommandOptionChoice[]
|
||||
}
|
||||
|
||||
export interface ApplicationCommandOptionChoice {
|
||||
/** The name of the choice */
|
||||
name: string
|
||||
/** The value that this choice was represents. */
|
||||
value: string | number
|
||||
choices?: Camelize<DiscordApplicationCommandOptionChoice[]>
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/interactions/slash-commands#interaction-response */
|
||||
@@ -455,37 +449,6 @@ export interface InteractionResponse {
|
||||
data?: InteractionCallbackData
|
||||
}
|
||||
|
||||
export interface ApplicationCommandOption {
|
||||
/** Value of Application Command Option Type */
|
||||
type: ApplicationCommandOptionTypes
|
||||
/** 1-32 character name matching lowercase `^[\w-]{1,32}$` */
|
||||
name: string
|
||||
/** Localization object for the `name` field. Values follow the same restrictions as `name` */
|
||||
nameLocalizations?: Localization
|
||||
/** 1-100 character description */
|
||||
description: string
|
||||
/** Localization object for the `description` field. Values follow the same restrictions as `description` */
|
||||
descriptionLocalizations?: Localization
|
||||
/** If the parameter is required or optional--default `false` */
|
||||
required?: boolean
|
||||
/** Choices for `string` and `int` types for the user to pick from */
|
||||
choices?: ApplicationCommandOptionChoice[]
|
||||
/** If the option is a subcommand or subcommand group type, this nested options will be the parameters */
|
||||
options?: ApplicationCommandOption[]
|
||||
/** If the option is a channel type, the channels shown will be restricted to these types */
|
||||
channelTypes?: ChannelTypes[]
|
||||
/** Minimum number desired. */
|
||||
minValue?: number
|
||||
/** Maximum number desired. */
|
||||
maxValue?: number
|
||||
/** Minimum length desired. */
|
||||
minLength?: number
|
||||
/** Maximum length desired. */
|
||||
maxLength?: number
|
||||
/** if autocomplete interactions are enabled for this `String`, `Integer`, or `Number` type option */
|
||||
autocomplete?: boolean
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
|
||||
export interface CreateGuildEmoji {
|
||||
/** Name of the emoji */
|
||||
|
||||
Reference in New Issue
Block a user