Squiso är ett gratis, kraftfullt automatiseringsverktyg som låter dig anpassa din Twitch-ström med enkla skript.
Hur man postar till Discord på Twitch Channel Updates
Detta exempel skickar ett Discord-meddelande varje gång du uppdaterar din titel eller kategori på Twitch.
Manusexempel
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 {
    
    SquisoString oldTitle = new SquisoString("");
    SquisoString oldCategoryName = new SquisoString("");
    @Override
    public void onInitiated(API api) throws SquisoException {
        // Get the current channel information
        ChannelData channelData = api.getTwitchChannelData();
        // Save the current title and category, so that we know if they get updated
        this.oldTitle = channelData.getTitle();
        this.oldCategoryName = channelData.getCategoryName();
        api.log("[Example_DiscordMessageTwitchCategoryName] Old title is \"" + oldTitle + "\".");
        api.log("[Example_DiscordMessageTwitchCategoryName] Old category is \"" + oldCategoryName + "\".");
    }
    @Override
    public void onTwitchChannelUpdate(OnTwitchChannelUpdateData data, API api) throws SquisoException {
        // Extract the current channel title and category
        SquisoString currentTitle = data.getTitle();
        SquisoString currentCategoryName = data.getCategoryName();
        api.log("[Example_DiscordMessageTwitchCategoryName] Title is \"" + data.getTitle() + "\".");
        api.log("[Example_DiscordMessageTwitchCategoryName] Category is \"" + data.getCategoryName() + "\".");
        // Start writing the Discord message
        SquisoString discordMessage = new SquisoString("");
        // If the title was changed
        if (!currentTitle.equals(oldTitle)) {
            // Compose the discord message
            discordMessage.append("Squiso just updated their title:");
            discordMessage.append("\n");
            discordMessage.append("\n");
            discordMessage.append("> " + currentTitle);
            discordMessage.append("\n");
            discordMessage.append("\n");
            discordMessage.append("https://www.twitch.tv/twitch");
            // Save the new title
            oldTitle = currentTitle;
        }
        // If the category was changed
        if (!currentCategoryName.equals(oldCategoryName)) {
            // Compose the discord message
            discordMessage.append("Squiso just updated their category:");
            discordMessage.append("\n");
            
            discordMessage.append("\n");
            discordMessage.append("> " + currentCategoryName);
            discordMessage.append("\n");
            discordMessage.append("\n");
            discordMessage.append("https://www.twitch.tv/twitch");
            // Save the new category
            oldCategoryName = currentCategoryName;
        }
        // Assign the Discord webhook URL
        SquisoString discordWebhookURL = new SquisoString("https://discord.com/api/webhooks/123/abc");
        // Send the Discord message
        api.sendSimpleDiscordMessage(discordWebhookURL, discordMessage);
    }
}
    