Modules
commandInfo
$commandInfo
$commandInfo reads one field of a command: its description in the language of the person, its sub-commands, its options, how to use it, or the module it belongs to.
Syntax
$commandInfo[name;field;separator]
Parameters
| Parameter | Description |
|---|---|
name |
Required. The name of the command, without the slash. |
field |
Optional. description (default), exists, name, type, module, subcommands, options or usage. |
separator |
Optional. Text between the items of subcommands, options and usage. Default ,. |
Return value
- Type: String
existsgivestrueorfalse;usagegives one line per way to use the command, such as/ticket open <reason> [note].
JavaScript
bc.command.info(name, field) returns a boolean for exists and an array for subcommands, options and usage.
Behavior
descriptionandnameuse the translations of the command when the person’s language has one.moduleis the identifier of the module that installed the command, empty for your own commands.- Sub-commands inside a group are written
group sub. Required options are shown<name>, optional ones[name]. - An unknown command raises
Command "x" not found.except forexists.
Examples
$if[$commandInfo[ticket;exists]==true]
$commandInfo[ticket;description]
$commandInfo[ticket;usage;\n]
$endif
Notes
- Everything is read from the modules installed on the bot, so a module added later is covered with no change to your script.
- See the guide Module and command functions.
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.