Squiso on tasuta võimas automatiseerimistööriist, mis võimaldab teil kohandada oma Twitchi voogu lihtsate skriptide abil.

How to Update Your Twitch Channel Title by AI Looking At Your Gameplay

This script example takes a screenshot of your desktop and asks ChatGPT to generate a Twitch channel title based on your gameplay and then updates your Twitch channel title.

Skripti näide

import com.squiso.*; import com.squiso.exception.*; import com.squiso.scripting.*; import com.squiso.scripting.data.*; import com.squiso.keyboard.*; import com.squiso.twitch.*; import com.squiso.datatypes.*; import com.squiso.utils.*; // Important - Please do not change the row below - otherwise you will get a compilation error! public class Script_Example extends SquisoScript { @Override public void onTwitchChatMessage(OnTwitchChatMessageData data, API api) throws SquisoException { // If the chat message equals "!updatetitle" if (data.getMessageText().equals("!updatetitle")) { // Take a screenshot of the desktop as a JPG SquisoData screenshot = api.takeScreenshot(0, 0, 1920, 1080, "jpg"); // Save the screenshot to the disk as well (for fun) screenshot.writeToFile("screenshot.jpg"); // Generate AI prompt String prompt = "Generate a short Twitch stream title based on the image. Return only the title string, no quotes."; // Ask AI to generate a Twitch channel title by analyzing the screenshot SquisoString title = api.generateAIImageText(screenshot, "jpg", prompt); // Compose the chat message SquisoString chatMessage = new SquisoString("Updating the title to \"" + title + "\"!"); // Write to Twitch chat the new title api.sendTwitchChatMessage(chatMessage); // Update the Twitch channel title api.updateTwitchChannelTitle(title); } } }