Skip to content

@pumpkin-plugins/plugin-kit API / commands / buildCommands

Function: buildCommands() ​

buildCommands<Sender, T>(host, tree, handlers, suggestions?): BuiltCommand[]

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

Builds the command nodes of a tree, with the handlers attached. The tree is the same object the README is generated from, so what is registered is what is documented.

Type Parameters ​

Sender ​

Sender

T ​

T extends CommandTree

Parameters ​

host ​

CommandHost<Sender>

Creates the nodes.

tree ​

T

The commands, from defineCommands.

handlers ​

CommandHandlers<T, Sender>

What runs each command.

suggestions? ​

Readonly<Partial<Record<string, CommandSuggestionHandler<Sender>>>> = {}

Returns ​

BuiltCommand[]

One entry per command.

Throws ​

When a runnable command has no handler, which the types already prevent.

Pumpkin Plugins documentation