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 , 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
}
nice idea but:
[00:41] !time Singapore
[00:41] Please Wait - Retrieving Time for \"Singapore\"
[00:41] Current TimeZone Offset: <br /
[00:43] !time NewMexico
[00:43] Please Wait - Retrieving Time for \"NewMexico\"
[00:43] Sorry, No Match Found for \"NewMexico\"
[00:43] !time New Mexico
[00:43] Please Wait - Retrieving Time for \"New\"
[00:43] Current TimeZone Offset: <br /
[00:44] !time Sydney
[00:44] Please Wait - Retrieving Time for \"Sydney\"
[00:44] Current TimeZone Offset: <strong class=\"big\" id=\"cta\"
Not working.
(00:35:20) <@G|O|D> !time tokyo
(00:35:20) <@PhoenixBot> Please Wait - Retrieving Time for \"tokyo\"
(00:35:21) <@PhoenixBot> Current TimeZone Offset: Show clock in <a href=\"/worldclock/fullscreen.html?n=530\" onclick=\"return ofs(this)\"
And this is what I get in Status.
I\'m not good with sockets so theres absolute no way I could fix it lol
Nope i tryed this and it dosent want to work
it looks like its attempting to send to a soket, but never gets any returns.
I like this one very much but as PCTech allready said it would be nice for your own use as well.
If I may add another comment, would it be possible to use another site?
I\'ll show you what I mean :
[14:48:22] !time london
[14:48:22] Please Wait - Retrieving Time for \"london\"
[14:48:24] London, Ontario, Canada
[14:48:24] Current TimeZone Offset: UTC/GMT -5 hours
It would seem to me they use the capitol of england first ;)
let me know if you get it working, I'm pulling my hair out trying to get it to work