diff --git a/streamerbot/3.api/4.servers/1.websocket/0.requests.md b/streamerbot/3.api/4.servers/1.websocket/0.requests.md index 2491a8ec..702f7ca7 100644 --- a/streamerbot/3.api/4.servers/1.websocket/0.requests.md +++ b/streamerbot/3.api/4.servers/1.websocket/0.requests.md @@ -368,7 +368,8 @@ Fetch a list of all actions in the connected Streamer.bot instance. "group": "None", "id": "a0ff6f91-a51e-4b7d-948b-5e03ff4a82f0", "name": "Action Number One", - "subaction_count": 4 + "subaction_count": 4, + "trigger_count": 1 }, ], "status": "ok", @@ -399,6 +400,15 @@ Execute an action on the connected Streamer.bot instance. "id": "" } ``` + ```json [↗️ Request] + { + "request": "DoAction", + "action": { + "id": "47da7c2c-1b7e-4ee7-9bbf-306bf18ff1b8" + }, + "id": "sb:client:req:1753223220663-2906868922" + } + ``` ```json [↙️ Response] { "status": "ok", @@ -410,6 +420,33 @@ Execute an action on the connected Streamer.bot instance. const response = await client.doAction('47da7c2c-1b7e-4ee7-9bbf-306bf18ff1b8'); ``` :: +::code-group + ```json [↗️ Request] + { + "request": "DoAction", + "id": "sb:client:req:1753224740175-3103164791" + "action": { + "name": "example action" + }, + "args": { + "stringArg": "abcdef", + "numArg": 1234 + }, + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "" + } + ``` + ```ts [example.js] + // Using @streamerbot/client + const response = await client.doAction(action = {name: "example action"}, + args = {"stringArg" : "abcdef", + "numArg" : 1234})); + ``` +:: ### `GetBroadcaster` Fetch information about the connected broadcaster account(s) @@ -430,18 +467,30 @@ Fetch information about the connected broadcaster account(s) "broadcastUserId": 695682330, "broadcasterIsAffiliate": false, "broadcasterIsPartner": false + "botUser": "MyBot", + "botUserName": "mybot", + "botUserId": "682553973" }, "youtube": { "broadcastUserName": "Ik1497 Tutorials", "broadcastUserId": "UCl3oatIf9tYopHaZHvnH3xw", "broadcastUserProfileImage": "https://yt3.ggpht.com/VpC8_9WcDEKcPSvnD6p1iGT_S2_XxdeZtL6tTL2axexj0SpG-c4Wx8i5lYNbJtvmzwCnzm9Bsg=s88-c-k-c0x00ffffff-no-rj" + }, + "kick": { + "broadcasterLogin": "ik1497kicker", + "broadcasterUserName": "IK1497Kicker", + "broadcasterUserId": "5081399", + "broadcasterProfileUrl": "https://files.kick.com/images/user/5081399/profile_image/conversion/cf435acc-5bef-4ef9-938d-4f9c0582af19-fullsize.webp" } }, "connected": [ "twitch", - "youtube" + "youtube", + "kick" + ], + "disconnected": [ + "trovo" ], - "disconnected": [], "status": "ok", "id": "" } @@ -556,7 +605,11 @@ Fetch information about the connected Streamer.bot instance. "instanceId": "jx5gd80u-3b04-4c9b-x902-4589nn5010ax", "name": "‍Streamer.bot", "version": "0.1.15", - "os": "windows" + "os": "windows", + "osVersion": "6.2.9200.0", + "mode": "ui", + "darkMode": false, + "source": "websocketServer" }, "status": "ok", "id": "123" @@ -615,4 +668,582 @@ Fetch a list of all active viewers for connected `Twitch` or `YouTube` accounts. const response = await client.getActiveViewers(); console.log('Streamer.bot Active Viewers', response.viewers); ``` -:: \ No newline at end of file +:: + +### `GetCodeTriggers` +Returns the list of (code triggers)[/api/csharp/core/triggers#RegisterCustomTrigger] available to be invoked by (ExecuteCodeTrigger)[#executecodetrigger]. + +::code-group + ```json [Schema] + { + "request": "GetCodeTriggers", + "id": "" + } + ``` + ```json [↗️ Request] + { + "request": "GetCodeTriggers", + "id": "my-subscribe-id", + "triggerName": "poll_vote_removed", + "args": { + "stringArg": "abcdef", + "numArg": 1234 + } + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id", + "count": 1, + "triggers": [ + { + "name": "Channel Created", + "eventName": "channel_created", + "category": "Custom/Discord Server/Channels" + } + ] + } + ``` + ```ts [example.js] + // Using @streamerbot/client + const response = await client.getCodeTriggers(); + ``` +:: + +### `ExecuteCodeTrigger` +Triggers a (code trigger)[/api/csharp/core/triggers#RegisterCustomTrigger], causing any associated actions to be executed. + +::code-group + ```json [Schema] + { + "request": "ExecuteCodeTrigger", + "id": "", + "triggerName": "", + "args": { + "key": "value", + } + } + ``` + ```json [↗️ Request] + { + "request": "ExecuteCodeTrigger", + "id": "my-subscribe-id", + "args": { + "stringArg": "abcdef", + "numArg": 1234 + } + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id" + } + ``` + ```ts [example.js] + // Using @streamerbot/client + client.executeCodeTrigger(triggerName = "poll_vote_removed", + args = {"stringArg" : "abcdef", + "numArg" : 1234}); + ``` +:: + +### `GetCommands` +Returns the list of defined commands. + +::code-group + ```json [Schema] + { + "request": "GetCommands", + "id": "" + } + ``` + ```json [↗️ Request] + { + "request": "GetCommands", + "id": "my-subscribe-id" + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id", + "commands": [ + { + "id": "81bc8200-256d-4e1e-9e41-5010c3b808de", + "enabled": false, + "name": "My Game", + "group": "playing with viewers", + "commands": [ + "!addplayer", + "!nextplayer", + "!randomplayer" + ], + "caseSensitive": false, + "ignoreInternal": true, + "ignoreBotAccount": true, + "sources": 1 + }, + { + "id": "ac0dfb07-b5e2-4e97-8528-ca27dd67f47c", + "enabled": true, + "name": "CheckFiveMPlayers", + "group": null, + "commands": [ + "!server" + ], + "caseSensitive": false, + "ignoreInternal": true, + "ignoreBotAccount": true, + "sources": 1 + } + ], + "count": 2 + } + ``` + ```ts [example.js] + // Using @streamerbot/client + const response = await client.getCommands(); + ``` +:: + +### `TwitchGetEmotes` +Fetch a list of emotes for the selected platform + +::code-group + ```json [Schema] + { + "request": "TwitchGetEmotes", + "id": "" + } + ``` + ```json [↗️ Request] + { + "request": "TwitchGetEmotes", + "id": "my-subscribe-id", + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id", + "emotes": { + "userEmotes": [ + { + "name": "CurseLit", + "type": "twitch_globals", + "imageUrl": "https://static-cdn.jtvnw.net/emoticons/v2/116625/default/dark/3.0" + }, + { + "name": "demons176Pumpkin", + "type": "twitch_subscriptions", + "imageUrl": "https://static-cdn.jtvnw.net/emoticons/v2/emotesv2_6d5daa168c274d4fbf8ae46216e3730a/default/dark/3.0" + }, + { + "name": "CurseLit", + "type": "twitch_globals", + "imageUrl": "https://static-cdn.jtvnw.net/emoticons/v2/116625/default/dark/3.0" + } + ], + "bttvEmotes": [ + { + "name": "AngelThump", + "imageUrl": "https://cdn.betterttv.net/emote/566ca1a365dbbdab32ec055b/3x", + "type": "BTTVGlobal", + "zeroWidth": false + } + ], + "ffzEmotes": [ + { + "name": "CatBag", + "imageUrl": "https://cdn.frankerfacez.com/emote/25927/4", + "type": "FFZGlobal", + "zeroWidth": false + } + ], + "sevenTvEmotes": [ + { + "name": "reckH", + "imageUrl": "https://cdn.7tv.app/emote/01F014S6KG0007E4VV006YKSM3/4x.png", + "type": "7TVGlobal", + "zeroWidth": false + } + ] + } + } + ``` + ```ts [example.js] + // Using @streamerbot/client + const response = await client.getEmotes("twitch"); + ``` +:: + +### `YouTubeGetEmotes` +Fetch a list of emotes for the selected platform + +::code-group + ```json [Schema] + { + "request": "YouTubeGetEmotes", + "id": "" + } + ``` + ```json [↗️ Request] + { + "request": "YouTubeGetEmotes", + "id": "my-subscribe-id", + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id", + "emotes": { + "userEmotes": [ + { + "name": ":hand-pink-waving:", + "type": "youtube", + "imageUrl": "https://yt3.ggpht.com/KOxdr_z3A5h1Gb7kqnxqOCnbZrBmxI2B_tRQ453BhTWUhYAlpg5ZP8IKEBkcvRoY8grY91Q=w24-h24-c-k-nd" + } + ], + "bttvEmotes": [ + { + "name": "AngelThump", + "imageUrl": "https://cdn.betterttv.net/emote/566ca1a365dbbdab32ec055b/3x", + "type": "BTTVGlobal", + "zeroWidth": false + } + ], + "sevenTvEmotes": [ + { + "name": "reckH", + "imageUrl": "https://cdn.7tv.app/emote/01F014S6KG0007E4VV006YKSM3/4x.png", + "type": "7TVGlobal", + "zeroWidth": false + } + ] + "ffzEmotes": [ + { + "name": "CatBag", + "imageUrl": "https://cdn.frankerfacez.com/emote/25927/4", + "type": "FFZGlobal", + "zeroWidth": false + } + ] + } + } + ``` + ```ts [example.js] + // Using @streamerbot/client + const response = await client.getEmotes("youtube"); + ``` +:: + +### `GetGlobals` +Returns all the global variables, either persisted or temporary. + +::code-group + ```json [Schema] + { + "request": "GetGlobals", + "id": "", + "persisted": + } + ``` + ```json [↗️ Request] + { + "request": "GetGlobal", + "id": "my-subscribe-id", + "persisted": true + } + ``` + ```json [↙️ Response] + { + "status": "ok" + "id": "my-subscribe-id", + "variables": [ + "aGlobal": { + "name": "aGlobal", + "value": "4", + "lastWrite": "2025-07-22T11:32:17.935-07:00" + }, + "alertInterval": { + "name": "alertInterval", + "value": 3, + "lastWrite": "2025-06-29T22:03:21.734-07:00" + } + ], + "count": 2 + } + ``` + ```ts [example.js] + // Using @streamerbot/client + const response = await client.getGlobals(); + console.log(`aGlobal is ${response.variables["aGlobal"].value}`); // ==> 4 + ``` +:: + +### `GetGlobal` +Gets a single persisted or temporary global variable. Returns an error if the variable doesn't exist. + +::code-group + ```json [Schema] + { + "request": "GetGlobal", + "id": "", + "variable": "", + "persisted": , + } + ``` + ```json [↗️ Request] + { + "request": "GetGlobal", + "id": "my-subscribe-id", + "variable": "aGlobal", + "persisted": true + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id", + "variable": { + "name": "aGlobal", + "value": "4", + "lastWrite": "2025-07-22T11:32:17.935-07:00" + } + } + ``` + ```ts [example.js] + // Using @streamerbot/client + const response = await client.getGlobal(name = "aGlobal", + persisted= true); + console.log(`aGlobal is ${response.variable.value}`); // ==> 4 + ``` +:: + +### `TwitchGetUserGlobals` +Fetches the values of a given user variable across all Twitch users. + +::code-group + ```json [Schema] + { + "request": "TwitchGetUserGlobals", + "id": "", + "variable": "", + "persisted": , + } + ``` + ```json [↗️ Request] + { + "request": "TwitchGetUserGlobals", + "id": "my-subscribe-id", + "variable": "tuna", + "persisted": true, + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id", + "variables": [ + { + "name": "tuna", + "userId": "136079477", + "userLogin": "whazzittoya", + "userName": "WhazzItToYa", + "platform": "twitch", + "value": 3, + "lastWrite": "2025-07-15T19:46:40.971-07:00" + }, + { + "name": "tuna", + "userId": "39547242", + "userLogin": "nervousbeard", + "userName": "NERVOUSBEARD", + "platform": "twitch", + "value": "a second fish", + "lastWrite": "2025-07-22T17:17:34.053-07:00" + } + ], + "count": 2 + } + ``` + ```ts [example.js] + // Using @streamerbot/client + const response = await client.getUserGlobals('twitch', 'tuna'); + ``` +:: + +### `TwitchGetUserGlobal` +Gets either a single user variable for a given user, or all variables for that users. + +::code-group + ```json [Schema] + { + "request": "TwitchGetUserGlobal", + "id": "", + "userId": "", + "persisted": , + } + ``` + ```json [↗️ Request] + { + "request": "TwitchGetUserGlobal", + "id": "my-subscribe-id", + "userId": "136079477", + "persisted": true + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id", + "variables": [ + { + "name": "tuna", + "value": 3, + "lastWrite": "2025-07-15T19:46:40.971-07:00" + }, + { + "name": "addedTime", + "value": 1752206450, + "lastWrite": "2025-07-10T21:00:50.553-07:00" + } + ], + "count": 2, + } + ``` + ```ts [example.js] + // Using @streamerbot/client + const response = await client.getUserGlobal(platform = "twitch", + userId = "136079477"); + ``` +:: + +::code-group + ```json [↗️ Request] + { + "request": "TwitchGetUserGlobal", + "id": "my-subscribe-id", + "userId": "136079477", + "variable": "tuna", + "persisted": true + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id", + "variable": { + "name": "tuna", + "value": 3, + "lastWrite": "2025-07-15T19:46:40.971-07:00" + } + } + ``` + ```ts [example.js] + // Using @streamerbot/client + const response = await client.getUserGlobal(platform = "twitch", + userId = "136079477", + name = "tuna"); + ``` +:: + +### `SendMessage` +Sends a message to the broadcaster's chat. + +::warning +The websocket must be authenticated with a password. +:: + +::code-group + ```json [Schema] + { + "request": "SendMessage", + "id": "", + "platform": "twitch | kick | trovo | youtube", + "bot": , + "internal": , + "message": "" + } + ``` + ```json [↗️ Request] + { + "request": "SendMessage", + "id": "my-subscribe-id", + "bot": true, + "internal": false, + "message": "This is a test" + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id" + } + ``` + ```ts [example.js] + // Using @streamerbot/client + client.sendMessage(platform = "twitch", + message = "This is a test", + options = { bot: true, + internal: false }); + ``` +:: + +### `GetUserPronouns` +Fetches the pronouns for a given user. + +::code-group + ```json [Schema] + { + "request": "GetUserPronouns", + "id": "", + "platform": "twitch", + "userLogin": "" + } + ``` + ```json [↗️ Request] + { + "request": "GetUserPronouns", + "id": "my-subscribe-id", + "platform": "twitch" + "userLogin": "justsomeguyyouknow", + } + ``` + ```json [↙️ Response] + { + "status": "ok", + "id": "my-subscribe-id", + "userLogin": "justsomeguyyouknow", + "pronoun": { + "pronounSubject": "He", + "pronounObject": "Him", + "pronounPossessive": "His", + "pronounPronoun": "His", + "pronounReflexive": "Himself", + "pronounPastTense": "Was", + "pronounSubjectLower": "he", + "pronounObjectLower": "him", + "pronounPossessiveLower": "his", + "pronounPronounLower": "his", + "pronounReflexiveLower": "himself", + "pronounPastTenseLower": "was", + "pronounCurrentTense": "Is", + "pronounCurrentTenseLower": "is", + "pronounPluralLower": "s", + "pronouns": "(He/Him)", + "pronounLastCached": "2025-07-22T15:23:02.529-07:00", + "userFound": true, + "pronounsPlain": "He/Him" + } + } + ``` + ```ts [example.js] + // Using @streamerbot/client + client.getUserPronouns(platform = "twitch", + userLogin = "justsomeguyyouknow")); + ``` +::