### JavaScript Example: Get Credits Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example using the @streamerbot/client library to fetch credits data and log it to the console. ```javascript // Using @streamerbot/client const response = await client.getCredits(); console.log('Streamer.bot Credits', response.credits); ``` -------------------------------- ### GetActions HTTP Request Examples Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/5.http/1.requests/get-actions.md Demonstrates how to make a GET request to the /GetActions endpoint using different tools. No parameters are required for this request. ```bash curl -X GET http://127.0.0.1:7474/GetActions ``` ```js const response = await fetch('http://127.0.0.1:7474/GetActions'); const data = await response.json(); console.log(data); ``` ```py import requests response = requests.get('http://127.0.0.1:7474/GetActions') data = response.json() print(data) ``` -------------------------------- ### Example Request using Python Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/5.http/1.requests/test-credits.md Send a GET request to the /TestCredits endpoint and print the JSON response using the requests library in Python. ```python import requests response = requests.get('http://127.0.0.1:7474/TestCredits') data = response.json() print(data) ``` -------------------------------- ### Fetch URL Sub-Action Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/1.sub-actions/core/network/fetch-url.md This example demonstrates how to use the Fetch URL sub-action to retrieve data from a URL. Only GET requests are supported. For other methods like POST, C# sub-actions are required. ```Streamer.bot fetchUrl("https://catfact.ninja/fact", "jsonResult", true) ``` -------------------------------- ### Install Winetricks and Dependencies (Ubuntu) Source: https://github.com/streamerbot/docs/blob/main/streamerbot/1.get-started/installation/linux/index.md Installs winetricks, git, and curl on Ubuntu systems. Follow the WineHQ Ubuntu wiki for Wine installation. ```bash sudo apt install winetricks sudo winetricks --self-update ``` ```bash sudo apt install git curl ``` -------------------------------- ### Install Streamer.bot Client Package Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/0.guide/1.client.md Install the client package using your preferred package manager. ```bash pnpm install @streamerbot/client ``` ```bash npm install @streamerbot/client ``` ```bash yarn add @streamerbot/client ``` -------------------------------- ### Example Request using cURL Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/5.http/1.requests/test-credits.md Make a GET request to the /TestCredits endpoint using cURL. ```bash curl -X GET http://127.0.0.1:7474/TestCredits ``` -------------------------------- ### Start Custom WebSocket Server Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/3.methods/core/websocket/websocket-custom-server-start.md Use this method to start a custom WebSocket server. The index corresponds to the position of the server in the clients list, starting from 0. ```csharp using System; public class CPHInline { public bool Execute() { //Start the custom websocket server with index 0 //Index is from top to bottom of the clients list, starting at 0 CPH.WebsocketCustomServerStart(0); return true; } } ``` -------------------------------- ### Clone and Run Install Script Source: https://github.com/streamerbot/docs/blob/main/streamerbot/1.get-started/installation/linux/index.md Clones the Streamer.bot Linux installer repository and executes the installation script. ```bash # Clone the repository git clone https://github.com/Streamerbot/sb-linux-installer # Change directory cd ./sb-linux-installer # Execute the installer ./install.sh ``` -------------------------------- ### Install Wine, Winetricks, and Dependencies (Arch) Source: https://github.com/streamerbot/docs/blob/main/streamerbot/1.get-started/installation/linux/index.md Installs Wine, winetricks, git, and curl on Arch Linux systems. ```bash # Install wine sudo pacman -S wine # Install winetricks sudo pacman -S winetricks # Install remaining dependencies sudo pacman -S git curl ``` -------------------------------- ### Example User Folder Structure for Walk-on Media (C#) Source: https://github.com/streamerbot/docs/blob/main/streamerbot/4.examples/starter-pack.md Example of how to structure folders for specific users within the root path. Create a folder with the user's display name and add 'sound.mp3' and 'message.txt'. ```cs C:\users\\Desktop\WalkOnSoundsAndMessages\ConfuzzedCat ``` -------------------------------- ### Start Streaming Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/1.sub-actions/obs-studio/streaming.md Starts the OBS Studio stream. ```APIDOC ## Start Streaming ### Description Starts the OBS Studio stream. ### Method `ObsStartStreaming` ### Parameters This action does not require any parameters. ``` -------------------------------- ### Example Root Path for Walk-on Media (C#) Source: https://github.com/streamerbot/docs/blob/main/streamerbot/4.examples/starter-pack.md Example file system path for storing walk-on sounds and messages. The system looks for a subfolder named after the Twitch user. ```cs C:\users\\Desktop\WalkOnSoundsAndMessages ``` -------------------------------- ### Start Replay Buffer Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/1.sub-actions/obs-studio/replay/set-replay-buffer-state.md Starts the OBS Studio replay buffer. ```APIDOC ## ObsReplayBufferStart ### Description Starts the replay buffer recording. ### Method ObsReplayBufferStart ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` ObsReplayBufferStart() ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### JavaScript Example: Get Broadcaster Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example using the @streamerbot/client library to fetch broadcaster information and log the platform details. ```javascript // Using @streamerbot/client const response = await client.getBroadcaster(); console.log('Streamer.bot Broadcasters', response.platforms); ``` -------------------------------- ### RunAction C# Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/3.methods/core/actions/run-action.md Demonstrates how to use the CPH.RunAction method to execute another action by name. Includes examples for running inline (default) and in a separate queue. ```csharp using System; public class CPHInline { public bool Execute() { // Specify name of action you want to run string actionName = "Streamer.bot Docs Action"; // Run Action (in current queue) CPH.RunAction(actionName); CPH.RunAction(actionName, true); // Run Action in it's own queue CPH.RunAction(actionName, false); return true; } } ``` -------------------------------- ### WebsocketCustomServerStart Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/3.methods/core/websocket/websocket-custom-server-start.md Starts a custom WebSocket server. The index corresponds to the position of the client in the list, starting from 0. ```APIDOC ## WebsocketCustomServerStart ### Description Starts a custom WebSocket server. The index corresponds to the position of the client in the list, starting from 0. ### Method ```csharp CPH.WebsocketCustomServerStart(int connection) ``` ### Parameters #### Path Parameters - **connection** (int) - Required - The index of the WebSocket connection to start. ### Request Example ```csharp using System; public class CPHInline { public bool Execute() { // Start the custom websocket server with index 0 // Index is from top to bottom of the clients list, starting at 0 CPH.WebsocketCustomServerStart(0); return true; } } ``` ``` -------------------------------- ### Start Recording Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/1.sub-actions/obs-studio/recording.md Initiates the recording process in OBS Studio. ```APIDOC ## Start Recording ### Description Starts the recording in OBS Studio. ### Method `ObsStartRecording` ``` -------------------------------- ### TwitchGetUserGlobal Client-Side Example (All Variables) Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example of using the @streamerbot/client to fetch all variables for a specific user. ```javascript // Using @streamerbot/client const response = await client.getUserGlobal(platform = "twitch", userId = "136079477"); ``` -------------------------------- ### TwitchGetUserGlobals Client-Side Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example of how to use the @streamerbot/client to fetch global user variables. ```javascript // Using @streamerbot/client const response = await client.getUserGlobals('twitch', 'tuna'); ``` -------------------------------- ### JavaScript Example: Test Credits Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example using the @streamerbot/client library to trigger the test credits function and log the response. ```javascript // Using @streamerbot/client const response = await client.testCredits(); console.log('Streamer.bot Test Credits', response.credits); ``` -------------------------------- ### JavaScript Example: Execute Action Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example using the @streamerbot/client library to execute an action by ID or by name with arguments. ```javascript // Using @streamerbot/client const response = await client.doAction('47da7c2c-1b7e-4ee7-9bbf-306bf18ff1b8'); ``` ```javascript // Using @streamerbot/client const response = await client.doAction(action = {name: "example action"}, args = {"stringArg" : "abcdef", "numArg" : 1234})); ``` -------------------------------- ### C# Generic MIDI Event Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/1.sub-actions/core/midi/generic-event.md Demonstrates how to send a generic MIDI event using C# in Streamer.bot. This example shows setting various parameters for a MIDI message. ```csharp // Example usage: // var result = await Actions.InvokeAction("Send Generic MIDI Event", new object[] { // "My MIDI Event", // Name // "My MIDI Device", // Device // "NoteOn", // Command // 1, // Channel // 60, // Data1 // 100, // Data2 // false // Ignore NoteOff // }); ``` -------------------------------- ### Start Recording Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/1.sub-actions/streamlabs-desktop/recording.md Initiates the recording process in Streamlabs Desktop. ```APIDOC ## Start Recording ### Description Starts the recording in Streamlabs Desktop. ### Method Streamlabs Desktop Action ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "State": "Start" } ``` ### Response #### Success Response (200) Recording started successfully. #### Response Example ```json { "Success": true } ``` ``` -------------------------------- ### Start Streaming Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/1.sub-actions/streamlabs-desktop/streaming.md Initiates the streaming process in Streamlabs Desktop. ```APIDOC ## Start Streaming ### Description Starts the streaming process in Streamlabs Desktop. ### Method Streamlabs Desktop Action ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` SlobsStartStreaming() ``` ### Response #### Success Response (200) Streaming started successfully. #### Response Example None specified ``` -------------------------------- ### Custom Overlay Module Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/2.guide/04.extra-features/3.html-overlay.md Example of a custom JavaScript overlay module that subscribes to Twitch Channel Point Rewards and displays an image. Requires the Streamer.bot client to be available at window.client. ```javascript const CONFIG = { rewardTitle: 'Show Image', imageUrl: 'https://streamer.bot/logo.png', seconds: 5, width: 'auto', height: 'auto', }; // Here we are subscribing to Twitch Channel Point Rewards // and triggering our overlay when the configured title matches a redemption window.client.on('Twitch.RewardRedemption', (message) => { if ((message.data.reward.title || message.data.title) === config.rewardTitle) { showImage(); } }); ``` -------------------------------- ### SendAction C# Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/3.methods/core/actions/send-action.md This example demonstrates how to send a Streamer.bot Action using the C# scripting interface. It shows how to set the action name and use the boolean parameters to specify the bot account and fallback behavior. ```csharp using System; public class CPHInline { public bool Execute() { //Set Action name here string action = "Test Action Name"; //Send reply with bot account CPH.SendAction(action, true, true); return true; } } ``` -------------------------------- ### Basic HTTPClient Setup Source: https://github.com/streamerbot/docs/blob/main/streamerbot/4.examples/http-post.md Sets up a reusable HttpClient instance with a configurable timeout. It's recommended to initialize this once and dispose of it properly to manage resources effectively. ```cs using System; using System.Text; using System.Threading.Tasks; using System.Net.Http; using System.Net.Http.Headers; using Newtonsoft.Json; using Newtonsoft.Json.Linq; public class CPHInline { // You can set the timeout to any length you need private static readonly HttpClient _httpClient = new HttpClient{Timeout = TimeSpan.FromSeconds(30)}; public void Init() { // Ensure we are working with a clean slate _httpClient.DefaultRequestHeaders.Clear(); } public void Dispose() { // Free up allocations _httpClient.Dispose(); } public bool Execute() { // ... return true; } } ``` -------------------------------- ### C# Parameter Import Source: https://github.com/streamerbot/docs/blob/main/README.md Markdown frontmatter demonstrating how to import parameter documentation from a shared file. ```markdown --- parameters: - import: SomeSharedParameter --- ``` -------------------------------- ### Get All Globals with @streamerbot/client Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example of how to use the @streamerbot/client library to retrieve all global variables. ```typescript // Using @streamerbot/client const response = await client.getGlobals(); console.log(`aGlobal is ${response.variables["aGlobal"].value}`); // ==> 4 ``` -------------------------------- ### Get YouTube Emotes with @streamerbot/client Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example of how to use the @streamerbot/client library to fetch YouTube emotes. ```typescript // Using @streamerbot/client const response = await client.getEmotes("youtube"); ``` -------------------------------- ### Get Twitch Emotes with @streamerbot/client Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example of how to use the @streamerbot/client library to fetch Twitch emotes. ```typescript // Using @streamerbot/client const response = await client.getEmotes("twitch"); ``` -------------------------------- ### Init Method Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/0.guide/2.lifecycle-methods.md Implement the Init method to perform initialization tasks, such as setting up class-level variables or objects used in the Execute method. ```csharp using System; public class CPHInline { public bool Execute() { // your main code goes here return true; } public void Init() { // place your init code here } } ``` -------------------------------- ### Get Single Global with @streamerbot/client Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example of how to use the @streamerbot/client library to retrieve a single global variable. ```typescript // Using @streamerbot/client const response = await client.getGlobal(name = "aGlobal", persisted= true); console.log(`aGlobal is ${response.variable.value}`); // ==> 4 ``` -------------------------------- ### Get Timer State C# Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/3.methods/core/timers/get-timer-state.md Use this method to check if a timer is currently enabled. Provide the timer's unique ID to get its state. The method returns a boolean indicating whether the timer is enabled. ```csharp using System; public class CPHInline { public bool Execute() { //Define timer id you want to get the state of string timerId = "4fcc2d13-9bcf-4c18-9d91-821a15f4b6e5"; //Methods return boolean indicating if timer enabled or not bool state = CPH.GetTimerState(timerId); return true; } } ``` -------------------------------- ### Get Random Integer Between Min and Max Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/3.methods/core/misc/between.md Use this method to obtain a random integer within a specified range. The result is inclusive of both the minimum and maximum values. This example demonstrates getting a random integer between 1 and 100 and storing it in an argument. ```csharp using System; public class CPHInline { public bool Execute() { //Get an int value between 1 and 100 int randomInt = CPH.Between(1,100); //Set the argument called randomNum to the value of randomInt CPH.SetArgument("randomNum",randomInt); return true; } } ``` -------------------------------- ### HTTP Server - DoAction Source: https://context7.com/streamerbot/docs/llms.txt Executes actions on Streamer.bot via HTTP GET requests. Actions can be identified by name or GUID, and custom arguments can be passed as query parameters. ```APIDOC ## HTTP Server - DoAction ### Description Allows executing Streamer.bot actions remotely using HTTP GET requests. You can specify actions by their name or unique identifier (GUID) and pass custom arguments directly in the URL. ### Method GET ### Endpoint `http://127.0.0.1:7474/DoAction` ### Query Parameters - **name** (string) - Optional - The name of the action to execute. - **id** (string) - Optional - The GUID of the action to execute. - **[custom_argument]** (string) - Optional - Any custom argument required by the action. ### Example Usage ``` // Execute action by name GET http://127.0.0.1:7474/DoAction?name= // Execute action by GUID GET http://127.0.0.1:7474/DoAction?id= // Execute action with custom arguments GET http://127.0.0.1:7474/DoAction?name=Shoutout&userName=ik1497 ``` ``` -------------------------------- ### Example Request using JavaScript Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/5.http/1.requests/test-credits.md Fetch and log the JSON response from the /TestCredits endpoint using JavaScript's fetch API. ```javascript const response = await fetch('http://127.0.0.1:7474/TestCredits'); const data = await response.json(); console.log(data); ``` -------------------------------- ### HTTP Server DoAction Source: https://context7.com/streamerbot/docs/llms.txt Execute actions via the HTTP server using GET requests. Actions can be identified by name or GUID, and custom arguments can be passed as query parameters. ```http GET http://127.0.0.1:7474/DoAction?name= ``` ```http GET http://127.0.0.1:7474/DoAction?id= ``` ```http GET http://127.0.0.1:7474/DoAction?name=Shoutout&userName=ik1497 ``` -------------------------------- ### Get Twitch User Variable by Name and Persistence Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/3.methods/twitch/globals/get-twitch-users-var.md Retrieves a list of UserVariableValue objects for a specified global variable name. The 'persisted' parameter determines if only persisted variables are fetched. This example demonstrates iterating through the results and logging user-specific details and the variable's value. ```csharp using System; using System.Collections.Generic; //Needed cause of List<> usage public class CPHInline { public bool Execute() { //Get the user var list which is a List of type UserVariableValue with a specific type List> userVarList = CPH.GetTwitchUsersVar("userVar", true); //For each loop which prints infos into Log File of the userVarList foreach(UserVariableValue userVar in userVarList) { string displayName = userVar.UserName; string userId = userVar.UserId; string userLogin = userVar.UserLogin; //Actual value of user variable must be of same type previousy defined long value = userVar.Value; //Last time the user var was updated for the user DateTime lastUpdate = userVar.LastWrite; CPH.LogInfo($"{displayName} - {userId} - {userLogin} - {value} - {lastUpdate}"); } return true; } } ``` -------------------------------- ### Get Twitch Reward User Counters C# Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/3.methods/twitch/channel-reward/twitch-get-reward-user-counters.md Use this snippet to retrieve and log the counter values for a specific Twitch channel reward. Ensure you have the necessary using statements for System and Collections.Generic. The rewardId and persisted parameters control which reward and counter data (persisted or non-persisted) are fetched. ```csharp using System; using System.Collections.Generic; //needed due to List usage public class CPHInline { public bool Execute() { //Reward Id of the channel point reward you want to get your counters of string rewardId = "your reward id"; //Whether or not you want to get the persisted or non persisted counters bool persisted = true; List rewardCounters = CPH.TwitchGetRewardUserCounters(rewardId, true); foreach(TwitchRewardCounter userCounter in rewardCounters) { string displayName = userCounter.UserName; int counter = userCounter.Count; CPH.LogInfo($"{displayName} has Count of {counter}."); } return true; } } ``` -------------------------------- ### Split Commands Example.cs Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/1.sub-actions/core/commands/get-commands.md This C# code snippet demonstrates how to split a list of commands into batches that fit within platform-specific message character limits. It retrieves commands using CPH.TryGetArg and then iteratively sends them in chunks. ```cs using System; using System.Collections.Generic; public class CPHInline { public bool Execute() { // This is when the Variable Name in the Get Commands Sub-Action is `commands` CPH.TryGetArg("commandsList", out List commands); // Limit is 500 on Twitch, 200 on YouTube.. I took a few off as a safety measure. const int maxMessageLength = 495; string message = "Commands Avaliable to you: "; const string additionalCommandsMessage = "Addional Commands for you: "; const string commandSeparator = ", "; const bool sendFromBot = false; int commandsSent = 0; while (commandsSent < commands.Count) { int currentMessageLength = message.Length; bool fitsInMessage(string text) => currentMessageLength + text.Length < maxMessageLength; List commandsForMessage = []; for (int i = commandsSent; i < commands.Count && fitsInMessage(commands[i]); i++) { commandsForMessage.Add(commands[i]); currentMessageLength += commands[i].Length + commandSeparator.Length; } message += string.Join(commandSeparator, commandsForMessage); // if you wish to send the message to Youtube, use CPH.SendYouTubeMessage(message, sendFromBot); CPH.SendAction(message, sendFromBot); commandsSent += commandsForMessage.Count; message = additionalCommandsMessage; } return true; } } ``` -------------------------------- ### Walk-on Message and Sound Configuration (C#) Source: https://github.com/streamerbot/docs/blob/main/streamerbot/4.examples/starter-pack.md Configuration variables for the Walk-on Message and Sound action. Customize sound playback, message sending, root path for media, and excluded users. ```cs bool enableSound bool enableMessage string rootPath string excludedUsers ``` -------------------------------- ### SendMessage Client-Side Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example of using the @streamerbot/client to send a chat message. ```javascript // Using @streamerbot/client client.sendMessage(platform = "twitch", message = "This is a test", options = { bot: true, internal: false }); ``` -------------------------------- ### GetActions C# Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/3.methods/core/actions/get-actions.md Retrieves a list of all available actions and logs their IDs and names. Ensure you have the necessary using directives for System and System.Collections.Generic. ```csharp using System; using System.Collections.Generic; public class CPHInline { public bool Execute() { //Get list of actions List actionList = CPH.GetActions(); //Example to go through list and write them to logfile foreach(ActionData action in actionList) { //Get id of current action var. //Due to it being Guid type need to convert to string. string id = action.Id.ToString(); //Get name of current action var string name = action.Name; //Write to log CPH.LogInfo($"ActionId:{id}, Action Name: {name}"); } return true; } } ``` -------------------------------- ### GetUserPronouns Client-Side Example Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example of using the @streamerbot/client to retrieve a user's pronouns. ```javascript // Using @streamerbot/client client.getUserPronouns(platform = "twitch", userLogin = "justsomeguyyouknow")); ``` -------------------------------- ### Page Frontmatter Configuration Source: https://github.com/streamerbot/docs/blob/main/README.md YAML frontmatter for automatically building documentation pages. Includes required 'title' and 'description', and optional 'version'. ```yaml title: Page Title description: Some description of this page version: 0.2.3 ``` -------------------------------- ### Fetch and Set OBS Input Settings with C# Source: https://github.com/streamerbot/docs/blob/main/streamerbot/4.examples/csharp_obsraw.md Use this snippet to retrieve settings from one OBS input (like text content and font size) and apply them to another. Ensure the necessary using statements are present. ```csharp using System; using Newtonsoft.Json.Linq; public class CPHInline { public bool Execute() { string getInputSettingsResponse = CPH.ObsSendRaw("GetInputSettings", "{\"inputName\":\"Bitrate Text\"}", 0); JObject inputSettingsJObject = JObject.Parse(getInputSettingsResponse); string gdiText = (string)inputSettingsJObject["inputSettings"]["text"]; int fontSize = (int)inputSettingsJObject["inputSettings"]["font"]["size"]; CPH.ObsSendRaw("SetInputSettings", "{\"inputName\":\"Other Textsource\",\"inputSettings\":{\"font\":{\"size\": " + fontSize + "},\"text\":\" " + gdiText + "\"},\"overlay\":true}", 0); return true; } } ``` -------------------------------- ### TwitchGetUserGlobal Client-Side Example (Single Variable) Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example of using the @streamerbot/client to fetch a single variable for a user. ```javascript // Using @streamerbot/client const response = await client.getUserGlobal(platform = "twitch", userId = "136079477", name = "tuna"); ``` -------------------------------- ### Enable/On Source: https://github.com/streamerbot/docs/blob/main/speakerbot/2.api/1.udp/1.requests.md Enable the TTS engine. ```APIDOC ## Enable ### Description Enable the TTS engine (if it has been disabled) ### Command ```json { "command": "enable" } ``` ## On ### Description The `on` command provides the same functionality as `enable` ### Command ```json { "command": "on" } ``` ``` -------------------------------- ### GetGlobalVar Examples Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/3.csharp/3.methods/core/globals/get-global-var.md Demonstrates how to retrieve global variables of different types (integer and string) and persistence settings. Use the generic type argument to specify the expected return type. ```csharp using System; public class CPHInline { public bool Execute() { //Examples on usage //Get integer number from persisted global variable int myInt = CPH.GetGlobalVar("myInt"); //Get string/text from persisted global variable string myString = CPH.GetGlobalVar("myString",true); //Get string/text from non-persisted global variable string myString = CPH.GetGlobalVar("myString",false); return true; } } ``` -------------------------------- ### JavaScript Example: Clear Credits Source: https://github.com/streamerbot/docs/blob/main/streamerbot/3.api/4.websocket/3.requests.md Example using the @streamerbot/client library to clear all credits data and log the status of the operation. ```javascript // Using @streamerbot/client const response = await client.clearCredits(); console.log('Streamer.bot Credits Cleared', response.status); ``` -------------------------------- ### Configure Show Image Overlay Source: https://github.com/streamerbot/docs/blob/main/streamerbot/2.guide/04.extra-features/3.html-overlay.md Configure the channel point reward title, image URL, display duration, and dimensions for the Show Image overlay. ```javascript const CONFIG = { // The title of the Channel Point Reward that will trigger the effect rewardTitle: 'Show Image', // The URL of the image to show imageUrl: 'https://streamer.bot/logo.png', // The number of seconds to show the image for seconds: 5, // The width and height of the image (css) width: 'auto', height: 'auto', }; ``` -------------------------------- ### Enable Source: https://github.com/streamerbot/docs/blob/main/speakerbot/2.api/0.websocket/1.requests.md Enable the TTS engine (if it has been disabled) ```APIDOC ## Enable ### Description Enable the TTS engine (if it has been disabled). ### Request Body - **id** (string) - Required - Unique identifier for the request. - **request** (string) - Required - Must be "Enable". ```