Quotes, points, credits, pronouns and Decks¶
C# methods for a Run C# code step. See C# methods for how to use them.
AddQuoteForTwitch¶
Saves a new quote said by a Twitch user, given by their user id. Set captureGame to true to also save the game you are playing.
int AddQuoteForTwitch(string userId, string quote, bool captureGame = false)
Gives back: The new quote's number, or -1 when the quote is empty.
Example
int id = CPH.AddQuoteForTwitch("123456789", "I meant to do that!", true);
CPH.SendMessage($"Saved quote #{id}");
AddQuoteForYouTube¶
Saves a new quote said by a YouTube user, given by their user (channel) id. The game is not saved.
int AddQuoteForYouTube(string userId, string quote)
Gives back: The new quote's number, or -1 when the quote is empty.
Example
int id = CPH.AddQuoteForYouTube("UCabc123", "Best stream ever!");
CPH.LogInfo($"Saved quote #{id}");
AddQuoteForKick¶
Saves a new quote said by a Kick user, given by their user id. Set captureGame to true to also save the game you are playing.
int AddQuoteForKick(string userId, string quote, bool captureGame = false)
Gives back: The new quote's number, or -1 when the quote is empty.
Example
int id = CPH.AddQuoteForKick("987654", "Never pet a creeper.");
CPH.LogInfo($"Saved quote #{id}");
GetQuote¶
Finds a saved quote by its number, with who said it, when and during which game.
QuoteData? GetQuote(int quoteId)
Gives back: The quote, or null (nothing) when there is no quote with that number.
Example
var quote = CPH.GetQuote(3);
if (quote != null) CPH.SendMessage($"#{quote.Id}: {quote.Quote} - {quote.User}");
GetQuoteCount¶
Counts how many quotes you have saved.
int GetQuoteCount()
Gives back: The number of quotes.
Example
int count = CPH.GetQuoteCount();
CPH.SendMessage($"We have {count} quotes!");
DeleteQuote¶
Deletes a saved quote by its number.
bool DeleteQuote(int quoteId)
Gives back: true when it was deleted, false when there is no quote with that number.
Example
bool gone = CPH.DeleteQuote(7);
CPH.LogInfo($"Quote 7 deleted: {gone}");
GetPoints¶
Reads how many points a viewer has. Give the points type (empty for your main points), the viewer's name, and the platform like "twitch" (empty uses the platform of the event).
long GetPoints(string pointDefinition, string user, string platform)
Gives back: The viewer's points, or 0 when the viewer or points type is unknown.
Example
long points = CPH.GetPoints("", "CoolViewer", "twitch");
CPH.SendMessage($"CoolViewer has {points} points");
AddPoints¶
Gives a viewer points. Set applyMultipliers to true to multiply the amount by their bonus (multiplier). The viewer must have chatted or have points already.
long AddPoints(string pointDefinition, string user, string platform, long amount, bool applyMultipliers = false)
Gives back: The viewer's new total, or 0 when the viewer is unknown.
Example
long total = CPH.AddPoints("", "CoolViewer", "twitch", 100);
CPH.LogInfo($"New total: {total}");
UpdatePoints¶
Changes a viewer's points by an amount: a positive number adds, a negative number takes away. Works the same as AddPoints.
long UpdatePoints(string pointDefinition, string user, string platform, long amount, bool applyMultipliers = false)
Gives back: The viewer's new total, or 0 when the viewer is unknown.
Example
long total = CPH.UpdatePoints("", "CoolViewer", "twitch", -50);
CPH.LogInfo($"New total: {total}");
UpdateBulkPoints¶
Changes the points of every viewer in a list by the same amount: a positive number adds, a negative number takes away. Unknown viewers are skipped.
void UpdateBulkPoints(string pointDefinition, List<string> users, string platform, long amount, bool applyMultipliers = false)
Gives back: Nothing.
Example
CPH.UpdateBulkPoints("", new List<string> { "CoolViewer", "NightOwl" }, "twitch", 25);
SetPoints¶
Sets a viewer's points to an exact number.
long SetPoints(string pointDefinition, string user, string platform, long amount)
Gives back: The viewer's new total, or 0 when the viewer is unknown.
Example
long total = CPH.SetPoints("", "CoolViewer", "twitch", 1000);
CPH.LogInfo($"Points set to {total}");
SpendPoints¶
Takes points from a viewer, but only when they have enough. Handy for a reward that costs points.
bool SpendPoints(string pointDefinition, string user, string platform, long amount)
Gives back: true when the points were taken, false when the viewer has too few or is unknown (nothing is taken).
Example
bool paid = CPH.SpendPoints("", "CoolViewer", "twitch", 500);
if (paid) CPH.SendMessage("Enjoy your reward!");
RemovePoints¶
Deletes a viewer's points of one points type completely.
bool RemovePoints(string pointDefinition, string user, string platform)
Gives back: true when they were deleted, false when the viewer had none or is unknown.
Example
bool removed = CPH.RemovePoints("", "CoolViewer", "twitch");
CPH.LogInfo($"Removed: {removed}");
ResetUserPoints¶
Sets a viewer's points back to 0.
void ResetUserPoints(string pointDefinition, string user, string platform)
Gives back: Nothing.
Example
CPH.ResetUserPoints("", "CoolViewer", "twitch");
TransferPoints¶
Moves points from one viewer to another. Leave the second platform empty to use the first one.
bool TransferPoints(string pointDefinition, string sourceUser, string sourcePlatform, string targetUser, string targetPlatform, long amount)
Gives back: true when the points were moved, false when the giver has too few or either viewer is unknown.
Example
bool moved = CPH.TransferPoints("", "CoolViewer", "twitch", "NightOwl", "twitch", 200);
CPH.LogInfo($"Gift sent: {moved}");
AwardPointsToAll¶
Gives points to every viewer Cuebot knows, or only those on one platform. Set onlyActive to true to give them only to viewers who are in chat right now.
int AwardPointsToAll(string pointDefinition, long amount, string? platform = null, bool onlyActive = false, bool applyMultipliers = false)
Gives back: How many viewers got points.
Example
int paid = CPH.AwardPointsToAll("", 50, "twitch");
CPH.SendMessage($"{paid} viewers got 50 points!");
AwardPointsToGroup¶
Gives points to every member of a user group.
int AwardPointsToGroup(string pointDefinition, string groupName, long amount, bool applyMultipliers = false)
Gives back: How many viewers got points.
Example
int paid = CPH.AwardPointsToGroup("", "Raid Team", 100);
CPH.LogInfo($"Paid {paid} members");
GetGroupMultiplier¶
Reads a user group's points bonus (multiplier). 2 means members earn double.
double GetGroupMultiplier(string pointDefinition, string groupName)
Gives back: The multiplier, or 1 when the group has none.
Example
double bonus = CPH.GetGroupMultiplier("", "Regulars");
CPH.LogInfo($"Regulars earn x{bonus}");
SetGroupMultiplier¶
Sets a user group's points bonus (multiplier). 2 means members earn double.
void SetGroupMultiplier(string pointDefinition, string groupName, double multiplier)
Gives back: Nothing.
Example
CPH.SetGroupMultiplier("", "Regulars", 1.5);
RemoveGroupMultiplier¶
Removes a user group's points bonus, so its members earn the normal amount.
void RemoveGroupMultiplier(string pointDefinition, string groupName)
Gives back: Nothing.
Example
CPH.RemoveGroupMultiplier("", "Regulars");
GetUserMultiplier¶
Reads a viewer's total points bonus (multiplier), from their own bonus, their groups and their roles (like sub or VIP).
double GetUserMultiplier(string pointDefinition, string user, string platform)
Gives back: The multiplier, or 1 when no bonus applies.
Example
double bonus = CPH.GetUserMultiplier("", "CoolViewer", "twitch");
CPH.LogInfo($"CoolViewer earns x{bonus}");
GetLeaderboard¶
Gets the viewers with the most points. count is how many (0 or less gives everyone); offset skips that many from the top first.
List<PointsLeaderboardEntry> GetLeaderboard(string pointDefinition, int count = 10, int offset = 0)
Gives back: A list of places, each with rank, platform, user name, user id and points.
Example
var top = CPH.GetLeaderboard("", 3);
foreach (var entry in top) CPH.SendMessage($"#{entry.Rank} {entry.UserName}: {entry.Points}");
GetPointDefinition¶
Gets the settings of a points type by its name (empty for your main points): its names, symbol, highest allowed balance and whether it only counts while live.
PointDefinition? GetPointDefinition(string pointDefinition)
Gives back: The points type, or null (nothing) when there is none with that name.
Example
var coins = CPH.GetPointDefinition("Coins");
if (coins != null) CPH.LogInfo($"{coins.Name} enabled: {coins.Enabled}");
GetPointDefinitions¶
Lists all your points types, your main one first.
List<PointDefinition> GetPointDefinitions()
Gives back: A list of points types.
Example
var types = CPH.GetPointDefinitions();
CPH.LogInfo($"You have {types.Count} points type(s)");
ResetPointDefinition¶
Sets every viewer's points of one points type back to 0. Careful: this cannot be undone.
void ResetPointDefinition(string pointDefinition)
Gives back: Nothing.
Example
CPH.ResetPointDefinition("Coins");
ResetCredits¶
Clears the end-of-stream credits collected so far (followers, subs, raiders and so on).
void ResetCredits()
Gives back: Nothing.
Example
CPH.ResetCredits();
ResetFirstWords¶
Forgets who has chatted, on every platform, so everyone's next message runs the First Words trigger again.
void ResetFirstWords()
Gives back: Nothing.
Example
CPH.ResetFirstWords();
PronounLookup¶
Looks up a Twitch user's pronouns from alejo.io (pronouns.alejo.io), by their login name.
Dictionary<string, object?>? PronounLookup(string userLogin)
Gives back: A list of named values (hasPronouns, pronoun, pronounSubject, pronounObject and more), or null (nothing) when the name is empty or the lookup failed.
Example
var p = CPH.PronounLookup("CoolViewer");
if (p != null) CPH.LogInfo("Pronouns: " + p["pronoun"]);
PronounClearForUserlogin¶
Forgets saved pronouns so the next lookup asks alejo.io again. Cuebot clears them for every user, not just the one you name.
void PronounClearForUserlogin(string userLogin)
Gives back: Nothing.
Example
CPH.PronounClearForUserlogin("CoolViewer");
ShowToastNotification¶
Shows a pop-up notification on your computer. An attribution text is added under the message. The form with an id first gives that id as the toastId variable when the pop-up is clicked.
void ShowToastNotification(string title, string message, string? attribution = null, string? iconPath = null)
void ShowToastNotification(string id, string title, string message, string? attribution, string? iconPath = null)
Gives back: Nothing.
Example
CPH.ShowToastNotification("New follower", "CoolViewer just followed!");
PlaySoundFromFolder¶
Plays a random sound file (wav, mp3, ogg, flac) from a folder. Volume is 0.0 to 1.0. Set recursive to look in folders inside it too; set finishBeforeContinuing to wait until it ends.
double PlaySoundFromFolder(string path, float volume = 1.0f, bool recursive = false, bool finishBeforeContinuing = false, string? name = null, bool useFileName = true)
Gives back: How long the sound is, in seconds, or 0 when the folder has no sounds.
Example
double seconds = CPH.PlaySoundFromFolder("C:/Stream/Sounds/Hype", 0.8f);
CPH.LogInfo($"Playing a {seconds} second sound");
DeckItemSetBackground¶
Changes the background colour or picture of a button on one of your Decks. Decks and buttons are found by id or name. fileId works as a picture link or file path. state picks the button state (0 is normal).
void DeckItemSetBackground(string deckId, string itemId, string? color = null, string? url = null, string? fileId = null, int? state = null)
Gives back: Nothing.
Example
CPH.DeckItemSetBackground("Main", "Mute Mic", color: "#FF0000");
DeckItemSetIcon¶
Changes the icon of a button on one of your Decks: its colour, icon name, or a picture link (fileId works as a picture link or path too). state picks the button state (0 is normal).
void DeckItemSetIcon(string deckId, string itemId, string? color = null, string? name = null, string? url = null, string? fileId = null, int? state = null)
Gives back: Nothing.
Example
CPH.DeckItemSetIcon("Main", "Mute Mic", color: "#FFFFFF", url: "https://example.com/mic-off.png");
DeckItemSetState¶
Switches a button on one of your Decks to another state. States count from 0 (the normal state).
void DeckItemSetState(string deckId, string itemId, int state)
Gives back: Nothing.
Example
CPH.DeckItemSetState("Main", "Mute Mic", 1);
DeckItemSetTitle¶
Changes the words on a button on one of your Decks, and optionally their colour. state picks the button state (0 is normal).
void DeckItemSetTitle(string deckId, string itemId, string title, string? color = null, int? state = null)
Gives back: Nothing.
Example
CPH.DeckItemSetTitle("Main", "Mute Mic", "MUTED", "#FF0000");
DeckItemSetValue¶
Sets the number shown on a button on one of your Decks, like a death counter. state picks the button state (0 is normal).
void DeckItemSetValue(string deckId, string itemId, int value, int? state = null)
Gives back: Nothing.
Example
CPH.DeckItemSetValue("Main", "Deaths", 12);
DeckItemToggleState¶
Switches a button on one of your Decks between state 0 and state 1, like an on/off switch.
void DeckItemToggleState(string deckId, string itemId)
Gives back: Nothing.
Example
CPH.DeckItemToggleState("Main", "Mute Mic");
DeckNotify¶
Shows a message with a title on one of your Decks. Cuebot's Deck messages have no colour or sound, so those are ignored.
void DeckNotify(string deckId, string title, string description, string? color = null, string? soundId = null)
Gives back: Nothing.
Example
CPH.DeckNotify("Main", "Raid!", "NightOwl is raiding with 50 viewers");
DeckPageNext¶
Moves one of your Decks to its next page. After the last page it starts again at the first.
void DeckPageNext(string deckId)
Gives back: Nothing.
Example
CPH.DeckPageNext("Main");
DeckPagePrev¶
Moves one of your Decks to its previous page. Before the first page it goes to the last.
void DeckPagePrev(string deckId)
Gives back: Nothing.
Example
CPH.DeckPagePrev("Main");
DeckPageSet¶
Shows a page of one of your Decks by number, counting from 1 like the Decks editor.
void DeckPageSet(string deckId, int page)
Gives back: Nothing.
Example
CPH.DeckPageSet("Main", 2);