Twitch Stream State Announcer

By OrFeAsGr on Jan 16, 2017

Hey! This was requested by a user on mIRC forums.
Load this in a clean mIRC remote and input your twitch channel name where it says INPUT_CHAN_HERE
The checking will start when mIRC starts or in case you don't want to restart you can execute the command /decapi to toggle it on or off. Enjoy!

Visit my personal site, check my art: http://orpheusgr.tk

alias livestream {
  sockopen -e decapi decapi.me 443
}

alias decapi {
  if ($timer(decapi).secs) { .timerdecapi off | echo -at The Stream Checker is now off }
  elseif (!$timer(decapi).secs) { .timerdecapi 0 200 livestream | echo -at The Stream Checker is now on }
}

alias mytchan { return INPUT_CHAN_HERE }

on *:SOCKOPEN:decapi: {
  sockwrite -nt $sockname GET $+(/twitch/uptime.php?channel=,$mytchan) HTTP/1.1
  sockwrite -nt $sockname Host: decapi.me
  sockwrite $sockname $crlf
}

on *:SOCKREAD:decapi: {
  var %decapi
  sockread %decapi
  while ($sockbr) {
    sockread %decapi
  }
}

on *:sockclose:decapi: {
  var %decapi
  sockread -f %decapi
  if (*not live* iswm %decapi) {
    if (!%streamisoff) {
      set -e %streamisoff 1
      msg $+($chr(35),$mytchan) Stream is now off...
      unset %streamison
    }
  }
  else { 
    if (!%streamison) {
      set -e %streamison 1
      msg $+($chr(35),$mytchan) Stream is now on!
      unset %streamisoff
    }
  }
}

ON *:START: { .timerdecapi 0 200 livestream }

Do you want to earn me some cents without paying for anything? Visit http://humanity.ucoz.com after turning your adblock off, watch a short ad by shorte.st and turn it back on.
Or do you want to donate some bucks because you like my scripts??? Visit https://www.paypal.me/OrFeAsGr
Thx! ^_^

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.