Skip to content

@bight-ts/core — Commands

import {
defineCommand,
defineSubcommand,
type BotCommand,
type BightSubcommand,
} from "@bight-ts/core";

Defines a slash command. Accepts a StandardBotCommand (with execute) or a GroupBotCommand (with subcommands).

PropertyTypeRequiredDescription
dataSlashCommandBuilder | SlashCommandOptionsOnlyBuilderYesDiscord.js command builder with name, description, and options
execute(input: CommandExecution) => voidYesThe command handler
autocomplete(input: AutocompleteExecution) => voidNoHandler for autocomplete interactions
preconditionsstring[]NoNamed preconditions to evaluate before execution
cooldownnumberNoCooldown in milliseconds per user
devOnlybooleanNoBlock execution in production environments
deploymentCommandDeploymentNoDeployment targeting
onDeniedBightDeniedHandlerNoCustom denial handler
PropertyTypeRequiredDescription
dataSlashCommandBuilder | SlashCommandSubcommandsOnlyBuilderYesDiscord.js command builder (name and description only — subcommands add their own options)
subcommandsBightSubcommand[]YesArray of subcommand definitions
preconditionsstring[]NoApplied to all subcommands in this group
cooldownnumberNoApplied to all subcommands
devOnlybooleanNoApplied to all subcommands
deploymentCommandDeploymentNoDeployment targeting
onDeniedBightDeniedHandlerNoCustom denial handler

Defines a subcommand within a grouped command.

PropertyTypeRequiredDescription
namestringYesSubcommand name
descriptionstringYesSubcommand description
build(builder: SlashCommandSubcommandBuilder) => voidNoAdd options to the subcommand
execute(input: CommandExecution) => voidYesThe subcommand handler
autocomplete(input: AutocompleteExecution) => voidNoAutocomplete handler

Passed to execute() handlers.

PropertyTypeDescription
interactionChatInputCommandInteractionThe Discord interaction
contextBightContext<TServices>Your app context with services, client, and logger
PropertyTypeDescription
globalbooleanInclude in global deployments
guildOnlystring[]Deploy only to specific guild IDs