Skip to content
Variables getChannelVar

$getChannelVar[]

$getChannelVar reads a variable scoped to a Discord channel. The variable value is specific to that channel context within a server. When called with only a name, it reads from the channel where the command is being executed (((channel.id))). When a Channel ID is provided, the variable is read from the specified channel.

Syntax

bdfd
$getChannelVar[name] or $getChannelVar[name;Channel ID]

Variables are defined and configured in the Bot Creator Variables UI, where you can set default values per variable. If a variable has not been set via $setChannelVar but a default exists in the definitions, $getChannelVar returns that default. If neither a stored value nor a default exists, an empty string is returned.

JavaScript (BDJS) equivalent: await db.channel.get('name') — see db.channel.

Examples

Channel Slowmode Config

$title[Channel Settings]
$description[Custom slowmode: `$getChannelVar[customSlowmode;$channelID]` seconds]
$color[#5865F2]
$sendMessage[]