Skip to content
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
  • installed and enabled give true or false; commands, features and settings give 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

  • installed never fails: it answers false for a module that is not installed. Every other field raises Module "id" is not installed. in that case.
  • settings lists only the settings a server can change, and hides those of a feature that is turned off.
  • commands lists 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.