स्क्विसो एक निःशुल्क, शक्तिशाली स्वचालन उपकरण है जो आपको सरल स्क्रिप्ट का उपयोग करके अपनी ट्विच स्ट्रीम को अनुकूलित करने की सुविधा देता है।
ट्विच !क्लिप कमांड कैसे बनाएं
यह उदाहरण !clip चैट संदेश को सुनता है, एक क्लिप बनाता है और फिर उसे ट्विच चैट और डिस्कॉर्ड दोनों पर पोस्ट करता है।
वह वीडियो देखें
स्क्रिप्ट उदाहरण
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 {
        // If the message text starts with !clip
        if (data.getMessageText().startsWith("!clip")) {
            // If the user is the broadcaster or (||) a moderator
            if (data.isUserBroadcaster() || data.isUserModerator()) {
                // Log that we are now creating a clip
                api.log("Will now try and create a Twitch clip!");
                // Create a clip
                CreateTwitchClipResult createData = api.createTwitchClip();
                // Specify 30 seconds (30*1000=30000 milliseconds)
                SquisoInteger waitTime = new SquisoInteger(30 * 1000);
                // Do this 30 seconds later (we wait 30 seconds to give Twitch time to generate an MP4 video out of the clip)
                api.doLater(waitTime, () -> {
                    // Extract the clip ID to its own variable
                    SquisoString clipID = createData.getClipID();
                    // Get additional data from the clip
                    TwitchClip clip = api.getTwitchClip(clipID);
                    // Send the message to Twitch chat
                    SquisoString chatMessage = new SquisoString("A new clip was created: " + clip.getURL());
                    api.sendTwitchChatMessage(chatMessage);
                    // Specify the Discord webhook URL
                    SquisoString discordWebhook = new SquisoString("https://discord.com/api/webhooks/abc/123");
                    // Create the message that we will send to Discord
                    SquisoString discordMessage = new SquisoString("");
                    discordMessage.append("A new clip was created by " + clip.getCreator() + "!");
                    discordMessage.append("\n");
                    discordMessage.append(clip.getURL());
                    // Send the message to the Discord channel
                    api.sendSimpleDiscordMessage(discordWebhook, discordMessage);
                });
            }
        }
    }
}