Storage
User-owned persistence for djs-commands framework features.
@djs-commands/core ships without a database. You own schema, migrations, indexes, names, and connection lifecycle.
First-party storage adapters only translate djs-commands framework models. Use your ORM/client directly for your own app data.
Framework models
Import model constants from @djs-commands/core and map only the models for features you enable.
| Model | Required logical fields | Recommended unique constraint |
|---|---|---|
GuildPrefixModel | guild_id, prefix | guild_id |
DisabledCommandsModel | guild_id, command_name | guild_id, command_name |
ChannelLocksModel | guild_id, command_name, channel_id | guild_id, command_name, channel_id |
Enabled feature + missing mapping fails at handler boot. Direct helper use against an unmapped model fails loudly from the adapter.
Feature flags
createCommandHandler({
client,
storage,
legacy: { enabled: true, defaultPrefix: "!" }, // enables GuildPrefixModel storage by default
storageFeatures: {
disabledCommands: true,
channelLocks: true,
},
});Defaults:
guildPrefixes: followslegacy.enableddisabledCommands:falsechannelLocks:false
Disabled features do not query storage.
Helpers
import {
clearGuildPrefix,
disableCommand,
enableCommand,
getChannelLocks,
getGuildPrefix,
isCommandDisabled,
lockCommandToChannel,
setGuildPrefix,
unlockCommandFromChannel,
} from "@djs-commands/core";The helpers use logical fields. Adapters translate those fields to your real columns/document fields.
See the Adapter Cookbook for Drizzle, Prisma, and Mongoose mappings.
Last updated on
