Skip to content

User variables script functions

Functions for C# (Cb.Call) and Python (cb.call). See Script functions for how to use them.

userVars.all

Gives you every variable saved for one viewer. Leave the user settings out for the person who triggered the action.

Value What to put in
platform Optional. The viewer's platform, like "twitch", "youtube" or "kick". Leave it out for the platform of the trigger.
userId Optional. The viewer's id on that platform.
userName Optional. The viewer's name. Cuebot looks it up among viewers it has seen before.

Gives back: An object with every variable name and its value. Empty when no viewer was found.

var answer = await Cb.Call("userVars.all", new { platform = "twitch", userName = "CoolViewer42" });
answer = cb.call("userVars.all", platform="twitch", userName="CoolViewer42")

userVars.clearTemporary

Deletes every temporary user variable (the ones that are not saved), for all viewers.

Value What to put in
platform Optional. Only clear viewers of this platform, like "twitch". Leave it out for every platform.

Gives back: How many variables were deleted.

var answer = await Cb.Call("userVars.clearTemporary");
answer = cb.call("userVars.clearTemporary")

userVars.delete

Deletes one variable of one viewer. Leave the user settings out for the person who triggered the action.

Value What to put in
name The variable name, like "lastSeen".
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
userId Optional. The viewer's id on that platform.
userName Optional. The viewer's name. Cuebot looks it up among viewers it has seen before.

Gives back: true when the variable existed, otherwise false (also when no viewer was found).

var answer = await Cb.Call("userVars.delete", new { name = "lastSeen" });
answer = cb.call("userVars.delete", name="lastSeen")

userVars.deleteForAllUsers

Deletes one variable from every viewer at once. Handy to reset a weekly score.

Value What to put in
name The variable name, like "weeklyScore".
platform Optional. Only viewers of this platform, like "twitch". Leave it out for every platform.

Gives back: How many viewers lost the variable.

var answer = await Cb.Call("userVars.deleteForAllUsers", new { name = "weeklyScore" });
answer = cb.call("userVars.deleteForAllUsers", name="weeklyScore")

userVars.get

Reads a variable saved for one viewer. Leave the user settings out for the person who triggered the action.

Value What to put in
name The variable name, like "wins".
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
userId Optional. The viewer's id on that platform.
userName Optional. The viewer's name. Cuebot looks it up among viewers it has seen before.
default Optional. What to give back when the viewer has no such variable, like 0.

Gives back: The value, or your default (null if you gave none) when it is missing.

var answer = await Cb.Call("userVars.get", new Dictionary<string, object?> { ["name"] = "wins", ["default"] = 0 });
answer = cb.call("userVars.get", name="wins", default=0)

userVars.increment

Adds to a number saved for one viewer, like their win count. A missing variable starts at 0. Fails when no viewer can be found.

Value What to put in
name The variable name, like "wins".
amount Optional. How much to add, like 1. Use a negative number to subtract. Leave it out to add 1.
persisted Optional. true (the default) saves it so it is still there after a restart; false keeps it only until Cuebot closes.
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
userId Optional. The viewer's id on that platform.
userName Optional. The viewer's name. Cuebot looks it up among viewers it has seen before.

Gives back: The new value.

var answer = await Cb.Call("userVars.increment", new { name = "wins", amount = 1 });
answer = cb.call("userVars.increment", name="wins", amount=1)

userVars.set

Saves a value for one viewer, like their favourite game. Leave the user settings out for the person who triggered the action. Fails when no viewer can be found.

Value What to put in
name The variable name, like "favouriteGame". No spaces.
value The value to store: text, a number or true/false.
persisted Optional. true (the default) saves it so it is still there after a restart; false keeps it only until Cuebot closes.
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
userId Optional. The viewer's id on that platform.
userName Optional. The viewer's name. Cuebot looks it up among viewers it has seen before.

Gives back: Nothing.

var answer = await Cb.Call("userVars.set", new { name = "favouriteGame", value = "Minecraft" });
answer = cb.call("userVars.set", name="favouriteGame", value="Minecraft")