Skip to content
Variables getVar

$getVar[]

$getVar retrieves values from the bot’s persistent storage. Unlike temporary variables ($var), global and user-scoped variables survive across command executions and bot restarts. They are stored in the bot’s database.

Syntax

bdfd
$getVar[name;(User ID)]

Global vs User-Scoped Variables

The second parameter determines the scope:

  • Omitted: the variable is treated as global — accessible from any command, any user, any server.
  • User ID provided: the variable is user-scoped — each user has their own independent value for the same variable name. Use $authorID to reference the current user.

Storage Details

  • All values are stored as strings. When reading back, you receive the exact string that was stored.
  • Variable names are case-insensitive.
  • Returns an empty string if the variable has never been set.

Comparison with $var

Aspect $var $getVar
Persistence Execution only Persistent (DB)
Scope Local Global or user
Performance Fast (in-memory) DB read
Use case Temporary calculations Long-term storage

Examples

Read Global Variable

$title[Global Setting]
$description[Maintenance mode: `$getVar[maintenanceMode]`]
$color[#5865F2]
$sendMessage[]