@pumpkin-plugins/plugin-kit API / commands / CommandHost
Interface: CommandHost<Sender>
Defined in: tools/plugin-kit/src/commands.ts:39
What building commands needs from the host. registerCommands implements it with Pumpkin's command classes.
Type Parameters
Sender
Sender
Methods
argument()
argument(
spec):CommandArgumentNodeLike
Defined in: tools/plugin-kit/src/commands.ts:45
Creates a typed argument below a node.
Parameters
spec
CommandArgumentSpec
Returns
fail()
fail(
text):never
Defined in: tools/plugin-kit/src/commands.ts:56
Makes the running command fail with a message, the way the server reports a failed command. Never returns.
Parameters
text
string
Returns
never
hasPermission()
hasPermission(
sender,permission):boolean
Defined in: tools/plugin-kit/src/commands.ts:58
Checks whether a sender has a command permission.
Parameters
sender
Sender
permission
string
Returns
boolean
literal()
literal(
name):CommandNodeLike
Defined in: tools/plugin-kit/src/commands.ts:43
Creates a fixed word below a node.
Parameters
name
string
Returns
onRun()
onRun(
run,arguments_):number
Defined in: tools/plugin-kit/src/commands.ts:49
Registers what runs when a command is used, and returns its id.
Parameters
run
(sender, args) => void
arguments_
readonly CommandArgumentSpec[]
Returns
number
onSuggest()
onSuggest(
handler):number
Defined in: tools/plugin-kit/src/commands.ts:47
Registers a dynamic suggestion callback and returns its host handler ID.
Parameters
handler
CommandSuggestionHandler<Sender>
Returns
number
reply()
reply(
sender,line,tone?):void
Defined in: tools/plugin-kit/src/commands.ts:54
Sends a line back to whoever ran the command. An error line is shown in red.
Parameters
sender
Sender
line
string
tone?
"error"
Returns
void
root()
root(
name,description):CommandNodeLike
Defined in: tools/plugin-kit/src/commands.ts:41
Creates the root of a command: the word typed after /.
Parameters
name
string
description
string