Modules
setModuleSetting
$setModuleSetting
$setModuleSetting changes a server setting of a module, after checking the value against what the module declares.
Syntax
$setModuleSetting[id;key;value]
Parameters
| Parameter | Description |
|---|---|
id |
Required. The identifier of the module. |
key |
Required. The key of the setting. |
value |
Required. The new value. Empty clears the setting (the default applies again). |
Return value
- Type: String
- Always empty.
JavaScript
await bc.module.setSetting(id, key, value).
Behavior
- The person who used the command or the button must have the Manage Server permission, otherwise the call fails with
You need the Manage Server permission to change module settings. - It only works inside an interaction (a slash command, a button, a menu or a modal): a scheduled task or an event is refused.
- Numbers are checked against the minimum and the maximum, choices against the list, toggles accept
true/false,on/off,yes/noand1/0, channels and roles accept an ID or a mention. - Only server settings change. Features and texts belong to the whole bot and stay in the app and the Studio.
Examples
$onlyIf[$moduleInfo[tickets;installed]==true;Tickets is not installed.]
$setModuleSetting[tickets;max-open;$message[count]]
Done: $moduleSetting[tickets;max-open] tickets at most.
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.