World Time Bot
Platform: mIRC
Published Feb 05, 2006
Updated Feb 05, 2006
Well as the name says its a World Time Bot. It will retrieve the time
and timezone offset in a city from timeanddate.com. Usage is !time <city> , eg !time sydney will retrieve the time & timezone offset for sydney.
Once its loaded type /timechan #CHANNELHERE and that will set the channel it should work in. Any suggestions welcome, thanks and enjoy.
on 1:TEXT:!time*:%tchan:{
msg %tchan ** Please Wait - Retrieving Time for $+(",$2,") **
wtime $2
}
alias timechan {
if ($left($1,1) != $chr(35)) { echo -a ** Invalid Channel | halt }
set %tchan $1
echo -a ** Channel set to $1
}
alias wtime {
sockopen timed www.timeanddate.com 80
set %srch $1
}
on 1:SOCKOPEN:timed:{
sockwrite -n $sockname GET $+(/search/results.html?query=,%srch) HTTP/1.1
sockwrite -n $sockname Host: www.timeanddate.com
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}
on 1:SOCKREAD:timed:{
sockread %temp
if (<a href="/worldclock/city.html?n= isin %temp) { sockmark timed $remove($gettok(%temp,1,62),<a href=",") | wdtime }
if (<div class="minititle">No matches were found for*word</div> iswm %temp) { msg %tchan Sorry, No Match Found for $+(",,%srch,") | unset %srch }
}
alias wdtime {
sockopen wtimed www.timeanddate.com 80
}
on 1:sockopen:wtimed:{
sockwrite -n $sockname GET $+(/,$sock(timed).mark) HTTP/1.0
sockwrite -n $sockname Host: www.timeanddate.com
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}
on 1:sockread:wtimed:{
sockread %temp
if (<tr><th class="head" colspan="2"><span class="biggest">* iswm %temp) { msg %tchan ** $remove($gettok(%temp,4,62),</span) ** }
if (<tr class="d0"><th>Current time</th><td><strong> isin %temp) { msg %tchan Current Time and Date: $remove($gettok(%temp,5,60),strong>) $+(,$iif($remove($gettok(%temp,7,62),</a) == </td,,$remove($gettok(%temp,7,62),</a))) }
if (<tr><td>Standard time zone:</td><td> isin %temp) { msg %tchan Current TimeZone Offset: $remove($gettok(%temp,10,62),</td) }
unset %srch
}