Jak automaticky přihlásit Twitch Chat do textového souboru
Tento příklad skriptu naslouchá všem chatovacím zprávám Twitch a automaticky je přihlásí do textového souboru ve vašem počítači.
Podívejte se na video
Příklad skriptu
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.*;
import com.squiso.sysinfo.*;
// 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);
    }
}
    