Skip to content
Variables variablesCount

$variablesCount[]

$variablesCount provides a quick way to check how many variables are active in the current execution context. This is useful for validation, debugging, and conditional logic.

Syntax

bdfd
$variablesCount[(Type)]

Return Value

The count is always returned as a string representation of an integer (e.g., "3", "0", "15"). When used in numeric comparisons, BDFD will automatically coerce the string to a number.

Type Filtering

When a Type parameter is provided, only variables of that type are counted:

  • $variablesCount — count all active variables (all types).
  • $variablesCount[temp] — count only temporary variables.

Comparison with $listVar

While $listVar gives the names and values of temporary variables, $variablesCount gives only the count. Use $variablesCount when you need a numeric check (e.g., “are there at least 3 variables?”) without the overhead of formatting a full list.

Examples

Display Variable Count

$title[Variables Stats]
$description[This bot defines **$variablesCount** persistent variables.]
$color[#5865F2]
$sendMessage[]