Twitch 채널 포인트로 OBS Studio에서 필터를 토글하는 방법
이 예시에서는 OBS Studio에서 10초 동안 필터를 활성화한 후 Twitch 채널 포인트 보상을 사용하면 해당 필터를 비활성화합니다.
스크립트 예제
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 onTwitchChannelPointRedeem(OnTwitchChannelPointRedeemData data, API api) throws SquisoException {
        // If the reward that got redeemed is called "Pixelate Webcam"
        if (data.getRewardName().equals("Pixelate Webcam")) {
            // Specify the source
            SquisoString sourceName = new SquisoString("Webcam");
            // Specify the filter
            SquisoString filterName = new SquisoString("Pixelate");
            // Enable the filter
            api.setOBSFilterEnabled(sourceName, filterName, true);
            // Specify a wait time of 10 seconds
            SquisoInteger waitTime = new SquisoInteger(10 * 1000);
            // 10 seconds later, disable the filter again
            api.doLater(waitTime, () -> {
                // Disable the filter again
                api.setOBSFilterEnabled(sourceName, filterName, false);
            });
        }
    }
}
    