[script]
n0=on *:TEXT:!uptime*:#: {
n1= if ((%floodsocial) || ($($+(%,floodsocial.,$nick),2))) { return }
n2= set -u10 %floodsocial On
n3= set -u30 %floodsocial. $+ $nick On
n4= var %json = streamuptime, %stream = $iif(#* iswm $iif($2,$2,#), $mid($v2, 2-), $v2), %time
n5= jsonopen -ud %json https://api.twitch.tv/kraken/streams?channel= $+ $lower(%stream)
n6= if ($JSONError) {
n7=
n8= msg # Unable to retrieve the state of %stream
n9= }
n10= elseif ($regex($JSON(%json, streams, 0, created_at), /^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z$/)) {
n11= %time = $calc($ctime($+($gettok(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec, $regml(2), 32) $ord($base($regml(3), 10, 10)), $chr(44) $regml(1) $regml(4), :, $regml(5), :, $regml(6))) + ( $time(z) * 3600))
n12= msg # %stream has been online for $duration(%time)
n13= }
n14= else {
n15= msg # %stream is currently not live.
n16= }
n17=}