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.
| Export | Kind | Page |
|---|
CommandOption / CommandOptions | type | Commands → Options |
StringOption, IntegerOption, NumberOption, BooleanOption, UserOption, ChannelOption, RoleOption, MentionableOption, AttachmentOption | type | Commands → Options |
ResolveOption / ResolveOptions | type | Commands → Options |
| Export | Kind | Description |
|---|
defineEvent | function | Define a discord.js event handler with full type-safety. |
EventDefinition | type | The shape defineEvent returns. |
| Export | Returns |
|---|
container | ContainerBuilder |
section | SectionBuilder |
textDisplay | TextDisplayBuilder |
mediaGallery | MediaGalleryBuilder |
separator | SeparatorBuilder |
file | FileBuilder |
thumbnail | ThumbnailBuilder |
button | ButtonBuilder |
actionRow | ActionRowBuilder |
modal | ModalBuilder |
textInput | TextInputBuilder |
radioGroup / checkboxGroup | LabelBuilder |
Each takes an *Options object — see Components V2 for full signatures and examples.
| Export | Description |
|---|
parseLegacyArgs | Parse a legacy message into a typed argument object using a command's options schema. |
LegacyParseResult | Discriminated union of { ok: true; values } / { ok: false; reason }. |
| Export | Description |
|---|
normalizeSlashContext | Build a SlashRunContext from a discord.js interaction. |
normalizeLegacyContext | Build a LegacyRunContext from a discord.js message. |
| Export | Kind | Description |
|---|
render | function | Compile a JSX tree into discord.js component builders. |
renderModal | function | Compile a <Modal> JSX tree into a ModalBuilder. |
Container, Section, TextDisplay, MediaGallery, Separator, File, Thumbnail | component | Display primitives. |
ActionRow, Button, TextInput, RadioGroup, CheckboxGroup, Modal | component | Form primitives. |
Fragment | component | Group children without nesting. |
*Props, ButtonStyleName, TextInputStyleName, DjsxNode | type | TypeScript 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.
| Package | Factory | Notes |
|---|
@djs-commands/adapter-drizzle | drizzleStorage(db, options?) | Postgres via Drizzle. Schema exported from ./schema. |
@djs-commands/adapter-prisma | prismaStorage(prisma, options?) | Generic Prisma client; ships schema fragments to copy in. |
@djs-commands/adapter-mongoose | mongooseStorage(connection, options?) | Auto-creates Mongoose models if you don't pass your own. |
@djs-commands/adapter-redis | redisCacheAdapter(redis, options?) | TTL-native CacheAdapter for distributed cooldowns. |
See Adapter Cookbook for a walk-through per adapter.