Skip to content

Groups script functions

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

groups.add

Puts a viewer in a group, like "Giveaway". The group is made when it does not exist yet. Leave the user out for the person who triggered the action.

Value What to put in
group The group name, like "Giveaway".
platform Optional. The platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The user name, like "CoolViewer42" (a leading @ is fine). Leave it out for the user of the trigger.
userId Optional. The user's id on that platform. Leave it out for the id of the trigger's user.

Gives back: true when added, false when they were already in it.

var answer = await Cb.Call("groups.add", new { group = "Giveaway" });
answer = cb.call("groups.add", group="Giveaway")

groups.clear

Takes every viewer out of a group. The group itself stays.

Value What to put in
group The group name, like "Giveaway".

Gives back: How many viewers were removed, or -1 when there is no such group.

var answer = await Cb.Call("groups.clear", new { group = "Giveaway" });
answer = cb.call("groups.clear", group="Giveaway")

groups.contains

Checks whether a viewer is in a group. Matches by user id when both have one, otherwise by name.

Value What to put in
group The group name, like "Giveaway".
platform Optional. The platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The user name, like "CoolViewer42" (a leading @ is fine). Leave it out for the user of the trigger.
userId Optional. The user's id on that platform. Leave it out for the id of the trigger's user.

Gives back: true when they are in the group, otherwise false.

var answer = await Cb.Call("groups.contains", new { group = "Giveaway", user = "CoolViewer42" });
answer = cb.call("groups.contains", group="Giveaway", user="CoolViewer42")

groups.create

Makes a new, empty group.

Value What to put in
group The group name, like "Giveaway".

Gives back: true when it was made, false when a group with that name already exists.

var answer = await Cb.Call("groups.create", new { group = "Giveaway" });
answer = cb.call("groups.create", group="Giveaway")

groups.delete

Deletes a group and its member list.

Value What to put in
group The group name, like "Giveaway".

Gives back: true when it was deleted, false when there was no such group.

var answer = await Cb.Call("groups.delete", new { group = "Giveaway" });
answer = cb.call("groups.delete", group="Giveaway")

groups.exists

Checks whether a group with this name exists.

Value What to put in
group The group name, like "Giveaway".

Gives back: true when it exists, otherwise false.

var answer = await Cb.Call("groups.exists", new { group = "Giveaway" });
answer = cb.call("groups.exists", group="Giveaway")

groups.list

Lists the names of all your groups.

Gives back: A list of group names, like ["Giveaway", "Regulars"].

var answer = await Cb.Call("groups.list");
answer = cb.call("groups.list")

groups.remove

Takes a viewer out of a group. Leave the user out for the person who triggered the action.

Value What to put in
group The group name, like "Giveaway".
platform Optional. The platform, like "twitch". Leave it out for the platform of the trigger.
user Optional. The user name, like "CoolViewer42" (a leading @ is fine). Leave it out for the user of the trigger.
userId Optional. The user's id on that platform. Leave it out for the id of the trigger's user.

Gives back: true when removed, false when they were not in it.

var answer = await Cb.Call("groups.remove", new { group = "Giveaway", user = "CoolViewer42" });
answer = cb.call("groups.remove", group="Giveaway", user="CoolViewer42")

groups.users

Lists the viewers in a group.

Value What to put in
group The group name, like "Giveaway".

Gives back: A list of members, each with platform, userId and userName. Empty when the group does not exist.

var answer = await Cb.Call("groups.users", new { group = "Giveaway" });
answer = cb.call("groups.users", group="Giveaway")