Skip to content

Spending script functions

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

spending.add

Adds a purchase by hand, like a cash gift. It counts toward the top spenders like any other purchase.

Value What to put in
user Optional. Who spent the money. Leave it out for the user of the trigger.
platform Optional. The platform to list them under. Leave it out for the platform of the trigger (or Manual).
amount How much, like 10.
currency Optional. The currency, like "EUR". Leave it out for your chosen currency.
label Optional. What it was, like "Cash gift".

Gives back: true. Fails when the user is empty or the amount is not more than 0.

var answer = await Cb.Call("spending.add", new { user = "CoolViewer42", platform = "Manual", amount = 10, currency = "USD", label = "Cash gift" });
answer = cb.call("spending.add", user="CoolViewer42", platform="Manual", amount=10, currency="USD", label="Cash gift")

spending.newStream

Starts a new stream for the top spenders: "stream" lists start empty and exchange rates are fetched again. Cuebot does this by itself when you go live.

Gives back: true.

var answer = await Cb.Call("spending.newStream");
answer = cb.call("spending.newStream")

spending.platforms

Lists the platforms anyone has spent money on, so you can ask for each platform's top spenders.

Gives back: A list of platform names, like ["Twitch", "YouTube"].

var answer = await Cb.Call("spending.platforms");
answer = cb.call("spending.platforms")

spending.remove

Removes what one person spent, for example after a refund or a test.

Value What to put in
user Whose purchases to remove.
platform Optional. Only on this platform. Leave it out for every platform.
period Optional. stream, day, week, month, year or all. Leave it out for all.

Gives back: How many purchases were removed.

var answer = await Cb.Call("spending.remove", new { user = "CoolViewer42", period = "stream" });
answer = cb.call("spending.remove", user="CoolViewer42", period="stream")

spending.stream

Tells you about the current stream: when it started and which exchange rates it locked in.

Gives back: An object with id, startedAt, endedAt, currency, ratesSource and ratesDate, or null before anything was bought.

var answer = await Cb.Call("spending.stream");
answer = cb.call("spending.stream")

spending.top

Gives you the top spenders of a period, on one platform or all of them, highest first, in your chosen currency.

Value What to put in
period Optional. stream, day, week, month, year or all. Leave it out for stream.
platform Optional. One platform, like "Twitch". Leave it out for every platform together.
count Optional. How many people, like 5. Leave it out for 10.

Gives back: An object with period, platform, currency, total, pending (purchases still waiting for exchange rates) and spenders. Each spender has rank, user, platform, total, count and breakdown (what they spent on each kind of thing, like Cheer or Super Chat).

var answer = await Cb.Call("spending.top", new { period = "week", platform = "Twitch", count = 5 });
answer = cb.call("spending.top", period="week", platform="Twitch", count=5)