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!

Custom Variables

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 Text, Number and User 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.

Variable Types

Currently there are three variable types in this update. We plan to add more variable types such as Role and Member variables in the future.

Text & Number Variables: Text and number variables are the most basic variables you can create. They store a single value that is either global or server specific.

User Variables: Unlike basic text and number variables, user variables allow you to store and assign data to individual users in your server. This means that every user your bot interacts with, can have a different value for a variable. These variables can also be global or server specific.

Creating Variables & Usage

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.

Interacting or creating a variable on a non-premium bot will use 10 calls.

Free Database Usage (Calls)

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.

Setting & Deleting Custom Variables

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.

Using Variables

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!

Last updated