mIRC Homepage

{Twitch} help with auto hosting

Posted By: copman

{Twitch} help with auto hosting - 30/09/15 05:10 AM

I want it so the bot can see if people are online and if they are not then it skips them and i want a !skip so i can skip hosts if i need to here is the script and i want a !extend so the host can be extended for 10 more mins.

ON *:TEXT:!autohost*:#:{
if (!$istok(%owners,$nick,32)) { .msg $chan ( $+ $nick $+ ): Error, You have NOT access for this command! | return }
if ($2 == on) {
if ($timer(.hostON)) { .msg $chan ( $+ $nick $+ ): Error, The AUTOHOST is already enabled! | return }
var %f = nowhosting.txt
if (!$isfile(%f)) { .msg $chan ( $+ $nick $+ ): Error, The $qt(%f) file does NOT provide any nickname(s) for hosting! | return }
if (!$lines(%f)) { .msg $chan ( $+ $nick $+ ): Error, The $qt(%f) file does NOT provide any nickname(s) in the list for hosting! | return }
msg # /me Auto Hosting is now enabled.
searchhost $chan
.timer.hostON 0 1800 searchhost $chan
}
elseif ($2 == off) {
if (!$timer(.hostON)) { .msg $chan ( $+ $nick $+ ): Error, The AUTOHOST is already disabled! | return }
msg # /me Auto Hosting is now disabled.
.timer.hostON off
msg # /unhost
}
}

alias searchhost {
if (!$1) { return }
if ($me !ison $1) { return }
var %f = nowhosting.txt
if (!$isfile(%f)) { return }
if (!$lines(%f)) { return }
var %r = $read(NowHosting.txt,n)
msg $1 /me Now hosting $qt(%r)
msg $1 /host %r
}

Thanks
Posted By: copman

Re: {Twitch} help with auto hosting - 02/10/15 02:17 AM

can this even get coded
Posted By: Loki12583

Re: {Twitch} help with auto hosting - 02/10/15 02:44 AM

Ask a specific question related to mIRC's functionality without assuming others have knowledge of twitch nomenclature.
Posted By: Sakana

Re: {Twitch} help with auto hosting - 02/10/15 07:16 AM

Originally Posted By: copman
can this even get coded


Sure, just make a list of channels you want to check, then look up Twitch's API to check if it's online. If it is online, host it, else check the next one, and so on.
Posted By: copman

Re: {Twitch} help with auto hosting - 02/10/15 05:11 PM

tnaks i will have to try it smile
Posted By: acpixel

Re: {Twitch} help with auto hosting - 28/11/15 10:48 PM

ok to check if they are live i would use this json parser script
http://hawkee.com/snippet/10194/

then the code you would need would be this:
replace (channel) with the variable that contains the channel you are checking
Code:
JSONOpen -u live https://api.twitch.tv/kraken/streams/ $+ (channel) $+ ?nocache= $+ $ticks
      if ( $json(live,stream) != $null ) {
          set %live on
          JSONClose live
}
else {
unset %live
}


The rest of the script should be easy enough for you to figure out. hope i helped
Posted By: Blas

Re: {Twitch} help with auto hosting - 30/11/15 12:39 AM

I have been successfully using a script that I created just recently for auto-hosting on Twitch. It does not have !skip or !extend features, but I still consider it fairly advanced and should at least be a decent template for what you want. Twitch Advanced Auto-Host
© 2019 mIRC Discussion Forums