YouTube, Kick, Meld Studio, OBS filters and Parse¶
C# methods for a Run C# code step. See C# methods for how to use them.
YouTubeGetBroadcaster¶
Gets the YouTube account you signed in with as the broadcaster: its name, handle, id and picture.
YouTubeUserInfo? YouTubeGetBroadcaster()
Gives back: The account (UserName, UserLogin, UserId, ProfileImageUrl, LastActive), or null when no broadcaster is signed in.
Example
var me = CPH.YouTubeGetBroadcaster();
if (me != null) CPH.LogInfo($"Broadcaster: {me.UserName}");
YouTubeGetBot¶
Gets the YouTube bot account you signed in with: its name, handle, id and picture.
YouTubeUserInfo? YouTubeGetBot()
Gives back: The account, or null when no bot account is signed in.
Example
var bot = CPH.YouTubeGetBot();
CPH.LogInfo(bot != null ? $"Bot: {bot.UserName}" : "No YouTube bot");
SendYouTubeMessageToLatestMonitored¶
Sends a message in the chat of your newest YouTube stream that Cuebot watches. Uses the bot account, or the broadcaster as fallback. Empty text sends nothing.
void SendYouTubeMessageToLatestMonitored(string message, bool useBot = true, bool fallback = true)
Gives back: Nothing.
Example
CPH.SendYouTubeMessageToLatestMonitored("Thanks for watching!");
YouTubeSetTitle¶
Changes the title of your YouTube stream. Without a broadcast id it changes your newest watched stream.
bool YouTubeSetTitle(string title, string? broadcastId = null)
Gives back: true when it worked, false when it failed or the title was empty.
Example
bool ok = CPH.YouTubeSetTitle("Speedrun practice!");
CPH.LogInfo($"Title changed: {ok}");
YouTubeSetDescription¶
Changes the description of your YouTube stream. Without a broadcast id it changes your newest watched stream.
bool YouTubeSetDescription(string description, string? broadcastId = null)
Gives back: true when it worked, otherwise false.
Example
CPH.YouTubeSetDescription("Playing with viewers all night.");
YouTubeSetCategory¶
Changes the category of your YouTube stream, by name like "Gaming" or "Music", or by YouTube's category number.
bool YouTubeSetCategory(string categoryName, string? broadcastId = null)
Gives back: true when it worked, false when it failed or the name is not a YouTube category.
Example
bool ok = CPH.YouTubeSetCategory("Gaming");
CPH.LogInfo($"Category changed: {ok}");
YouTubeSetPrivacy¶
Changes who can see your YouTube stream: "public", "unlisted" or "private".
bool YouTubeSetPrivacy(string privacy, string? broadcastId = null)
Gives back: true when it worked, false when it failed or nothing was given.
Example
CPH.YouTubeSetPrivacy("unlisted");
YouTubeSetMetaData¶
Changes title, description, privacy and category of your YouTube stream in one go. Leave a value empty (null) to keep it.
bool YouTubeSetMetaData(string? title, string? description, string? privacy, string? categoryName, string? broadcastId = null)
Gives back: true when every change worked, otherwise false.
Example
bool ok = CPH.YouTubeSetMetaData("Late night chill", null, "public", "Gaming");
CPH.LogInfo($"Updated: {ok}");
YouTubeAddTags¶
Adds tags to your YouTube stream. Tags it already has are not added twice.
bool YouTubeAddTags(List<string> tags, string? broadcastId = null)
Gives back: true when it worked, otherwise false.
Example
CPH.YouTubeAddTags(new List<string> { "speedrun", "retro" });
YouTubeRemoveTags¶
Removes the listed tags from your YouTube stream.
bool YouTubeRemoveTags(List<string> tags, string? broadcastId = null)
Gives back: true when it worked, otherwise false.
Example
CPH.YouTubeRemoveTags(new List<string> { "retro" });
YouTubeClearTags¶
Removes all tags from your YouTube stream.
bool YouTubeClearTags(string? broadcastId = null)
Gives back: true when it worked, otherwise false.
Example
CPH.YouTubeClearTags();
YouTubeBanUserById¶
Bans someone from your YouTube chat by their channel id.
bool YouTubeBanUserById(string userId, string? broadcastId = null)
Gives back: true when it worked, false when it failed or the id was empty.
Example
bool ok = CPH.YouTubeBanUserById("UCabc123XYZ");
CPH.LogInfo($"Banned: {ok}");
YouTubeBanUserByName¶
Bans someone from your YouTube chat by name: a recent chatter's name or an @handle.
bool YouTubeBanUserByName(string userName, string? broadcastId = null)
Gives back: true when it worked, false when it failed or the name was empty.
Example
CPH.YouTubeBanUserByName("@SpamBot123");
YouTubeTimeoutUserById¶
Times someone out in your YouTube chat for some seconds, by their channel id.
bool YouTubeTimeoutUserById(string userId, int duration, string? broadcastId = null)
Gives back: true when it worked, false when it failed or the id was empty.
Example
CPH.YouTubeTimeoutUserById("UCabc123XYZ", 300);
YouTubeTimeoutUserByName¶
Times someone out in your YouTube chat for some seconds, by name or @handle.
bool YouTubeTimeoutUserByName(string userName, int duration, string? broadcastId = null)
Gives back: true when it worked, false when it failed or the name was empty.
Example
CPH.YouTubeTimeoutUserByName("@LoudViewer", 60);
KickBanUser¶
Bans someone from your Kick chat by name. You can add a reason. The bot setting is ignored.
bool KickBanUser(string userName, string? reason = null, bool bot = false)
Gives back: true when it worked, false when it failed or the name was empty.
Example
bool ok = CPH.KickBanUser("spambot123", "Spam links");
CPH.LogInfo($"Banned: {ok}");
KickTimeoutUser¶
Times someone out in your Kick chat for some seconds. Kick counts in minutes, so it is rounded up. The bot setting is ignored.
bool KickTimeoutUser(string username, int duration, string? reason = null, bool bot = false)
Gives back: true when it worked, false when it failed or the name was empty.
Example
CPH.KickTimeoutUser("loudviewer", 300, "Calm down");
KickUnbanUser¶
Lifts a ban or timeout on Kick, by name. The bot setting is ignored.
bool KickUnbanUser(string userName, bool bot = false)
Gives back: true when it worked, false when it failed or the name was empty.
Example
CPH.KickUnbanUser("loudviewer");
KickDeleteChatMessage¶
Deletes one message in your Kick chat, by the message's id.
bool KickDeleteChatMessage(string messageId)
Gives back: true when it worked, false when it failed or the id was empty.
Example
if (CPH.TryGetArg("msgId", out string msgId)) CPH.KickDeleteChatMessage(msgId);
KickReplyToMessage¶
Replies to a message in your Kick chat. Uses the bot account, or the broadcaster as fallback.
bool KickReplyToMessage(string message, string replyId, bool useBot = true, bool fallback = true)
Gives back: true when it worked, false when it failed or the text was empty.
Example
if (CPH.TryGetArg("msgId", out string msgId)) CPH.KickReplyToMessage("Good question!", msgId);
KickSetTitle¶
Changes the title of your Kick stream.
bool KickSetTitle(string title)
Gives back: true when it worked, false when it failed or the title was empty.
Example
CPH.KickSetTitle("Ranked grind!");
KickSetCategory¶
Changes the category of your Kick stream, by name (or id).
KickCategory? KickSetCategory(string categoryName)
Gives back: The category (only its name, and its id when you gave a number), or null when Kick refused.
Example
var category = CPH.KickSetCategory("Just Chatting");
CPH.LogInfo(category != null ? $"Now in {category.Name}" : "Kick refused");
SetKickUsersVarById¶
Sets a user variable to the same value for every Kick user id in the list. Persisted true keeps it after Cuebot restarts.
void SetKickUsersVarById(List<string> userIds, string varName, object? value, bool persisted = true)
Gives back: Nothing.
Example
CPH.SetKickUsersVarById(new List<string> { "1234", "5678" }, "team", "red");
IncrementAllTwitchUsersVar¶
Adds a number to a user variable for every Twitch user who already has it. Persisted picks saved or temporary variables.
void IncrementAllTwitchUsersVar(string varName, object? value, bool persisted = true)
Gives back: Nothing.
Example
CPH.IncrementAllTwitchUsersVar("points", 10);
IncrementAllYouTubeUsersVar¶
Adds a number to a user variable for every YouTube user who already has it. Persisted picks saved or temporary variables.
void IncrementAllYouTubeUsersVar(string varName, object? value, bool persisted = true)
Gives back: Nothing.
Example
CPH.IncrementAllYouTubeUsersVar("points", 10);
IncrementAllKickUsersVar¶
Adds a number to a user variable for every Kick user who already has it. Persisted picks saved or temporary variables.
void IncrementAllKickUsersVar(string varName, object? value, bool persisted = true)
Gives back: Nothing.
Example
CPH.IncrementAllKickUsersVar("points", 10);
IncrementTwitchUsersVarById¶
Adds a number to a user variable for each listed Twitch user id. Users who do not have the variable yet are skipped.
void IncrementTwitchUsersVarById(List<string> userIds, string varName, object? value, bool persisted = true)
Gives back: Nothing.
Example
CPH.IncrementTwitchUsersVarById(new List<string> { "12345", "67890" }, "points", 5);
IncrementYouTubeUsersVarById¶
Adds a number to a user variable for each listed YouTube user id. Users who do not have the variable yet are skipped.
void IncrementYouTubeUsersVarById(List<string> userIds, string varName, object? value, bool persisted = true)
Gives back: Nothing.
Example
CPH.IncrementYouTubeUsersVarById(new List<string> { "UCabc123XYZ" }, "points", 5);
IncrementAllKickUsersVarById¶
Adds a number to a user variable for each listed Kick user id. Users who do not have the variable yet are skipped.
void IncrementAllKickUsersVarById(List<string> userIds, string varName, object? value, bool persisted = true)
Gives back: Nothing.
Example
CPH.IncrementAllKickUsersVarById(new List<string> { "1234", "5678" }, "points", 5);
IncrementOrCreateTwitchUsersVarById¶
Adds a number to a user variable for each listed Twitch user id. Users without it get it, starting from 0.
void IncrementOrCreateTwitchUsersVarById(List<string> userIds, string varName, object? value, bool persisted = true)
Gives back: Nothing.
Example
CPH.IncrementOrCreateTwitchUsersVarById(new List<string> { "12345", "67890" }, "points", 5);
IncrementOrCreateYouTubeUsersVarById¶
Adds a number to a user variable for each listed YouTube user id. Users without it get it, starting from 0.
void IncrementOrCreateYouTubeUsersVarById(List<string> userIds, string varName, object? value, bool persisted = true)
Gives back: Nothing.
Example
CPH.IncrementOrCreateYouTubeUsersVarById(new List<string> { "UCabc123XYZ" }, "points", 5);
IncrementOrCreateKickUsersVarById¶
Adds a number to a user variable for each listed Kick user id. Users without it get it, starting from 0.
void IncrementOrCreateKickUsersVarById(List<string> userIds, string varName, object? value, bool persisted = true)
Gives back: Nothing.
Example
CPH.IncrementOrCreateKickUsersVarById(new List<string> { "1234", "5678" }, "points", 5);
MeldStudioConnect¶
Starts connecting to Meld Studio. Cuebot keeps trying in the background. Cuebot has one Meld Studio connection, so use -1 or 0.
bool MeldStudioConnect(int connectionIdx = -1)
Gives back: true when connecting started, otherwise false.
Example
CPH.MeldStudioConnect();
MeldStudioDisconnect¶
Disconnects from Meld Studio. Use -1 or 0 for the connection; other numbers only write a warning.
void MeldStudioDisconnect(int connectionIdx = -1)
Gives back: Nothing.
Example
CPH.MeldStudioDisconnect();
MeldStudioIsConnected¶
Checks whether Cuebot is connected to Meld Studio right now.
bool MeldStudioIsConnected(int connectionIdx = -1)
Gives back: true when connected, otherwise false.
Example
bool connected = CPH.MeldStudioIsConnected();
CPH.LogInfo($"Meld connected: {connected}");
MeldStudioGetConnectionByName¶
Gives the number of a Meld Studio connection. Cuebot has only one, so any name gives 0.
int MeldStudioGetConnectionByName(string name)
Gives back: 0 when Cuebot's Meld Studio part is loaded, otherwise -1.
Example
int idx = CPH.MeldStudioGetConnectionByName("Main");
CPH.LogInfo($"Meld connection: {idx}");
MeldStudioShowScene¶
Switches Meld Studio to a scene, by its Meld id. A scene name works too.
bool MeldStudioShowScene(string sceneId, int connectionIdx = -1)
Gives back: true when it worked, false when it failed or nothing was given.
Example
CPH.MeldStudioShowScene("Gameplay");
MeldStudioShowSceneByName¶
Switches Meld Studio to a scene by its name, like "Gameplay".
bool MeldStudioShowSceneByName(string sceneName, int connectionIdx = -1)
Gives back: true when it worked, false when it failed or the name was empty.
Example
bool ok = CPH.MeldStudioShowSceneByName("Gameplay");
CPH.LogInfo($"Scene switched: {ok}");
MeldStudioShowLayerByName¶
Shows a layer in Meld Studio, by the scene name and the layer name.
bool MeldStudioShowLayerByName(string sceneName, string layerName, int connectionIdx = -1)
Gives back: true when it worked, false when it failed or the layer name was empty.
Example
CPH.MeldStudioShowLayerByName("Gameplay", "Webcam");
MeldStudioHideLayerByName¶
Hides a layer in Meld Studio, by the scene name and the layer name.
bool MeldStudioHideLayerByName(string sceneName, string layerName, int connectionIdx = -1)
Gives back: true when it worked, false when it failed or the layer name was empty.
Example
CPH.MeldStudioHideLayerByName("Gameplay", "Webcam");
ObsCreateRecordChapter¶
Adds a chapter mark to your OBS recording, like "Boss fight". Needs OBS 30.2 or newer, recording as Hybrid MP4.
bool ObsCreateRecordChapter(string chapterName, int connection = 0)
Gives back: true when it worked, otherwise false.
Example
CPH.ObsCreateRecordChapter("Boss fight");
ObsIsFilterEnabled¶
Checks whether a filter is turned on in OBS. Give a scene and filter name, or a scene, source and filter name for a source's filter.
bool ObsIsFilterEnabled(string scene, string filterName, int connection = 0)
bool ObsIsFilterEnabled(string scene, string source, string filterName, int connection = 0)
Gives back: true when the filter is on, otherwise false.
Example
bool on = CPH.ObsIsFilterEnabled("Gameplay", "Webcam", "Blur");
CPH.LogInfo($"Blur on: {on}");
ObsSetFilterState¶
Sets an OBS filter: 0 turns it on, 1 turns it off, 2 flips it. Give a scene's filter, or a scene, source and filter for a source's filter.
void ObsSetFilterState(string scene, string filterName, int state, int connection = 0)
void ObsSetFilterState(string scene, string source, string filterName, int state, int connection = 0)
Gives back: Nothing.
Example
CPH.ObsSetFilterState("Gameplay", "Webcam", "Blur", 0);
ObsToggleFilter¶
Flips an OBS filter on or off. Give a scene's filter, or a scene, source and filter for a source's filter.
void ObsToggleFilter(string scene, string filterName, int connection = 0)
void ObsToggleFilter(string scene, string source, string filterName, int connection = 0)
Gives back: Nothing.
Example
CPH.ObsToggleFilter("Gameplay", "Webcam", "Blur");
ObsSetRandomFilterState¶
Picks one random filter of a scene (or of a source) and sets it: 0 on, 1 off, 2 flip. Nothing happens when there are no filters.
void ObsSetRandomFilterState(string scene, int state, int connection = 0)
void ObsSetRandomFilterState(string scene, string source, int state, int connection = 0)
Gives back: Nothing.
Example
CPH.ObsSetRandomFilterState("Gameplay", "Webcam", 0);
ObsHideSourcesFilters¶
Turns off every filter of an OBS source. The source is found by its name; the scene is not used.
void ObsHideSourcesFilters(string scene, string source, int connection = 0)
Gives back: Nothing.
Example
CPH.ObsHideSourcesFilters("Gameplay", "Webcam");
ObsHideScenesFilters¶
Turns off every filter of an OBS scene.
void ObsHideScenesFilters(string scene, int connection = 0)
Gives back: Nothing.
Example
CPH.ObsHideScenesFilters("Gameplay");
Parse¶
Fills in the variables in a text: %arguments%, ~global variables~ and inline functions. Give your own values to use instead of this run's arguments.
string Parse(string input, Dictionary<string, object?>? args = null)
Gives back: The text with every variable filled in.
Example
string text = CPH.Parse("Thanks for the raid, %user%!");
CPH.SendMessage(text);