How to Simulate Keyboard Key Presses Using Twitch Channel Points
This script example listens to all Twitch Channel Point redeems and simulates typing "POG" on the keyboard.
Příklad skriptu
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 {
public void onTwitchChannelPointRedeem(OnTwitchChannelPointRedeemData data, API api) throws SquisoException {
// If the reward name equals "POG"
if (data.getRewardName().equals("POG")) {
// Wait 5 seconds (5000ms)
api.sleep(5000);
// Simulate key press SHIFT + p + o + g
api.keyPress(KeyboardKey.SHIFT, KeyboardKey.P, KeyboardKey.O, KeyboardKey.G);
}
}
}