djs-commandsv2 docs
API Reference

API Reference

Public surface area of the @djs-commands/* packages.

This page lists every public symbol the framework exports. Each link jumps to the concept page that explains it in context — start there for examples and trade-offs.

@djs-commands/core

Commands

ExportKindPage
defineCommandfunctionCommands
CommandtypeCommands
AnyCommandtypeCommands
CommandRunContexttypeCommands
SlashRunContexttypeCommands
LegacyRunContexttypeCommands
CommandRuntypeCommands
CommandLegacyConfigtypeCommands

Options

ExportKindPage
CommandOption / CommandOptionstypeCommands → Options
StringOption, IntegerOption, NumberOption, BooleanOption, UserOption, ChannelOption, RoleOption, MentionableOption, AttachmentOptiontypeCommands → Options
ResolveOption / ResolveOptionstypeCommands → Options

Handler

ExportKindPage
createCommandHandlerfunctionCommands → Registering
CommandHandlertypeCommands
CommandHandlerOptionstypeCommands
HandlerLegacyConfigtypeCommands

Validators

ExportKindPage
ValidatortypeValidators
ValidatorContexttypeValidators
ValidationResulttypeValidators
ValidatorSourcetypeValidators
CanRunCommandtypeValidators

Cooldowns

ExportKindPage
CooldownConfigtypeCooldowns
CooldownTypetypeCooldowns → Types
CooldownActortypeCooldowns
CacheAdaptertypeCooldowns

Plugins

ExportKindPage
PluginManifesttypePlugins
PluginSetupContexttypePlugins

Storage

ExportKindPage
StoragetypeStorage
StorageWhere / StorageFindOptstypeStorage
runStorageConformancefunctionStorage → Custom adapter
GuildPrefixModel / GuildPrefixRowconst / typeStorage → Helpers
getGuildPrefix / setGuildPrefix / clearGuildPrefixfunctionStorage → Helpers
DisabledCommandsModel / DisabledCommandRowconst / typeStorage → Helpers
isCommandDisabled / disableCommand / enableCommandfunctionStorage → Helpers
ChannelLocksModel / ChannelLockRowconst / typeStorage → Helpers
getChannelLocks / lockCommandToChannel / unlockCommandFromChannelfunctionStorage → Helpers

Filesystem loader

ExportKindPage
loadCommandsFromDirfunctionCommands → Loading
loadEventsFromDirfunctionCommands → Loading
watchCommandsDirfunctionCommands → Loading

Events

ExportKindDescription
defineEventfunctionDefine a discord.js event handler with full type-safety.
EventDefinitiontypeThe shape defineEvent returns.

Components V2 (function API)

ExportReturns
containerContainerBuilder
sectionSectionBuilder
textDisplayTextDisplayBuilder
mediaGalleryMediaGalleryBuilder
separatorSeparatorBuilder
fileFileBuilder
thumbnailThumbnailBuilder
buttonButtonBuilder
actionRowActionRowBuilder
modalModalBuilder
textInputTextInputBuilder
radioGroup / checkboxGroupLabelBuilder

Each takes an *Options object — see Components V2 for full signatures and examples.

Legacy parser

ExportDescription
parseLegacyArgsParse a legacy message into a typed argument object using a command's options schema.
LegacyParseResultDiscriminated union of { ok: true; values } / { ok: false; reason }.

Context normalizers

ExportDescription
normalizeSlashContextBuild a SlashRunContext from a discord.js interaction.
normalizeLegacyContextBuild a LegacyRunContext from a discord.js message.

@djs-commands/jsx

ExportKindDescription
renderfunctionCompile a JSX tree into discord.js component builders.
renderModalfunctionCompile a <Modal> JSX tree into a ModalBuilder.
Container, Section, TextDisplay, MediaGallery, Separator, File, ThumbnailcomponentDisplay primitives.
ActionRow, Button, TextInput, RadioGroup, CheckboxGroup, ModalcomponentForm primitives.
FragmentcomponentGroup children without nesting.
*Props, ButtonStyleName, TextInputStyleName, DjsxNodetypeTypeScript helpers.

JSX runtime entry points: @djs-commands/jsx/jsx-runtime and @djs-commands/jsx/jsx-dev-runtime — set jsxImportSource: "@djs-commands/jsx" in your tsconfig.

Adapters

PackageFactoryNotes
@djs-commands/adapter-drizzledrizzleStorage(db, options?)Postgres via Drizzle. Schema exported from ./schema.
@djs-commands/adapter-prismaprismaStorage(prisma, options?)Generic Prisma client; ships schema fragments to copy in.
@djs-commands/adapter-mongoosemongooseStorage(connection, options?)Auto-creates Mongoose models if you don't pass your own.
@djs-commands/adapter-redisredisCacheAdapter(redis, options?)TTL-native CacheAdapter for distributed cooldowns.

See Adapter Cookbook for a walk-through per adapter.

On this page