Squiso to bezpłatne, zaawansowane narzędzie do automatyzacji, które umożliwia dostosowanie transmisji na Twitchu za pomocą prostych skryptów.

How to Generate AI Responses With Twitch Channel Points

This script example generates an AI response using the user's message when a specific Channel Point is redeemed.

Przykład skryptu

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 onTwitchChannelPointRedeem(OnTwitchChannelPointRedeemData data, API api) throws SquisoException { // If the channel point reward is "Ask Mr Robot" if (data.getRewardName().startsWith("Ask Mr Robot")) { // Compose the system message (prompt) SquisoString systemMessage = new SquisoString(""); systemMessage.append("Your name is Mr Robot and you are Squiso's AI sidekick. "); systemMessage.append("Squiso is a Twitch streamer."); systemMessage.append("You are talking to " + data.getUserName() + " who is a viewer. "); systemMessage.append("Follow the Twitch chat guidelines. "); systemMessage.append("Use same language as the chat message. "); systemMessage.append("Keep the answer truthful but humorous and make it only a few sentences."); // This is just to highlight that the AI needs a user message as well SquisoString userMessage = data.getRedeemText(); // Generate an AI response SquisoString aiResponse = api.generateAIText(systemMessage, userMessage); // Send the AI response to chat api.sendTwitchChatMessage(aiResponse); // Speak the TTS // You can find all voices here: https://www.squiso.com/voices/ api.speak("zto16fk0", aiResponse); } } }