Requested for: http://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/253336/gonew/1/Post_uptime_every_30_minutes
Contact: http://westor.ucoz.com/contact
Description:
This code is giving the uptime if your channel is up and streaming every X seconds, the settings are included into the code read the 'settings' section inside the code and change them with your own.
; --- settings ------
alias uptime_chan return ENTER-HERE-THE-TWITCH-CHANNEL
; change this to your twitch channel (without # in front of the name)
; example: starladder5
alias uptime_offline_info return 1
; if you change the 1 to 0 then when the stream of the channel that you set is offline the bot will not give any uptime message.
alias uptime_check_secs return 900
; change this if you want to increase/decrease the checking uptime for you channel.
; 900 seconds = 10 minutes
; --- end of settings ----
ON *:CONNECT: { .timer[UPTIME] 0 $iif($uptime_check_secs,$v1,900) uptime }
alias uptime {
sockclose uptime
sockopen uptime nightdev.com 80
}
ON *:SOCKOPEN:uptime: {
if ($sockerr) { sockclose $sockname | halt }
sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ $uptime_chan HTTP/1.1
sockwrite -n $sockname Host: $sock($sockname).addr
sockwrite -n $sockname $crlf
}
ON *:SOCKREAD:uptime: {
if ($sockerr) { sockclose $sockname }
var %data
sockread %data
if ($gettok(%data,1,32) isnum) && ($gettok(%data,2,32)) {
var %c = $chr(35) $+ $uptime_chan
if ($me !ison %c) { return }
.msg %c The streaming is up for $qt(%data) $+ .
}
elseif (*not live.* iswm %data) {
if ($uptime_offline_info) {
var %c = $chr(35) $+ $uptime_chan
if ($me !ison %c) { return }
.msg %c The streaming is currently offline.
}
}
}