Skip to content
Variables resetChannelVar

$resetChannelVar[]

$resetChannelVar restores a channel-scoped variable to its default value defined in the Bot Creator Variables UI. If no default value is declared for the variable, the function raises an error (“No declared default for …”) instead of removing it. A variable that was never declared in the Variables UI but was created by a $set...Var write has the first written value as its declared default.

Syntax

bdfd
$resetChannelVar[name]

The function takes exactly one argument, the variable name (an empty name raises an error). It resets the variable in every channel where a value is stored, not only the current one; it does not accept a Channel ID.

Use this function to clear channel-specific settings, reset counters, or restore channel defaults. After resetting, $getChannelVar returns the default value. This function does not return any output.

Examples

Reset Channel Variable

$resetChannelVar[topicLock]
$title[Reset Variable]
$description[Reset `topicLock` variable to its default value.]
$color[#57F287]

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.