Modules
moduleInfo
$moduleInfo
$moduleInfo reads one field of an installed module: its name, version, commands, features or settings.
Syntax
$moduleInfo[id;field;separator]
Parameters
| Parameter | Description |
|---|---|
id |
Required. The identifier of the module. |
field |
Optional. name (default), installed, version, enabled, commands, features or settings. |
separator |
Optional. Text between the items of commands, features and settings. Default ,. |
Return value
- Type: String
installedandenabledgivetrueorfalse;commands,featuresandsettingsgive a list joined by the separator.
JavaScript
bc.module.info(id, field) returns a boolean for installed and enabled, an array for lists and a string otherwise.
Behavior
installednever fails: it answersfalsefor a module that is not installed. Every other field raisesModule "id" is not installed.in that case.settingslists only the settings a server can change, and hides those of a feature that is turned off.commandslists the commands the module installed, under their current names.
Examples
$if[$moduleInfo[tickets;installed]==true]
$moduleInfo[tickets;name] v$moduleInfo[tickets;version]: $moduleInfo[tickets;commands; ]
$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.