Squiso 是一款免费且功能强大的自动化工具,可让您使用简单的脚本自定义您的 Twitch 流。

如何用有趣的人工智能回应来迎接初次聊天的人

此脚本示例监听所有 Twitch 聊天消息,如果该消息是他们在您的频道中的第一条消息(介绍消息),它将生成有趣的 AI 问候响应。

观看视频

脚本示例

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 message is not their first time (introduction), end here and do nothing if (!data.isMessageFirstTime()) { return; } SquisoString systemMessage = new SquisoString(""); systemMessage.append("You are an AI in Squiso's Twitch chat."); systemMessage.append("A viewer with the username \"" + data.getUserName() + "\" just entered the chat and wrote for the first time."); systemMessage.append("Generate a funny greeting back to the viewer."); systemMessage.append("Follow the Twitch chat guidelines. "); systemMessage.append("Use same language as the chat message. "); // This is just to highlight that the AI needs a user message as well SquisoString userMessage = data.getMessageText(); // Generate an AI response SquisoString aiResponse = api.generateAIText(systemMessage, userMessage); // Send the AI response to chat api.sendTwitchChatMessage(aiResponse); } }