Squiso is a free, powerful automation tool that lets you customize your Twitch stream using simple scripts.

How to Automatically Log Twitch Chat to a Text File

This script example listens to all Twitch chat messages and automatically logs them to a text file on your computer.

Watch the Video

Script Example

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 { // Create the line that should be appended to the file SquisoString line = new SquisoString("[" + SquisoDate.nowLocal().toYYYYMMDDHHMMSS() + "] " + data.getUserName() + ": " + data.getMessageText() + "\n"); // Write it to the terminal console api.log("Logging chat message: " + line); // Create a filename based on the current date String file = "chat_log_" + StringUtil.toFilenameFriendly(SquisoDate.nowLocal().toYYYYMMDD()) + ".txt"; // Append the line to the file line.appendToFile(file); } }