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 Name & Reference starting with {BGVAR_

Variable Types

Currently there are three variable types in this update. We plan to add more variable types such as Role, Channel 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.
Variable Type: Text, number & user / Default Value

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.
Usage: Items Stored, Items Calls & Total Usage
It is important to note that storing a variable costs 10 'calls' and using or setting a variable costs '1' call!

Storage 'Calls' available

Currently free users have 500 calls and members with any paid subscription have 5000 calls. These numbers may change as we track usage across all bots. Paid addons to increase your database call limit will be available later. Every month the calls are reset, except for the stored values which will be carried over to the next month. Example: I stored 5 text values and used 10 times a command to trigger the variable. The 5 stored text values have a storage value of 50 calls meaning the next month you will start with 50/500 calls for free users, or 50/5000 calls for premium users.
Data Storage usage: Storage, Calls & Calls left Calls used / Calls in total (Calls used in % of the total)

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.
Command Builder actions: Set Variable, Run Equation on Vaiable & Delete Variable
You can also delete a custom variable from storage. This will free up space and remove 10 database calls from your accounts usage.
Delete a variable

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 peoples 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]}.
Plain Text Reply with a custom variable, {BGVAR_exampe}
Experiencing issues with this module or do you just need help? Checkout our support options here!