Skip to content

Twitch, YouTube and Kick accounts and moderation

C# methods for a Run C# code step. See C# methods for how to use them.

SendWhisper

Sends a private Twitch whisper to someone. Your bot account sends it when one is signed in, otherwise your broadcaster account. Set bot to false to always use the broadcaster.

bool SendWhisper(string userName, string message, bool bot = true)

Gives back: true when Twitch took the whisper (Twitch may still drop it quietly), false when the name or message is empty or it failed.

Example

bool sent = CPH.SendWhisper("CoolViewer", "Thanks for the raid!");
CPH.LogInfo($"Whisper sent: {sent}");

TwitchAnnounce

Posts a highlighted announcement in your Twitch chat. Colours: default, blue, green, orange or purple. Your broadcaster account always sends it; bot and fallback are ignored.

void TwitchAnnounce(string message, bool bot = false, string? color = null, bool fallback = false)

Gives back: Nothing.

Example

CPH.TwitchAnnounce("Giveaway starts in 5 minutes!", false, "purple");

TwitchGetBroadcaster

Gets your own Twitch account (the broadcaster account you signed in with): its id, login and display name.

TwitchUserInfo? TwitchGetBroadcaster()

Gives back: Your account details, or null (nothing) when Twitch is not signed in.

Example

var me = CPH.TwitchGetBroadcaster();
if (me != null) CPH.LogInfo($"Signed in as {me.UserName}");

TwitchGetBot

Gets your Twitch bot account: its id, login and display name.

TwitchUserInfo? TwitchGetBot()

Gives back: The bot account details, or null (nothing) when no bot account is signed in.

Example

var bot = CPH.TwitchGetBot();
if (bot != null) CPH.LogInfo($"Bot is {bot.UserName}");

TwitchGetUserInfoByLogin

Looks up a Twitch user by their login name (an @ in front is fine). Also says whether Cuebot has seen them as a sub, mod or VIP in chat.

TwitchUserInfo? TwitchGetUserInfoByLogin(string userLogin)

Gives back: The user's details, or null (nothing) when there is no such user or Twitch did not answer.

Example

var user = CPH.TwitchGetUserInfoByLogin("CoolViewer");
if (user != null) CPH.LogInfo($"{user.UserName} has id {user.UserId}");

TwitchGetUserInfoById

Looks up a Twitch user by their user id (a number given as text). Also says whether Cuebot has seen them as a sub, mod or VIP in chat.

TwitchUserInfo? TwitchGetUserInfoById(string userId)

Gives back: The user's details, or null (nothing) when there is no such user or Twitch did not answer.

Example

var user = CPH.TwitchGetUserInfoById("123456789");
if (user != null) CPH.LogInfo($"Found {user.UserName}");

TwitchGetExtendedUserInfoByLogin

Looks up lots about a Twitch user by login: bio, profile picture, game, stream title, account age, and whether they follow or subscribe (when Cuebot has permission to see that).

TwitchUserInfoEx? TwitchGetExtendedUserInfoByLogin(string userLogin)

Gives back: The user's details, or null (nothing) when there is no such user or Twitch did not answer.

Example

var user = CPH.TwitchGetExtendedUserInfoByLogin("CoolViewer");
if (user != null) CPH.LogInfo($"{user.UserName} last played {user.Game}");

TwitchGetExtendedUserInfoById

Looks up lots about a Twitch user by user id: bio, profile picture, game, stream title, account age, and whether they follow or subscribe (when Cuebot may see that).

TwitchUserInfoEx? TwitchGetExtendedUserInfoById(string userId)

Gives back: The user's details, or null (nothing) when there is no such user or Twitch did not answer.

Example

var user = CPH.TwitchGetExtendedUserInfoById("123456789");
if (user != null) CPH.LogInfo($"Follows you: {user.IsFollowing}");

TwitchTimeoutUser

Times a Twitch user out of chat for a number of seconds, with an optional reason. Your broadcaster account does it; useBot is ignored.

bool TwitchTimeoutUser(string userName, int duration, string? reason = null, bool useBot = false)

Gives back: true when it worked, false when Twitch refused or the name is empty (a warning goes in the log).

Example

bool done = CPH.TwitchTimeoutUser("SpamBot123", 600, "Spamming links");
CPH.LogInfo($"Timed out: {done}");

TwitchBanUser

Bans a Twitch user from your chat, with an optional reason. Your broadcaster account does it; useBot is ignored.

bool TwitchBanUser(string userName, string? reason = null, bool useBot = false)

Gives back: true when it worked, false when Twitch refused or the name is empty (a warning goes in the log).

