Skip to main content

Basic command

Register it

For guild-scoped iteration during development, you can register to a single guild:

Subcommands

Subcommand groups, choices, and richer option types

Supported chat input option types:
  • string
  • integer
  • number
  • boolean
  • user
  • channel
  • role
  • mentionable
  • attachment

Permissions

Use .setPermissions(...) to set Discord default_member_permissions on the command. Accepted inputs follow the framework bitfield conventions, so these all work:
  • permission names like 'MANAGE_GUILD'
  • raw bitfields like BigInt(...)
  • arrays of permission names
  • PermissionsBitField
setDefaultMemberPermissions(...) also exists as a compatibility alias, but setPermissions(...) is the recommended surface.

Important behavior

Command definitions must provide either:
  • execute
  • or subcommands
That catches one class of invalid command definitions early.

Deployment note

The command manager deploys registered commands through the application command API. If the client is already ready, deployment happens immediately. Otherwise it is deferred until the ready flow completes.

Load commands from a directory

If you keep commands in separate files, the command manager can load them from disk:
Each loaded module should default-export a command definition.
Last modified on June 13, 2026