BotGhost Documentation
Support ServerYouTubeMarketplaceBotGhost PremiumSign in
  • Welcome to BotGhost
  • Guidelines & Privacy
  • Changelogs 2025
    • Changelogs 2024
    • Changelogs 2023
  • BotPanel Documentation
  • Getting Started
    • Create Your First Bot
      • Create Your Second Bot
    • Invite Your Bot
    • Standard Practices
      • Advanced Practices
    • Mobile Application (PWA)
  • Support
    • BotGhost Support
    • Frequently Asked Questions
  • Premium & Priority Hosting
    • Priority Hosting
    • Our Premium Features
    • Plans & Payment Methods
    • Manage Your Subscription
    • Upgrade Your Bot
    • Refund & Cancellation Policy
    • Beta Features
  • General Settings and Collaboration
    • Settings
    • Collab
    • Status
    • Active Developer Badge
    • Marketplace
  • Custom Commands & Events
    • Command & Event Builder
      • Sharing Commands and Events
      • Advanced Options
    • Actions
      • Message Actions
        • Send or Edit a Message
          • Button
          • Select Menu
        • Edit a Button or Select Menu
        • Send a Form
        • Delete a Message
        • Publish a Message
        • React to a Message
        • Pin a Message
      • Custom Variable Actions
        • Set Variable
        • Run Equation on Variable
        • Delete Variable
      • API Actions
        • Send an API Request
        • Execute an IFTTT Trigger
      • Loop Actions
        • Run a Loop
        • Stop a Loop
      • Voice Actions
        • Join a Voice Channel
        • Leave a Voice Channel
        • Voice Move a Member
        • Voice Kick a Member
        • Voice Mute or Unmute a Member
        • Voice Deafen or Undeafen a Member
      • Role Actions
        • Add Roles
        • Remove Roles
        • Create a role
        • Delete a role
        • Edit Role
      • Channel Actions
        • Create a channel
        • Edit a channel
        • Delete a channel
      • Thread and Forum Actions
        • Create a Thread
        • Edit a Thread
        • Delete a Thread
      • Server Actions
        • Kick a member
        • Ban a member
        • Timeout a member
        • Change a members nickname
        • Purge Messages
        • Create Server Invite
      • Other Actions
        • Wait before running another action
        • Manipulate some text
        • Send an error log message
        • Set a unique variable
        • Change the Bot's Status
        • Note
      • [LEGACY] Reply Actions
        • Plain Text Reply
        • Embed Reply
        • Random Reply
        • Send a message to a channel
        • Direct Message a User
        • Send a Message with attached buttons
          • Buttons
        • Send a message with a select menu
          • Menu Option
    • Conditions
      • Comparison Condition
      • Permission Condition
      • Chance Condition
      • Channel Condition
      • Role Condition
      • User Condition
      • Premium Check Condition
    • Options
      • Text Option
      • Number Option
      • User Option
      • Channel Option
      • Role Option
      • Choice Option
      • Attachment Option
    • Events
      • Timed Events
      • Webhooks
    • Data Storage
      • Collections
      • Objects
    • IFTTT
    • Variables
  • Server Management
    • Moderation
    • Discord Automod
    • Tickets
    • Welcomer
    • Verification
    • Statistic Channels
    • Modmail
    • Auto-React
    • Sticky Roles
    • Emoji Manager
    • Polls Filter
    • Automod
    • Logging
  • Messages
    • Timed Messages
    • Reaction Roles
    • Autoresponder
    • Embed Builder
    • Sticky Messages
    • Polls
    • Global Chat
    • Media Channels
  • AI
    • ChatGPT
    • Image Generation
  • Game Integrations
    • Roblox Verification
  • Social Integrations
    • YouTube
    • Twitch
  • Community Engagement
    • Leveling
    • Temp Voice Channels
    • Suggestions
    • Invite Tracker
    • Starboard
    • Question Of The Day
    • Giveaways
  • Fun Modules
    • Economy & Minigames
    • Birthdays
    • Counting
  • Utility
    • Translation
    • Weather
Powered by GitBook
On this page
  • What are variables
  • Variable Types
  • Creating a New Variable
  • Editing or Deleting a Variable
  • Using Your Variable
  • Updating Your Variable's Value
  • Retrieving Your Variable
  • Free Database Usage (Calls)

Was this helpful?

  1. Custom Commands & Events

Data Storage

Create custom variables to store data for your bot

Last updated 2 months ago

Was this helpful?

is the first step in unlocking the ability for your bot to store data to be used by your bot, either per server or globally.

What are variables

Custom variables are 'placeholders' to store and access data across different commands, interactions and servers!

Variable Types

Variables can be set to text or numbers, but can also be made specific to a user or channel. Variables can also have a server specific or global scope, meaning it will be the same in all servers. Currently, we offer the following data types:

Variable Type
Information

Text

Stores a text value.

Number

Stores a simple number value.

Collection

Object

Which can be either:

Type
Information
Can be Global / Server Specific?

Not user / channel specific

This means it can't contain a different value basing on the user or channel provided. It can also be global or server specific

User Specific

This means you can store a different value for every user.

Channel Specific

This means you can store a different value for each channel in your server.

Creating a New Variable

To create a new variable, head over to the module and go to the "New Variable" window.

Variable Name

In this field you can enter the name of your new variable. This will also be the reference for your variable.

Variable Reference

This is your variable reference, it will be {BGVAR_variable_name}, depending on what variable name you add. You can use this variable anywhere in your bot to get the variable value.

You do not need to enter anything in this field when creating a new variable.

Variable Type

If you select "User" or "Channel" here, you will get another field where you can choose to set the variable type to text, number, collection or object.

Default Value

In this field you can enter a default value that will be in the variable when nothing else has been set.

Scope

In this field you can select whether you want to make your variable server specific or global, meaning it will be the same in all servers.

Editing or Deleting a Variable

To edit a custom variable, simply press the variable you want to edit in the module. You can then edit the variable in this window:

Don't forget to press the "Edit Custom Variable" button and save changes!

You can also delete a custom variable from storage by pressing the "Delete" button.

Deleting a variable will not just clear the value of the variable, this will delete the variable from the storage

Using Your Variable

Updating Your Variable's Value

Retrieving Your Variable

You can get data stored in the data storage module by using an associated {BGVAR_} variable in other action blocks, for example: {BGVAR_example}.

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 can use unlimited data storage.

Your calls can not be reset manually, they will automatically reset on the first of each month. The data stored in them will not reset.

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 .

In this field you can enter the , variables can be set to text or numbers, but can also be made specific to a user or channel.

Interacting with a variable on a non-premium bot will use 10 . This includes retrieving it in a response and updating it via the actions described below. The delete variable action won't use any calls.

To set or clear (delete) custom variables, you can use the Set Variable, Run Equation on Variable or Delete Variable actions in the . You can read more about these actions !

You can get user and channel specific variables by targeting them, for example: {BGVAR_example[ID]}. You can learn more about targeting .

Experiencing issues with this module or need help? Check out our support options !

Data storage
data storage
command and event builder
here
here
type of your variable
calls
here
here
Command Builder actions: Set Variable, Run Equation on Vaiable & Delete Variable
Plain Text Reply with a custom variable, {BGVAR_exampe}
here