Skip to content

Points script functions

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

points.add

Gives a viewer points. A negative amount takes points away. The balance never goes below 0. Leave the user out for the person who triggered the action.

Value What to put in
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The viewer's name, like "CoolViewer42" (a leading @ is fine). They must have chatted or have points before.
userId Optional. The viewer's id on that platform. Leave user and userId out for the person who triggered the action.
amount How many points, a whole number like 100. Use a negative number to take points away.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: The viewer's new balance.

var answer = await Cb.Call("points.add", new { amount = 100 });
answer = cb.call("points.add", amount=100)

points.awardGroup

Gives points to every viewer in a user group (see the Groups page), like a bonus for regulars. Fails when the group does not exist.

Value What to put in
group The group name, like "Regulars".
amount How many points, a whole number like 100.
applyMultipliers Optional. true multiplies each viewer's amount by their multiplier. Leave it out for false.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: How many viewers got points.

var answer = await Cb.Call("points.awardGroup", new { group = "Regulars", amount = 50 });
answer = cb.call("points.awardGroup", group="Regulars", amount=50)

points.currencies

Lists your points currencies, like "points" or "coins". The default currency comes first.

Gives back: A list. Each currency has name, singularName, symbol, variableName and enabled.

var answer = await Cb.Call("points.currencies");
answer = cb.call("points.currencies")

points.format

Turns a number into nice points text, like "1,250 points", "1 point" or "🍪1,250" when the currency has a symbol.

Value What to put in
amount How many points, a whole number like 100.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: The text, like "1,250 points".

var answer = await Cb.Call("points.format", new { amount = 1250 });
answer = cb.call("points.format", amount=1250)

points.get

Reads how many points a viewer has. Leave the user out for the person who triggered the action. Fails when the viewer cannot be found.

Value What to put in
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The viewer's name, like "CoolViewer42" (a leading @ is fine). They must have chatted or have points before.
userId Optional. The viewer's id on that platform. Leave user and userId out for the person who triggered the action.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: The balance, a whole number.

var answer = await Cb.Call("points.get", new { user = "CoolViewer42" });
answer = cb.call("points.get", user="CoolViewer42")

points.leaderboard

Gives you the viewers with the most points, highest first. Handy for a !top command.

Value What to put in
platform Optional. Only viewers of this platform, like "twitch". Leave it out for every platform.
count Optional. How many to give back. Leave it out for 10; 0 gives everyone.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: A list. Each place has rank, platform, userId, userName and points.

var answer = await Cb.Call("points.leaderboard", new { count = 5 });
answer = cb.call("points.leaderboard", count=5)

points.multiplier

Tells you how much a viewer's automatic earnings are multiplied, from their role, their groups and their own multiplier.

Value What to put in
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The viewer's name, like "CoolViewer42" (a leading @ is fine). They must have chatted or have points before.
userId Optional. The viewer's id on that platform. Leave user and userId out for the person who triggered the action.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: The multiplier, like 1.5 (1 means normal).

var answer = await Cb.Call("points.multiplier", new { user = "CoolViewer42" });
answer = cb.call("points.multiplier", user="CoolViewer42")

points.remove

Takes points from a viewer. The balance never goes below 0. Leave the user out for the person who triggered the action.

Value What to put in
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The viewer's name, like "CoolViewer42" (a leading @ is fine). They must have chatted or have points before.
userId Optional. The viewer's id on that platform. Leave user and userId out for the person who triggered the action.
amount How many points, a whole number like 100.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: The viewer's new balance.

var answer = await Cb.Call("points.remove", new { amount = 50 });
answer = cb.call("points.remove", amount=50)

points.set

Sets a viewer's points to an exact number. Leave the user out for the person who triggered the action.

Value What to put in
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The viewer's name, like "CoolViewer42" (a leading @ is fine). They must have chatted or have points before.
userId Optional. The viewer's id on that platform. Leave user and userId out for the person who triggered the action.
amount How many points, a whole number like 100.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: The new balance.

var answer = await Cb.Call("points.set", new { user = "CoolViewer42", amount = 500 });
answer = cb.call("points.set", user="CoolViewer42", amount=500)

points.setGroupMultiplier

Sets a multiplier for everyone in a user group, so they earn more (or less) points automatically.

Value What to put in
group The group name, like "Regulars".
multiplier A number like 1.5 or "2x". Leave it empty (or "none") to remove the multiplier.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: true. Fails when the group is empty or the multiplier is not a number.

var answer = await Cb.Call("points.setGroupMultiplier", new { group = "Regulars", multiplier = 1.5 });
answer = cb.call("points.setGroupMultiplier", group="Regulars", multiplier=1.5)

points.setUserMultiplier

Sets one viewer's own multiplier, so they earn more (or less) points automatically. Leave the user out for the person who triggered the action.

Value What to put in
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The viewer's name, like "CoolViewer42" (a leading @ is fine). They must have chatted or have points before.
userId Optional. The viewer's id on that platform. Leave user and userId out for the person who triggered the action.
multiplier A number like 1.5 or "2x". Leave it empty (or "none") to remove the multiplier.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: true. Fails when the viewer cannot be found or the multiplier is not a number.

var answer = await Cb.Call("points.setUserMultiplier", new { user = "CoolViewer42", multiplier = 2 });
answer = cb.call("points.setUserMultiplier", user="CoolViewer42", multiplier=2)

points.spend

Takes points from a viewer only when they have enough, like paying for a reward. Nothing changes when they are short.

Value What to put in
platform Optional. The viewer's platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The viewer's name, like "CoolViewer42" (a leading @ is fine). They must have chatted or have points before.
userId Optional. The viewer's id on that platform. Leave user and userId out for the person who triggered the action.
amount How many points, a whole number like 100.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: true when the points were paid, false when the viewer did not have enough.

var answer = await Cb.Call("points.spend", new { amount = 200 });
answer = cb.call("points.spend", amount=200)

points.transfer

Moves points from one viewer to another, like a !give command. Fails when the giver has too few points or gives to themselves.

Value What to put in
platform Optional. The giver's platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The giver's name. Leave user and userId out for the person who triggered the action.
userId Optional. The giver's id on that platform.
to The name of the viewer who gets the points, like "CoolViewer42". They must have chatted or have points before.
toUserId Optional. The receiver's id, instead of the name.
toPlatform Optional. The receiver's platform. Leave it out for the giver's platform.
amount How many points to give, a whole number above 0, like 100.
currency Optional. Which currency, by name, like "coins". Leave it out for your default currency.

Gives back: An object with from (the giver's new balance) and to (the receiver's new balance).

var answer = await Cb.Call("points.transfer", new { to = "CoolViewer42", amount = 100 });
answer = cb.call("points.transfer", to="CoolViewer42", amount=100)