@pumpkin-plugins/plugin-kit API / commands / CommandHost
Interface: CommandHost<Sender>
Defined in: tools/plugin-kit/src/commands.ts:29
What building commands needs from the host. registerCommands implements it with Pumpkin's command classes.
Type Parameters
Sender
Sender
Methods
argument()
argument(
spec):CommandNode
Defined in: tools/plugin-kit/src/commands.ts:31
Creates a typed argument below a node.
Parameters
spec
CommandArgumentSpec
Returns
CommandNode
fail()
fail(
text):never
Defined in: tools/plugin-kit/src/commands.ts:33
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:35
Checks whether a sender has a command permission.
Parameters
sender
Sender
permission
string
Returns
boolean
literal()
literal(
name):CommandNode
Defined in: tools/plugin-kit/src/commands.ts:37
Creates a fixed word below a node.
Parameters
name
string
Returns
CommandNode
onRun()
onRun(
run,arguments_):number
Defined in: tools/plugin-kit/src/commands.ts:39
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:44
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:46
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):Command
Defined in: tools/plugin-kit/src/commands.ts:48
Creates the root of a command: the word typed after /.
Parameters
name
string
description
string
Returns
Command