Squiso là một công cụ tự động hóa miễn phí và mạnh mẽ cho phép bạn tùy chỉnh luồng Twitch của mình bằng các tập lệnh đơn giản.

How to Create a !Screenshot Chat Command That Posts to Discord

This script example listens to a !screenshot command, takes a partial screenshot of your desktop and then posts it to Discord.

Ví dụ về kịch bản

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 chat message starts with !screenshot if (data.getMessageText().startsWith("!screenshot")) { // If the user is either the broadcaster, a subscriber or a prime subscriber if (data.isUserBroadcaster() || data.isUserSubscriber() || data.isUserPrimeSubscriber()) { // Take a JPG screenshot from position 200x400 with the size 800x600 SquisoData screenshot = api.takeScreenshot(200, 400, 800, 600, "jpg"); // Save a copy of the screenshot to the disk screenshot.writeToFile("screenshot.jpg"); // Upload the file to the Squiso servers temporarily SquisoString url = api.uploadFileTemp(screenshot, "jpg"); // Assign the Discord webhook URL SquisoString discordWebhookURL = new SquisoString("https://discord.com/api/webhooks/123/abc"); // Compose the discord message SquisoString discordMessage = new SquisoString(data.getUserName() + " just took a screenshot!\n\n" + url); // Send a message with the link to the screenshot to a Discord server api.sendSimpleDiscordMessage(discordWebhookURL, discordMessage); } } } }