Example

bool done = CPH.TwitchBanUser("SpamBot123", "Bot account");
CPH.LogInfo($"Banned: {done}");

TwitchUnbanUser

Lets a banned or timed-out Twitch user chat again. Your broadcaster account does it; useBot is ignored.

bool TwitchUnbanUser(string userName, bool useBot = false)

Gives back: true when it worked, false when Twitch refused or the name is empty.

Example

bool done = CPH.TwitchUnbanUser("CoolViewer");
CPH.LogInfo($"Unbanned: {done}");

TwitchRunCommercial

Runs an ad break on your Twitch channel. The length is in seconds, from 30 to 180; other numbers are moved into that range.

bool TwitchRunCommercial(int length)

Gives back: true when the ad started, false when Twitch refused.

Example

bool started = CPH.TwitchRunCommercial(90);
CPH.LogInfo($"Ad started: {started}");

CreateStreamMarker

Puts a marker at this moment of your Twitch stream, with a short note, so you can find it later when making highlights. Only works while you are live.

StreamMarker? CreateStreamMarker(string description)

Gives back: The marker (its id, note and how many seconds into the stream it is), or null (nothing) when Twitch refused.

Example

var marker = CPH.CreateStreamMarker("Epic boss fight");
if (marker != null) CPH.LogInfo($"Marker at {marker.Position} seconds");

CreateClip

Makes a Twitch clip of your live stream. Twitch picks the clip's length and title; a title you give is only copied into the result, and the duration is ignored.

ClipData? CreateClip()
ClipData? CreateClip(string? title, int duration)

Gives back: The clip (with its link and edit link), or null (nothing) when Twitch refused, for example while you are offline.

Example

var clip = CPH.CreateClip();
if (clip != null) CPH.SendMessage($"Clip: {clip.Url}");

SetChannelTitle

Changes the title of your Twitch stream.

bool SetChannelTitle(string title)

Gives back: true when it worked, false when the title is empty or Twitch refused.

Example

bool done = CPH.SetChannelTitle("Speedrun practice! !discord");
CPH.LogInfo($"Title changed: {done}");

SetChannelGame

Changes the category (game) of your Twitch stream, found by its name, like "Just Chatting".

GameInfo? SetChannelGame(string game)

Gives back: The category it picked (its name and id), or null (nothing) when the name is empty or no category matches.

Example

var game = CPH.SetChannelGame("Minecraft");
if (game != null) CPH.LogInfo($"Category is now {game.Name}");

YouTubeGetLatestMonitoredBroadcast

Gets the newest YouTube broadcast (live stream) Cuebot is watching: its title, link, status and chat id.

YouTubeBroadcastInfo? YouTubeGetLatestMonitoredBroadcast()

Gives back: The broadcast, or null (nothing) when Cuebot is not watching any.

Example

var stream = CPH.YouTubeGetLatestMonitoredBroadcast();
if (stream != null) CPH.LogInfo($"Live on YouTube: {stream.Title}");

YouTubeGetLatestBroadcast

Gets the newest YouTube broadcast Cuebot is watching. Works the same as YouTubeGetLatestMonitoredBroadcast.

YouTubeBroadcastInfo? YouTubeGetLatestBroadcast()

Gives back: The broadcast, or null (nothing) when Cuebot is not watching any.

Example

var stream = CPH.YouTubeGetLatestBroadcast();
if (stream != null) CPH.LogInfo(stream.Url);

YouTubeGetMonitoredBroadcasts

Lists every YouTube broadcast (live stream) Cuebot is watching right now.

List<YouTubeBroadcastInfo> YouTubeGetMonitoredBroadcasts()

Gives back: A list of broadcasts, or an empty list when there are none.

Example

var streams = CPH.YouTubeGetMonitoredBroadcasts();
CPH.LogInfo($"Watching {streams.Count} YouTube broadcast(s)");

KickGetBroadcaster

Gets your own Kick account (the broadcaster you signed in with): its name, login, id and channel name in the web link (slug).

KickUserInfo? KickGetBroadcaster()

Gives back: Your account details, or null (nothing) when Kick is not signed in.

Example

var me = CPH.KickGetBroadcaster();
if (me != null) CPH.LogInfo($"Kick channel: {me.ChannelSlug}");

KickGetBot

Gets your Kick bot account: its name and id.

KickUserInfo? KickGetBot()

Gives back: The bot account details, or null (nothing) when no bot account is signed in.

Example

var bot = CPH.KickGetBot();
if (bot != null) CPH.LogInfo($"Kick bot: {bot.UserName}");