Skip to content

@bight-ts/plugin-prefix-commands

import {
createPrefixCommandsPlugin,
definePrefixCommand,
} from "@bight-ts/plugin-prefix-commands";

Registers prefix-based command handlers that trigger on chat messages starting with a configured prefix.

PropertyTypeRequiredDescription
commandsPrefixCommand[]YesArray of prefix command definitions
getPrefixes(input: { context, message }) => string[]YesResolves the active prefixes per-message (supports per-guild prefixes)
enabledbooleanNoToggle the plugin
namestringNoPlugin name. Defaults to "prefix-commands"

Defines a command that matches after the prefix is stripped.

PropertyTypeRequiredDescription
data{ name: string, description: string }YesCommand metadata
execute(input: { message, context, args: string[] }) => voidYesThe command handler. args contains whitespace-split tokens after the command name.
preconditionsstring[]NoNamed preconditions
onDeniedBightDeniedHandlerNoCustom denial handler
  • After a message matches a prefix, the remaining text is split by whitespace to identify the command name and arguments.
  • Requires GuildMessages and MessageContent gateway intents.
  • Errors and denials are recorded as diagnostic events.