Concepts
The mental model behind djs-commands v2.
These pages explain the building blocks of djs-commands — what they do, when to reach for them, and how they compose. Read them in order on your first pass; jump in topically afterwards.
Commands
Defining commands with defineCommand. Naming, options, subcommands, contexts.
Validators
Pre-handler checks: roles, channels, custom predicates. Composable, async-friendly.
Cooldowns
Per-user, per-guild, per-command rate limiting backed by your storage adapter.
Plugins
Cross-cutting hooks: logging, metrics, custom interaction types, lifecycle wrappers.
Storage
The adapter interface that backs cooldowns, prefixes, and user state. Bring your own DB.
Components V2
First-class JSX for the new Discord component model — buttons, selects, modals, layouts.
How the pieces fit
Discord interaction
↓
createCommandHandler (subscribes to events)
↓
Dispatcher (looks up command by name)
↓
Validators (gate the call)
↓
Plugins (wrap the call — before/after)
↓
command.run({ interaction, ...context })
↓
Components V2 reply (optional)Storage sits orthogonal to that pipeline — anything that needs to remember state across calls (cooldowns, per-guild prefixes, user preferences) reads and writes through the adapter you provide.