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
  • How Values Are Stored In Objects
  • Displaying Object Values
  • Targeting
  • Updating Values

Was this helpful?

  1. Custom Commands & Events
  2. Data Storage

Objects

Last updated 3 months ago

Was this helpful?

Objects are a special data type usually used to store a "group" of data. For example, they can be used to store the birthday of an user, which is made by the day of birth, month and year. They can also be helpful when creating an economy system: you can use an object to store the inventory of a specific user.

Here are some examples of object references and their values:

  • {BGVAR_object_variable.day} - 1

  • {BGVAR_object_variable.month} - 7

  • {BGVAR_object_variable.year} - 1979

How Values Are Stored In Objects

Objects store values as properties. Each property has a name (key) and a value that you can assign as base value. In the example above, the "object variable" variable has three properties: "day", "month", and "year". These properties hold the values "1", "7", and "1979", respectively.

Objects also have default values you are able to set when creating them in . Likewise you are able to remove keys from here as well. In addition to default values, you can create new keys during commands or events by using either the Set Variable or Run Equation on Variable action blocks.

Displaying Object Values

To display values stored in the object variable, you use a dot notation between the object's variable name, followed by a dot, and the property (key) name. The same key name can be used across different objects, but cannot be used twice in the same object. For example:

  • {BGVAR_object_variable.day}

  • {BGVAR_object_variable.year}

  • {BGVAR_cool_variable.day}

This variable can be used anywhere in your command builder and will retrieve the corresponding value for the given object and property.

Targeting

Targeting also works for object variables, when they are user or channel specific. Just like regular variables, you can add the square brackets [] at the end of the variable providing the user / channel target, for example:

  • {BGVAR_object_variable.day[option_user]}

  • {BGVAR_object_variable.day[{bot_id}]}

  • {BGVAR_object_variable.day[136327647792726016]}

  • {BGVAR_object_variable.day[option_channel]}

  • {BGVAR_object_variable.day[{first_channel_id}]}

If no target is provided, the value of the user who triggered the last interaction (command, event, button or select menu) will be returned for user objects, and the value of the channel the last interaction has been triggered in (command, event, button or select menu) will be returned.

Updating Values

To update a value into an object using any of these 3 action blocks:

Block
Information

Object variables selected in this block will allow you to set a value for a specific key.

For this action block, a specific key's value will be set as the result of an equation.

This action block will allow you to delete a specific key's value or all key values from an object.

Check out the object sections on the pages for these actions by clicking the links above for more information.

Set Variable
Run Equation on Variable
Delete Variable
data storage