mIRC Home    About    Download    Register    News    Help

Print Thread
P
Pie
Pie
P
Hi there,

I was wondering if mIRC could react to the stream status, i.e: stream being online or offline.

I'd like to have it send a message to the channel when the stream goes online, and offline.

I.e:
(Stream online) Hi Streamer, Good to have you back!

(Stream offline) See you again tomorrow!

If anyone could help me out with this, I'd appreciate it a lot! laugh

Joined: Apr 2010
Posts: 964
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 964
AFAIK, twitch doesn't tell chat when the stream goes online/offline.

You'd have to poll twitch's api for changes

P
Pie
Pie
P
Yea i figured.
I couldn't find anything in the raw data as well so i guess i'll have to see how to pull data from the API with mIRC.

Thanks though! smile

Joined: Feb 2015
Posts: 241
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 241
https://forums.mirc.com/ubbthreads.php/topics/254744/Re:_Command_for_making_bot_ret#Post254744
Check this post out.

P
Pie
Pie
P
Originally Posted By: OrFeAsGr
https://forums.mirc.com/ubbthreads.php/topics/254744/Re:_Command_for_making_bot_ret#Post254744
Check this post out.


That would output the text on that given website.
If im right, I cant modify the output of that which is what i would want.

I could be wrong ofcourse :P

Joined: Feb 2015
Posts: 241
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 241
Hey i was bored so i checked this out and edited a bit for you.
All you have to do is load this on mIRC and input your channel name where it says INPUT_CHAN_HERE
The script will start checking for stream state when mIRC starts and you can also use /decapi to toggle the checking on or off.
Code:
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 }

I tested it and it works! smile
Enjoy!

P
Pie
Pie
P
Holy crap! That's really generous of you! shocked

Im gonna put this to the test today, But i'll take your word for it that it will work! grin

Thank you so much! Saves me a bit of a headache whistle
Really appreciate it! blush

EDIT: Yep, It works perfectly! laugh
I assume setting the timer to 0 60 wont be too much of a problem, Right?

Thank you again!

Last edited by Pie; 17/01/17 05:51 PM.

Link Copied to Clipboard