Skip to content

@pumpkin-plugins/plugin-kit API / register-commands / registerCommands

Function: registerCommands() ​

registerCommands<T>(ctx, tree, handlers, suggestions?): void

Defined in: tools/plugin-kit/src/register-commands.ts:44

Registers a plugin's commands, permissions and per-subcommand permission checks.

Type Parameters ​

T ​

T extends CommandTree

Parameters ​

ctx ​

Context

The plugin context.

tree ​

T

The commands, from defineCommands.

handlers ​

CommandHandlers<T, CommandSender>

What runs each command: the lines to send back, or a thrown CommandFailed.

suggestions? ​

Optional dynamic suggestions. arguments maps an argument name to its handler, which then applies to every argument with that name anywhere in the tree. register registers the wrapped handler with the host and returns its id.

arguments ​

Readonly<Partial<Record<string, CommandSuggestionHandler<CommandSender>>>>

register ​

(handler) => number

Returns ​

void

pumpkin-plugins documentation