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 Collections
  • Displaying Collection Values
  • Collection Variables
  • Targeting
  • Updating Collection Values

Was this helpful?

  1. Custom Commands & Events
  2. Data Storage

Collections

Last updated 2 months ago

Was this helpful?

Collections or arrays are a special data storage type that allows you to store a group of text or numbers. Collections consist of an ordered list using numbered indexes starting from 0 to access specific data.

How Values Are Stored In Collections

Collection values are stored on positions in the collection. Each position has it's own number to access it, starting at 0. Every value is seperated with a comma.

Here are some examples of collection references and their values or arrays:

  • {BGVAR_collection} - [hello, world, abc, xyz]

  • {valueAtPosition({BGVAR_collection}),[2]} - abc

  • {lengthOfCollection({BGVAR_collection})} - 4

Collection positions always start at 0.

Displaying Collection Values

To display values stored in the collection variable, you can target the position of the value. You can also use other variables to access the data in other ways. Below are some examples of targeting positions in the collection variable:

  • {BGVAR_collection} - [hello, world, abc, xyz]

  • {valueAtPosition({BGVAR_collection}),[0]} - hello

  • {valueAtPosition({BGVAR_collection}),[1]} - world

  • {valueAtPosition({BGVAR_collection}),[2]} - abc

This variable can be used anywhere in your command and event builder and will retrieve the corresponding value for the given position of the collection.

Collection Variables

Targeting

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

  • {BGVAR_collection[user_id]}

  • {valueAtPosition({BGVAR_collection[user_id]}),[0]}

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 collections, or the value of the channel the last interaction has been triggered in (command, event, button or select menu) will be returned for channel collections.

Updating Collection Values

Block
Information

Collection variables selected in this block will allow you to set a value somewhere in a collection.

This action block will allow you to delete a collection value.

You can not use the Run Equation on Variable action on collections.

Collections also have default values you are able to set when creating or editing a variable in the module.

BotGhost offers some variables you can use for any array or collection (even from an ), which allow you to retrieve specific information of the collection. To know more about them, check out the page.

To update a collection value, you can use one of the below:

data storage
variable actions
Set Variable
Delete Variable
API response
Variables