@bight-ts/plugin-message-commands
import { createMessageCommandsPlugin, defineMessageCommand,} from "@bight-ts/plugin-message-commands";createMessageCommandsPlugin(options)
Section titled “createMessageCommandsPlugin(options)”Registers message-based command handlers that trigger on chat messages.
Options
Section titled “Options”| Property | Type | Required | Description |
|---|---|---|---|
commands | MessageCommand[] | Yes | Array of message command definitions |
enabled | boolean | No | Toggle the plugin |
name | string | No | Plugin name. Defaults to "message-commands" |
defineMessageCommand(command)
Section titled “defineMessageCommand(command)”Defines a command that matches against chat messages.
MessageCommand<TServices>
Section titled “MessageCommand<TServices>”| Property | Type | Required | Description |
|---|---|---|---|
data | { name: string, description: string } | Yes | Command metadata (used in diagnostics, not Discord UI) |
match | (input: { message, context }) => boolean | Yes | Returns true if this command should handle the message |
execute | (input: { message, context }) => void | Yes | The command handler |
preconditions | string[] | No | Named preconditions |
onDenied | BightDeniedHandler | No | Custom denial handler |
Behavior
Section titled “Behavior”- Commands are evaluated in declaration order. The first
matchthat returnstruewins. - Requires
GuildMessagesandMessageContentgateway intents. - Errors and denials are recorded as diagnostic events.