Variables
setVar
$setVar[]
$setVar writes values to the bot’s persistent database. This is the counterpart to $getVar and is used for any data that needs to survive beyond the current command execution.
Syntax
bdfd
$setVar[name;value;(User ID)]
Global vs User-Scoped Variables
The third parameter determines the scope:
- Omitted: the variable is stored as global — accessible from any command, any user, any server. Use sparingly for configuration or shared data.
- User ID provided: the variable is user-scoped — each user gets their own independent copy. Perfect for coins, XP, settings, and any per-user data.
Important Considerations
- All values are strings. If you need numeric operations, use
$add,$sub,$mul,$divto convert and calculate. - Overwrite behavior: calling
$setVaron an existing variable replaces its value — there is no append mode. - Case insensitivity:
$setVar[Score;100]and$setVar[score;200]target the same variable. - No return value: this function performs a write action and returns void. It cannot be used inline in a string — use it as a standalone statement.
Examples
Save Global Variable
$setVar[announcementBanner;Welcome all new members!]
$title[Global Variable Set]
$description[Saved global banner: **$getVar[announcementBanner]**]
$color[#5865F2]
$sendMessage[]