Code: Select all
# Public/User Channel
set streamch "#public"
# Private/DJ Channel
set djch "#private"
set radiotime 5
package require http
set a "$botnick"
set a [string tolower "$nick"]
if {![info exists ald]} {
set ald 1
timer $radiotime get_shoutcast_song
}
proc get_shoutcast_song {} {
global url streamch a radiotime
set streamch [string tolower $streamch]
::http::config -useragent "Mozilla/5.0; Shoutinfo"
if {[string tolower $chan] == "$streamch"} {
set http_req [::http::geturl $url -timeout 2000]
if {[::http::status $http_req] != "ok"} {
puthelp "PRIVMSG $chan :Stream is unavailable";
}
set data [::http::data $http_req]
::http::cleanup $http_req
if {[regexp {<font class=default>Current Song: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
puthelp "PRIVMSG $chan :\002Current Song\002: $title"
timer $radiotime get_shoutcast_song
} else {
puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
get_shoutcast_server $nick $uhost $hand $chan $arg
}
}
}
[21:44] Tcl error in script for 'timer7716':
[21:44] can't read "chan": no such variable
Can someone please help me get the $chan variable added? I tried global chan with no luck.