Data Storage
Custom Variables are the first step in unlocking the ability for your bot to be better used in multi-server settings. Read the docs page below for all the information!
Last updated
Custom Variables are the first step in unlocking the ability for your bot to be better used in multi-server settings. Read the docs page below for all the information!
Last updated
Custom Variables are the first step in unlocking the ability for your bot to be better used in multi-server settings. Custom variables allow you to store data to be used by your bot through creating custom Global, Server Specific, Channel Specific or User specific variables. You can then use these variables in custom command actions by using an associated {BGVAR_variable} variable. Custom Variables can be either global or server specific, allowing for different values based on the server they are used in.
Currently, the Data Storage module offers the following data types:
Text
Stores a text.
Number
Stores a simple number.
Collection
Object
They can be either:
Global
The variable stores only one value.
Server Specific
The variable stores a different value on each server.
User
This variable stores a different value for each server member. Additionally, it can also be global or server specific.
Channel
This variable stores a different value for each channel of the server.
Interacting or creating a variable on a non-premium bot will use 10 calls.
To create a custom variable head over to the newly created Data Storage Module. This module not only allows to create custom variables, but will also show you how many times a variable has been used and how many items of that variable are currently being stored.
Usage: A new usage system is being implemented to track how custom variables are being used across your bots. This system uses a 'database calls' system as a unit of measurement.
Every month, users get 5,000 calls to use across their free bots. Free bots will use 10 calls every time they either create a variable or update the value of a variable. Only free bots use calls, premium bots do not incur any database usage whatsoever. Free Database usage resets at the start of every month.
Users get 5000 free database usage (calls) every month to use. Every time a basic (non-premium) bot creates or updates a variable, it uses 10 calls.
To set custom variables you can use either the new Set Variable or Run Equation on Variable custom command actions. Set Variable allows you to simply set a value for a custom variable. You can use options and normal variables when doing so. The Run Equation on Variable allows you to run any equation using the value of a custom variable.
You can also delete a custom variable from storage.
Default: To use variables you can copy paste the 'reference' that is shown when you create a custom variable. All custom variables begin with BGVAR and are simply the name of the variable converted to lower case. For example, 'Counter Variable' would be {BGVAR_counter_variable}. This variable can be used in any custom command action. Custom variables will be slowly deployed across all BotGhost modules. Default + user ID / option: You can display other people's variables by using targeted variables. For instance to display my {BGVAR_counter_variable} you could do {BGVAR_counter_variable[136327647792726016]}. You can also use user options in place of a user id. If you had a user option named 'target' you could display a users Counter Variable by using {BGVAR_counter_variable[option_target]}.
Experiencing issues with this module or do you just need help? Check out our support options here!
Collections, that are also known as arrays, can store multiple data of the same type. Example, a collection made of User IDs. Learn more .
Object variables are variables that can store other sub-variables (or properties). Learn more .