Variables

Want to use a variable in the command or event builder?

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. You can view the available variables by checking the clipboard in the top right corner of each action. In the picture, the clipboard is indicated by the red arrow in a Plain Reply action.

Clipboard with available variables indicated by the red arrow

Object Variables

Some variables in BotGhost allow you to access properties of a larger object 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. Currently these objects are available:

  • {Guild}

  • {Channel}

  • {Member}

  • {User}

Guild Variable

The guild variable gives you access to the properties of the guild (server) a command was used in or an event was triggered in. You can also access a specific guild by enclosing a guild id in square brackets ({Guild[822426820447567872].name}.

Through dot notation, you are able to access all the properties of the Discord.js Guild Object.

For example:

  • {Guild.name}

  • {Guild[822426820447567872].name}

  • {Guild.roles}

  • {Guild.bans}

  • {Guild.icon}

For a full list of properties make sure to checkout the properties section on the Discord.js Wiki.

Channel Variable

The channel variable gives you access to the properties of the channel a command was used in or an event was triggered in. You can also access a specific channel by enclosing a channel id in square brackets ({Channel[1111802548312096778].name}.

For events this will be the channel associated with the event. For voice events this will be a voice channel.

Through dot notation, you are able to access all the properties of the Discord.js Channel Object. For voice events, you can access properties of the Voice Channel.

For example:

  • {Channel.name}

  • {Channel[1111802548312096778].name}

  • {Channel.type}

  • {Channel.id}

  • {Channel.position}

For a full list of properties make sure to checkout the properties section on the Discord.js Wiki.

Member Variable

The member variable gives you access to the properties of the guild member who used a command or triggered an event. You can also access a specific member by enclosing a member id in square brackets ({Member[136327647792726016].avatar}.

Through dot notation, you are able to access all the properties of the Discord.js GuildMember Object.

For example:

  • {Member.user.username}

  • {Member[136327647792726016].user.username}

  • {Member.avatar}

  • {Member.roles}

  • {Member.presence}

For a full list of properties make sure to checkout the properties section on the Discord.js Wiki.

User Variable

The user variable gives you access to the properties of the user who used a command or triggered an event. You can also access a specific user by enclosing a user id in square brackets ({User[136327647792726016].avatar}.

Through dot notation, you are able to access all the properties of the Discord.js User Object.

For example:

  • {User.username}

  • {User.globalName}

  • {User.avatar}

  • {User.banner}

For a full list of properties make sure to checkout the properties section on the Discord.js Wiki.

Last updated