# Variables

Variables allow you to store data from API requests, action outputs, custom data and more. Variables can be used in almost every field of the actions and conditions [custom command and event builder](https://docs.botghost.com/custom-commands-and-events/command-and-event-builder).&#x20;

The **available** **variables** in your command-builder or event-builder may vary depending on the action, custom variables you have, API requests you use, and the event you might be using in case you are using the event builder. Here you may find some general information on what they are and how to use them.

<figure><img src="https://1937909199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lm_hW5MApY3J0lRhi0M%2Fuploads%2FLtM6LtBl0HJZPIswKFn9%2Fimage.png?alt=media&#x26;token=11e62b2a-6793-47c3-b704-28891a4a60ea" alt=""><figcaption></figcaption></figure>

## Targeting

You can add a target to your variable to get data of a specific user, channel, role or server (more targeting options are available when using [#object-variables](#object-variables "mention")). To do so, add square brackets `[]` at the very end of your variable<mark style="color:red;">\*</mark>. Make sure to add a valid ID, variable or option. See below for more info.

<mark style="color:red;">\*</mark> Targeting is slightly different for [object variables](#object-variables): the square brackets go before the first dot. For example, `{Channel[ID].name}` instead of `{Channel.name[ID]}`.

### Plain ID

You can use a plain ID as a target. This means the variable will always return the value of the same user, channel or role.

Below are some examples:

* `{user_icon[136327647792726016]}`
* `{user_joinedAt[136327647792726016]}`
* `{channel_name[1021852614725480448]}`

### Options

In custom commands you can use an option for your target (make sure it's a valid variable type: you need to use user options if you want to target a user using a option). The variable name should be inside your square brackets `[]`, without any curly brackets `{}` around it, and preceded by `option_`.

Below are some examples:

* `{user_icon[option_user]}`
* `{user_joinedAt[option_player]}`
* `{channel_name[option_channel]}`

### Variables Containing an ID

Lastly, you can also use other variables that contain an ID. Unlike options, make sure to paste the full variable inside your square brackets `[]`, including the curly brackets `{}`.

Below are some examples:

* `{user_icon[{bot_id}]}`
* `{user_joinedAt[{api.response.id}]}`
* `{channel_name[{BGVAR_my_custom_variable}]}`

## Storing Custom Data

### Storing Data across all commands and events

If you want to store data across all commands and events, you can use the [data storage](https://docs.botghost.com/custom-commands-and-events/data-storage#variable-types), which allows you to store and retrieve data with different types of variables.&#x20;

### Storing Data in a command or event

You can also store data only in a specific command / event execution, meaning that once the execution of the command / event is completed, saved data will be deleted. This is useful to easily store temporary data. Check out the [set-a-unique-variable](https://botghost.com/docs/custom-commands-and-events/actions/other-actions/set-a-unique-variable "mention") page to learn more.

## Variables

### Object Variables

Some variables in BotGhost allow you to access properties of Discord objects, such as guilds, channels, or members, through dot notation. These variables start with a Capital letter and give you access to all the properties available on their respective Discord.js objects. For example, `{User[136327647792726016].username}` would return the username of the user with that ID. Dot notation allows you to access sub-objects of an object. For example, `{Message.channel.name}` will return the name of the channel the message was sent in. All properties and connections to other objects are described in the [discord.js](https://discord.js.org/docs/packages/discord.js/main) Documentation.

You can view a list of all properties of an object through the variable selector (clipboard icon). Objects highlighted in green do not require you to provide an ID or a parameter for the object variable to work (for example, when you run a command the Guild object is automatically set to return information about the server the command was used in. You can however overwrite the pre-defined value with `[VALUE]`, as described above). Some object variables do not require a selector depending on the command or event type. For example, in a command, `{User.username}` would return the username of the user who ran the command. These are shown in green with the text "Available". All other objects require an ID to be specified.

<figure><img src="https://1937909199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lm_hW5MApY3J0lRhi0M%2Fuploads%2F13hufhyyaTgm27XJEvCa%2Fimage.png?alt=media&#x26;token=175362a3-f65d-438f-a5b0-4abcc349b2f6" alt=""><figcaption></figcaption></figure>

Currently these objects are available:

<table><thead><tr><th width="151">Object Variable</th><th width="139.5">Details</th><th width="260.5">Example</th><th>Properties</th></tr></thead><tbody><tr><td>Message</td><td>Access properties of a specific Discord message.</td><td><code>{Message.author}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/Message:Class">Message Properties</a></td></tr><tr><td>Guild</td><td>Access properties of a guild.</td><td><code>{Guild.memberCount}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/Guild:Class">Guild Properties</a></td></tr><tr><td>Channel</td><td>Access properties of a channel.</td><td><code>{Channel[1021852614725480448].url}</code></td><td><p><a href="https://discord.js.org/docs/packages/discord.js/main/TextChannel:Class">Text Channel Properties</a></p><p><a href="https://discord.js.org/docs/packages/discord.js/main/ForumChannel:Class">Forum Channel Properties</a><br><a href="https://discord.js.org/docs/packages/discord.js/main/ThreadChannel:Class">Thread Properties</a></p><p><a href="https://discord.js.org/docs/packages/discord.js/main/MediaChannel:Class">Media Channel Properties</a></p><p><a href="https://discord.js.org/docs/packages/discord.js/main/AnnouncementChannel:Class">Announcement Channel Properties</a><br><a href="https://discord.js.org/docs/packages/discord.js/main/VoiceChannel:Class">Voice Channel Properties</a><br><a href="https://discord.js.org/docs/packages/discord.js/main/StageChannel:Class">Stage Channel Properties</a><br><a href="https://discord.js.org/docs/packages/discord.js/main/CategoryChannel:Class">Category Properties</a></p></td></tr><tr><td>Member</td><td>Access properties of a server member.</td><td><code>{Member[{option_user}].roles}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/GuildMember:Class">Guild Member Properties</a></td></tr><tr><td>User</td><td>Access properties of a user.</td><td><code>{User.createdTimestamp}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/User:Class">User Properties</a></td></tr><tr><td>Role</td><td>Access properties of a role in a server.</td><td><code>{Role[{option_role}].permissions}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/Role:Class">Role Properties</a></td></tr><tr><td>Invite</td><td>Access the properties of an invite.</td><td><code>{Invite[{invite_code}].inviter}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/Invite:Class">Invite Properties</a></td></tr><tr><td>Sticker</td><td>Access the properties of a sticker.</td><td><code>{Sticker.name}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/Sticker:Class">Sticker Properties</a></td></tr><tr><td>AuditLogEntry</td><td>Access the properties of an audit log entry.</td><td><code>{AuditLogEntry[{auditlogid.response.audit_log_entries.0.id}].actionType}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/GuildAuditLogsEntry:class">Guild Audit Log Entry Properties</a></td></tr><tr><td>StageInstance</td><td>Access the properties of a stage Instance.</td><td><code>{StageInstance.topic}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/StageInstance:Class">Stage Instance Properties</a></td></tr><tr><td>AutoModerationRule</td><td>Access the properties of an AutoMod rule.</td><td><code>{AutoModerationRule.triggerType}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/AutoModerationRule:Class">AutoModeration Rule Properties</a></td></tr><tr><td>AutoModerationActionExecution</td><td>Access the properties of an AutoMod action execution.</td><td><code>{AutoModerationActionExecution.matchedContent}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/AutoModerationActionExecution:Class">AutoModeration Action Execution Properties</a></td></tr><tr><td>Reaction</td><td>Access the properties of a reaction.</td><td><code>{Reaction.count}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/MessageReaction:Class">Message Reaction Class</a></td></tr><tr><td>Emoji</td><td>Access the properties of a custom emoji.</td><td><code>{Emoji[{Reaction.emoji}].createdTimestamp}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/Emoji:Class">Emoji Properties</a></td></tr><tr><td>GuildScheduledEvent</td><td>Access the properties of a guild scheduled event</td><td><code>{GuildScheduledEvent[{option_event-id}].userCount}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/14.24.2/GuildScheduledEvent:Class">Guild Scheduled Event Properties</a></td></tr><tr><td>GuildBan</td><td>Access the properties of a ban.</td><td><code>{GuildBan.reason}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/14.24.2/GuildBan:Class">Guild Ban Properties</a></td></tr><tr><td>Presence</td><td>Access the properties of a user's presence.</td><td><code>{Presence.status}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/Presence:Class">Presence Properties</a></td></tr><tr><td>VoiceState</td><td>Access the properties of a voice channel's state.</td><td><code>{VoiceState.selfMute}</code></td><td><a href="https://discord.js.org/docs/packages/discord.js/main/VoiceState:Class">Voice State Properties</a></td></tr></tbody></table>

### Music Variables

There are also some variables that allow for integration with the [music actions](https://botghost.com/docs/custom-commands-and-events/actions/music-actions). With these, you can do things like fetch information about the song or the player.

#### Music Objects

The following are object variables for music actions that are accessed the same way as described in the [Object Variables](#object-variables) section.

<table><thead><tr><th>Object Variable</th><th>Details</th><th width="269.85693359375">Example</th><th>Properties</th></tr></thead><tbody><tr><td>MusicPlayer</td><td>Access the properties of the server's music player.</td><td><code>{MusicPlayer.current}</code></td><td><a href="https://moonlink.js.org/api/player#properties">Music Player Properties</a></td></tr><tr><td>MusicCurrentTrack</td><td>Access the properties of the currently playing track.</td><td><code>{MusicCurrentTrack.author}</code></td><td><a href="https://moonlink.js.org/api/track#properties">Current Track Properties</a></td></tr><tr><td>MusicQueue</td><td>Access the properties of the music queue.</td><td><code>{MusicQueue.tracks[0].title}</code></td><td><a href="../getting-started/invite-your-bot">Music Queue Properties</a></td></tr><tr><td>MusicSearchResult</td><td>Access the properties of a search from <a href="actions/music-actions/search-tracks">Search Tracks</a></td><td><p><code>{MusicSearchResult[0].title}</code></p><p><code>{MusicSearchResult.query}</code> <br><br><br></p></td><td><a href="https://moonlink.js.org/api/search-result#overview">Search Result Properties</a></td></tr></tbody></table>

#### Music Variables

The following variables can be used as-is, similar to [basic variables](#basic-variables).

| Variable                                   | Information                                                                                               |
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------- |
| `{music_search_formatted_list}`            | Returns a nicely formatted list of all search results (numbered list with title, artist, and duration).   |
| `{music_search_status}`                    | Returns the status of the last search (success/no\_matches).                                              |
| `{music_search_results_length}`            | Returns the number of results found.                                                                      |
| `{music_search_query}`                     | Returns the search query that was used.                                                                   |
| `{music_current_track_title}`              | Returns the title of the currently playing track.                                                         |
| `{music_current_track_author}`             | Returns the author/artist of the currently playing track.                                                 |
| `{music_current_track_url}`                | Returns the URL of the currently playing track.                                                           |
| `{music_current_track_requester}`          | Returns the user ID of the user who requested the currently playing track.                                |
| `{music_current_duration_formatted}`       | Returns the duration of the currently playing track formatted as MM:SS or HH:MM:SS.                       |
| `{music_current_duration_total}`           | Returns the total duration of the current track in seconds.                                               |
| `{music_current_position_formatted}`       | Returns the current position formatted as MM:SS.                                                          |
| `{music_remaining_time_formatted}`         | Returns the remaining time in the current track formatted as MM:SS.                                       |
| `{music_position_percentage}`              | Returns the current position as a percentage of the total duration (0-100).                               |
| `{music_position_formatted_with_duration}` | Returns the current position and total duration, formatted like '1:23/4:56\`.                             |
| `{music_queue_length}`                     | Returns the number of tracks in the queue.                                                                |
| `{music_queue_next_track}`                 | Returns the title of the next track in the queue.                                                         |
| `{music_queue_next_track_author}`          | Returns the author/artist of the next track in the queue.                                                 |
| `{music_queue_total_duration_formatted}`   | Returns the total duration of all tracks in the queue formatted as HH:MM:SS.                              |
| `{music_queue_is_empty}`                   | Returns 'true' if the queue is empty, and 'false otherwise.                                               |
| `{music_queue_formatted_list}`             | A nicely formatted numbered list of all tracks in the queue (title, artist, and duration).                |
| `{music_queue_list}`                       | An unformatted comma-separated list of track titles in the queue (e.g. Song1,Song2,Song3).                |
| `{music_search_results_list}`              | Returns an unformatted comma-separated list of track titles from search results (e.g. Song1,Song2,Song3). |
| `{music_is_playing}`                       | Returns 'true' if music is playing, and 'false' otherwise.                                                |
| `{music_is_paused}`                        | Returns 'true' if the music is paused, and 'false' otherwise.                                             |
| `{music_is_connected}`                     | Returns 'true' if the bot is connect to a voice channel, 'false' otherwise.                               |
| `{music_is_ready}`                         | Returns 'true' if the music system is ready (i.e. connected to the lavalink node), 'false' otherwise.     |
| `{music_loop_mode_text}`                   | Returns 'Off', 'Track', or 'Queue' based on the loop mode.                                                |
| `{music_volume_percentage}`                | Returns the current volume as a percentage (e.g. '50%').                                                  |
| `{music_autoplay_status}`                  | Returns 'Enabled' or 'Disabled' for autoplay.                                                             |
| `{music_autoleave_status}`                 | Returns 'Enabled' or 'Disabled' for autoleave.                                                            |

### Collection / Array Variables

BotGhost offers some variables you can use for any array or collection (even from an API response), which allow you to retrieve specific information of the collection.

<table><thead><tr><th width="384.3333333333333">Variable</th><th>Information</th></tr></thead><tbody><tr><td><code>{lowestValue({BGVAR_collection})}</code></td><td>Returns the lowest value in a collection.</td></tr><tr><td><code>{highestValue({BGVAR_collection})}</code></td><td>Returns the highest numerical value in a collection.</td></tr><tr><td><code>{lengthOfCollection({BGVAR_collection})}</code></td><td>Returns the length of a collection.</td></tr><tr><td><code>{valueAtPosition({BGVAR_collection}),[2]}</code></td><td>Returns the value at a specific position in the collection. Positions start at 0.</td></tr><tr><td><code>{positionOfValue({BGVAR_collection}),[hello]}</code></td><td>Returns the position of a value.</td></tr><tr><td><code>{collectionCharacterLength({BGVAR_collection})}</code></td><td>Returns the total character length of a collection.</td></tr><tr><td><code>{printAllValues({BGVAR_collection}),[Hello $value]}</code></td><td>Prints all values in a collection. The text returned can be set in the []. Use <code>$value</code> to print the value, and <code>$index</code> to display the index of the value shown.</td></tr><tr><td><code>{getRandomFromCollection({BGVAR_collection})}</code></td><td>Returns a random value from the collection.</td></tr></tbody></table>

### Basic Variables

Below are all basic variables that you can use in the [command or event builder](https://docs.botghost.com/custom-commands-and-events/command-and-event-builder).

<table><thead><tr><th>Variable</th><th>Details</th><th data-type="checkbox">Supports Targets</th><th>Example Output</th></tr></thead><tbody><tr><td><code>{user}</code></td><td>Returns the mention of the user</td><td>false</td><td>&#x3C;@1085541861692813332></td></tr><tr><td><code>{server}</code></td><td>Returns the server name</td><td>false</td><td>BotGhost👻</td></tr><tr><td><code>{channel}</code></td><td>Returns the mention of the channel</td><td>false</td><td>&#x3C;#879733469452836864></td></tr><tr><td><code>{^ROLE NAME}</code></td><td>Returns the mention of a role on role name</td><td>false</td><td>&#x3C;@&#x26;1190298492661420163></td></tr><tr><td><code>{#CHANNEL NAME}</code></td><td>Returns the mention of a channel on channel name</td><td>false</td><td>&#x3C;#879733469452836864></td></tr><tr><td><code>{channel_name}</code></td><td>Returns the name of the channel</td><td>true</td><td>general-chat</td></tr><tr><td><code>{channel_type}</code></td><td>Returns the <a href="https://discord.com/developers/docs/resources/channel#channel-object-channel-types">type</a> of the channel</td><td>true</td><td>GUILD_TEXT</td></tr><tr><td><code>{channel_id}</code></td><td>Returns the ID of the channel</td><td>false</td><td>879733469452836864</td></tr><tr><td><code>{first_channel_id}</code></td><td>Returns the first channel ID of the server</td><td>true</td><td>879733469452836864</td></tr><tr><td><code>{server_members}</code></td><td>Returns the server member count</td><td>true</td><td>12</td></tr><tr><td><code>{server_icon}</code></td><td>Returns a URL to the server icon</td><td>true</td><td><img src="https://images-ext-1.discordapp.net/external/QqLsMnIC_pR6txB6Z-1mAg8rsxS2q3Jxdv7s3KJiK90/https/cdn.discordapp.com/avatars/1119939469529845820/aef6578c19f088d4afe521118349852f.png?format=webp&#x26;quality=lossless" alt=""></td></tr><tr><td><code>{server_id}</code></td><td>Returns the ID of the server</td><td>false</td><td>822426820447567872</td></tr><tr><td><code>{server_owner}</code></td><td>Returns the mention of the server owner</td><td>true</td><td>&#x3C;@136327647792726016></td></tr><tr><td><code>{server_owner_id}</code></td><td>Returns the ID of the server owner</td><td>true</td><td>136327647792726016</td></tr><tr><td><code>{user_icon}</code></td><td>Returns the icon of a user</td><td>true</td><td><img src="https://images-ext-1.discordapp.net/external/rKS98li2ANNum4p_g0N6uc72X8YBbuaDHvcZwM2MZ60/https/cdn.discordapp.com/avatars/136327647792726016/c09224ebac192909a9151ea5e9a41535.png?format=webp&#x26;quality=lossless" alt=""></td></tr><tr><td><code>{user_name}</code></td><td>Returns the user name of a user</td><td>true</td><td>tomtoise</td></tr><tr><td><code>{user_id}</code></td><td>Returns the ID of a user</td><td>true</td><td>136327647792726016</td></tr><tr><td><code>{user_tag}</code></td><td>Returns the user tag of a user</td><td>true</td><td>BotGhost Helper#4001<a href="https://discord.com/blog/welcome-to-the-new-era-of-discord-apps?ref=badge"><br></a></td></tr><tr><td><code>{user_discriminator}</code></td><td>Returns the discriminator of a user</td><td>true</td><td>#4001</td></tr><tr><td><code>{user_createdAt}</code></td><td>Returns the creation date of a user</td><td>true</td><td>Fri Apr 08 2022 13:51:34 GMT+0000 (Coordinated Universal Time)</td></tr><tr><td><code>{user_joined}</code></td><td>Returns the join date of the server from a user</td><td>true</td><td>Fri Apr 08 2022 13:51:34 GMT+0000 (Coordinated Universal Time)</td></tr><tr><td><code>{user_displayName}</code></td><td>Returns the display name of a user</td><td>true</td><td>Tomtoise</td></tr><tr><td><code>{user_status}</code></td><td>Returns the status of a user</td><td>true</td><td>online</td></tr><tr><td><code>{random[min,max]}</code></td><td>Returns a random number between min and max</td><td>false</td><td>6</td></tr><tr><td><code>{isNumber(TEXT)}</code></td><td>Checks if a string of text is a number</td><td>false</td><td>true</td></tr><tr><td><code>{randomCharacters(3)}</code></td><td>Returns a random set of numbers</td><td>false</td><td>hIVzhLgwIb</td></tr><tr><td><code>{charCount(TEXT)}</code></td><td>Returns the character count of a string of text</td><td>false</td><td>16</td></tr><tr><td><code>{isBot}</code></td><td>Checks if a user is a bot</td><td>true</td><td>true</td></tr><tr><td><code>{bot_serverCount}</code></td><td>Returns the server count of the bot</td><td>false</td><td>12</td></tr><tr><td><code>{user_name_encoded}</code></td><td>Returns a URL encoded version of a user name, useful when sending the user's name in API request's URLs</td><td>true</td><td>Tomtoise</td></tr><tr><td><code>{time_now}</code></td><td>Returns a timestamp of the current time</td><td>false</td><td>&#x3C;t:1724181552:R></td></tr><tr><td><code>{time_ahead_h_HOURS}</code></td><td>Returns a timestamp of a certain number of hours ahead</td><td>false</td><td>&#x3C;t:1724181552:R></td></tr><tr><td><code>{time_ahead_m_MINS}</code></td><td>Returns a timestamp of a certain number of minutes ahead</td><td>false</td><td>&#x3C;t:1724181552:R></td></tr><tr><td><code>{time_now_unix}</code></td><td>Returns a unix combination of the current time</td><td>false</td><td>1724181974</td></tr><tr><td><code>{time_ahead_unix_h_HOURS}</code></td><td>Returns a unix combination of a certain number of hours ahead</td><td>false</td><td>1724181974</td></tr><tr><td><code>{time_ahead_unix_m_MINS}</code></td><td>Returns a unix combination of a certain number of minutes ahead</td><td>false</td><td>1724181974</td></tr><tr><td><code>{time_ahead_unix_s_SECS}</code></td><td>Returns a unix combination of a certain number of seconds ahead</td><td>false</td><td>1724181974</td></tr><tr><td><code>{encode_text[TEXT]}</code></td><td>Returns url encoded text for API requests</td><td>false</td><td>Hello%2C%20how%20are%20you</td></tr><tr><td><code>{ISO_to_UNIX[Timestamp]}</code></td><td>Converts an ISO timestamp to an UNIX timestamp</td><td>false</td><td>1724181974</td></tr><tr><td><code>{UNIX_to_ISO[Timestamp]}</code></td><td>Converts an UNIX timestamp to an ISO timestamp</td><td>false</td><td>2024-02-26T20:28:40.902000+00:00</td></tr><tr><td><code>{HEX_to_DECIMAL[HEX]}</code></td><td>Converts a hex code to a decimal</td><td>false</td><td>1329119</td></tr><tr><td><code>{solve_equation[1+1]}</code></td><td>Solve a math equation</td><td>false</td><td>2</td></tr><tr><td><code>{previous_numbers(10)}</code></td><td>Returns all previous numbers of a given number</td><td>false</td><td>0, 1, 2, 3, 4, 5, 6, 7, 8, 9</td></tr><tr><td><code>{numberWithCommas[1000000]}</code></td><td>Formats large numbers with commas</td><td>false</td><td>1,000,000</td></tr><tr><td><code>{numberWithDots[1000000]}</code></td><td>Formats large numbers with dots</td><td>false</td><td>1.000.000</td></tr><tr><td><code>{bot_id}</code></td><td>Returns the ID of the bot</td><td>false</td><td>1085541861692813332</td></tr><tr><td><code>{hasRole([ROLE_ARRAY])}</code></td><td>Checks if the user has a set of roles</td><td>true</td><td>true</td></tr><tr><td><code>{isChannel([CHANNEL_ARRAY])}</code></td><td>Checks if the action is executed in a channel</td><td>true</td><td>true</td></tr><tr><td><code>{subString(Hello World),[0,5]}</code></td><td>Returns a substring of a given string</td><td>false</td><td>Hello</td></tr><tr><td><code>{toUpperCase(hello)}</code></td><td>Returns the given text to upper case</td><td>false</td><td>HELLO</td></tr><tr><td><code>{escape_characters[TEXT]}</code></td><td>Escapes the text provided to make it usable for API requests</td><td>false</td><td>Hello\nLine break</td></tr><tr><td><code>{websocket_ping}</code></td><td>Returns the ping of the bot</td><td>false</td><td>36 ms</td></tr><tr><td><code>{interaction_id}</code></td><td>Returns the ID of the interaction with the bot. This can be used in API requests to reply to interactions</td><td>false</td><td>1313779673350980230</td></tr><tr><td><code>{interaction_custom_id}</code></td><td>Returns the custom ID of the interaction with the bot (buttons/select menus)</td><td>false</td><td>A string of characters</td></tr><tr><td><code>{interaction_token}</code></td><td>Returns the token of the interaction with the bot. This can be used in API requests to reply to </td><td>false</td><td>A string of characters</td></tr><tr><td><code>{ignoreVariables[{anotherVariable}]}</code></td><td>Ignores all variables within the brackets <code>[]</code> and doesn't resolve them </td><td>false</td><td>{user}</td></tr><tr><td><code>{null}</code></td><td>Returns null (useful in comparison conditions)</td><td>false</td><td></td></tr></tbody></table>

### Error Variables

Those variables can be used with the error handler block or success / error handles when something goes wrong with your tree.

| Variable          | Description                                                                   |
| ----------------- | ----------------------------------------------------------------------------- |
| `{error_reason}`  | Returns the reason why the error occurred.                                    |
| `{error_message}` | Returns the error message associated with the action the error occurred from. |
| `{error_block}`   | Returns name of the block which the error occurred in.                        |

### Other Variables

<figure><img src="https://1937909199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lm_hW5MApY3J0lRhi0M%2Fuploads%2FVyBC6Yc3glIvnt1H7hZs%2Fimage.png?alt=media&#x26;token=f3fe8eff-f86f-4ed7-a966-dec4de2c4e64" alt=""><figcaption></figcaption></figure>

You can view all the available variables by checking the clipboard in the top right corner of a text input. This will open up a menu with a wide list of variables you can use in your command or event.

The available variables in your command-builder or event-builder may vary depending on the action, custom variables you have, API requests you use, and the event you might be using in case you are using the event builder.

| Variables                         | Details                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Event variables                   | Depending on what [event](https://docs.botghost.com/custom-commands-and-events/events) type you use, you will have an other set of basic variables that you can use to retrieve specific information of the event. Check out the [webhooks](https://botghost.com/docs/custom-commands-and-events/events/webhooks "mention") and [ifttt](https://botghost.com/docs/custom-commands-and-events/ifttt "mention")pages to know more about webhooks and IFTTT variables. |
| Data storage variables            | Depending on what [custom variables](https://docs.botghost.com/custom-commands-and-events/data-storage) you have created, you will have an other set of data storage variables.                                                                                                                                                                                                                                                                                     |
| Form variables                    | Depending on what you name your [form actions](https://docs.botghost.com/custom-commands-and-events/actions/message-actions/send-a-form) have, you will have an other set of form response variables.                                                                                                                                                                                                                                                               |
| API response variables            | Depending on what API request you use, you will have an other set of [API response](https://docs.botghost.com/custom-commands-and-events/actions/api-actions/send-an-api-request) variables.                                                                                                                                                                                                                                                                        |
| Error handler variables           | You can use a set of variables when your command or event triggers an error. You can use these variables to get, for example, the error reason. They can be used only below the "Error Handler" red block.                                                                                                                                                                                                                                                          |
| Option variables                  | Depending on your [option](https://docs.botghost.com/custom-commands-and-events/options) names, you can have option variables in your command builder.                                                                                                                                                                                                                                                                                                              |
| Unique variables                  | Depending on the [unique variables](https://docs.botghost.com/custom-commands-and-events/actions/other-actions/set-a-unique-variable) that you use in your command or event and their names, you will have a set of unique variables.                                                                                                                                                                                                                               |
| Success / error handler variables | You can use a set of variables when your action triggers an error. (If enabled) You can use these variables to get, for example, the error reason, message or action block.                                                                                                                                                                                                                                                                                         |
| Loop variables                    | You can use a few variables inside of a [loop](https://docs.botghost.com/custom-commands-and-events/actions/loop-actions) to get the loop count (`{loop_count}`) and index (`{loop_index}`).                                                                                                                                                                                                                                                                        |
| Created channel variables         | Depending on the name of a create a channel action, you can use a set of variables to get the channel name, ID and type. Check out the [create-a-channel](https://botghost.com/docs/custom-commands-and-events/actions/channel-actions/create-a-channel "mention") page for more.                                                                                                                                                                                   |
| Created / edited thread variables | You can create a variable to retrieve the name, ID and more of the created / edited thread. Check out the [create-a-thread](https://botghost.com/docs/custom-commands-and-events/actions/thread-and-forum-actions/create-a-thread "mention") and [edit-a-thread](https://botghost.com/docs/custom-commands-and-events/actions/thread-and-forum-actions/edit-a-thread "mention") pages for more.                                                                     |
| Invite variables                  | You can use a set of variables to get the codes from a created invite link. Check out the [create-server-invite](https://botghost.com/docs/custom-commands-and-events/actions/server-actions/create-server-invite "mention") page for more.                                                                                                                                                                                                                         |
| Manipulate some text variables    | You can use a variable of a name of your choice to get the result of the [manipulate-some-text](https://botghost.com/docs/custom-commands-and-events/actions/other-actions/manipulate-some-text "mention") action.                                                                                                                                                                                                                                                  |
