„Squiso“ yra nemokamas, galingas automatizavimo įrankis, leidžiantis tinkinti „Twitch“ srautą naudojant paprastus scenarijus.
Kaip sukurti Twitch !Clip komandą
Šie pavyzdžiai išklauso !clip pokalbio pranešimą, sukuria klipą ir paskelbia jį tiek „Twitch“ pokalbyje, tiek „Discord“.
Žiūrėkite vaizdo įrašą
Scenarijaus pavyzdys
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 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);
});
}
}
}
}