alias tw_check_follow {
if (!$1) { return }
var %u = https://api.twitch.tv/kraken/users/ $+ $2 $+ /follows/channels/ $+ $1 $+ ?limit=1&nocache= $+ $ticks
var %v = twc_ $+ $ticks
JSONOpen -ud %v %u
if (%JSONError) { var %error = 1 | goto end | return }
var %fc = $json(%v,error)
if (%fc) {
var %msg = $json(%v,message)
if (is not following isin %msg) { var %status = 0 }
}
:end
var %status = $json(%v,created_at)
if (%error) { msg $3 ( $+ $nick $+ ): Giveaway has ended, the winner is: $2 ( $+ $2 is NOT following the channel) | goto end2 }
if (!%status) { msg $3 ( $+ $nick $+ ): Giveaway has ended, the winner is: $2 ( $+ $2 is NOT following the channel) }
elseif (%status) { msg $3 ( $+ $nick $+ ): Giveaway has ended, the winner is: $2 ( $+ $2 is following the channel) }
:end2
JSONClose %v
}