Sueta
TW

twitch.sk

1.0

twitch.sk adds functions to Skript that allows you to request the Twitch API, and streamer status.

·Script

twitch.sk adds functions to Skript that allows you to request the Twitch API, and streamer status.

Dependencies:
- skript-mirror v1.0.0
- SkQuery v 3.6.5
- Skript

Example use case:

command /twitchstreamer <text>: 
  trigger: 
    checkTwitchChannelStreaming(arg-1) 
    while retrieveTwitchChannelStreaming(arg-1) is not set: 
      wait 1 tick 
    if retrieveTwitchChannelStreaming(arg-1) is true: 
      message "&7[&5&lTwitch&7]&r %arg-1% is live: https://www.twitch.tv/%arg-1%" 
    else: 
      message "&7[&5&lTwitch&7]&r %arg-1% is not live."

Functions:
checkTwitchChannelStreaming("myfavoritestreamer"):

Creates a check for the given twitch streamer. Result can be retrieved with this function:

retrieveTwitchChannelStreaming("myfavoritestreamer")

retrieveTwitchChannelStreaming("myfavoritestreamer"):
Returns the live status of the streamer, which is either true (streaming) or false (not streaming). You may want to use a while loop to wait until the request is done, since it happens in a thread:

while retrieveTwitchChannelStreaming("myfavoritestreamer") is not set: 
  wait 1 tick 
set {_result} to retrieveTwitchChannelStreaming("myfavoritestreamer")

requestTwitchAPI("twitch api url you want to request"):
Request data from the twitch api, this is not threaded, be sure to run this function in a thread to not halt your game. Returns the result as json string.

Setup:
To setup this script, you need a twitch api client id, which you can get here . Add this id to the options to allow this script to access the twitch api.

Questions:
If you have any questions, join our Discord .

Similar projects

Script →