Database
dbGet
$dbGet
$dbGet reads from the Bot Creator database. The data lives in the server’s space (the user’s own space in a direct message). $dbSpace switches the rest of the run to the user or the bot. A script can never read another server’s or another user’s data.
Reads are never counted: there is no limit on the number of reads in a command.
Syntax
$dbGet[collection;id;(path);(default)]
Parameters
| Parameter | Description |
|---|---|
collection |
Collection name: lowercase letters, digits, _, . or - (up to 64 characters). It is created on first write. |
id |
Document id, 1 to 128 bytes. Often a Discord ID. |
path |
Optional. A dotted path inside the document, such as stats.wins. Without it, the whole document is returned as JSON. |
default |
Optional. Returned when the document or the path does not exist. Empty by default. |
Return value
- The whole document as JSON, or the value at
path(text as is, numbers and booleans as text, objects and lists as JSON). defaultwhen the document or the path is missing.
Examples
One value
You have $dbGet[players;$authorID;xp;0] XP.
The whole document
$dbGet[players;$authorID]
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.