Try using this code. Just insert your access token where it says BOT_ACCESSTOKEN
Code:
on $*:TEXT:/^!(status|game)(\s|$)/iS:#:{
  var %n = $lower($regml(1))
  var %json = TwitchStreamUpdate
  var %data
  if ($0 == 1) {
    JSONOpen -du %json https://api.twitch.tv/kraken/channels/ $+ $lower($mid(#, 2-))
    if ($JSONError) {
      msg # Unable to retrieve $lower(%n $+ .)
    }
    elseif ($json(%json, %n)) {
      msg # Current %n $+ : $v1
    }
    else {
      msg # Unable to retrieve $lower(%n $+ .)
    }
  }
  elseif ($nick != $mid(#,2-)) {
    return
  }
  else {
    var %data, %json = TwitchStreamUpdate
    if (%n == status) {
      %data = {"channel":{"status":" $+ $escape($2-) $+ "}}
    }
    else {
      %data = {"channel":{"game":" $+ $escape($2-) $+ "}}
    }
    JSONOpen -duw %json https://api.twitch.tv/kraken/channels/ $+ $lower($mid(#, 2-))
    JSONUrlMethod %json PUT
    JSONUrlHeader %json Connection close
    JSONUrlHeader %json Accept application/vnd.twitchtv.v3+json
    JSONUrlHeader %json Content-type application/json
    JSONUrlHeader %json Content-length $len(%data)
    JSONUrlHeader %json Authorization OAuth BOT_ACCESSTOKEN
    JSONUrlGet %json %data
    if ($jsonerror) {
      msg # Unable to update $lower(%n $+ .)
    }
    elseif ($JSON(%json, %n)) {
      msg # Updated $lower($1) $+ : $v1
    }
    else {
      msg # Unable to update $lower(%n $+ .)
    }
  }
}

alias -l escape return $regsubex($1-, /([^a-z\d_-\.])/gi, \ $+ \t)

Last edited by paper0rplastic; 26/05/16 12:53 AM.