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
}

Comments

Sign in to comment.
Brock   -  Sep 18, 2010
awesome..work..it works for me
 Respond  
trill   -  Aug 25, 2008
well i dont think he will being that he was Last seen on: May 02, 2006
 Respond  
The_Fuzzy_Wookie   -  Aug 25, 2008
OK.. obviously u need to fix ur sockets or whatever.. this sux till u do!!
 Respond  
SnoooP   -  May 27, 2008
lmao... still maybe someone can help fix it :P
 Respond  
Eugenio   -  May 27, 2008
ROFLCOPTER FAIL!!!!!
Dont think HRaZoR cares though because he hasnt logged in for over a year.
 Respond  
Syele   -  May 27, 2008
nice idea but:

[00:41] <Syele> !time Singapore
[00:41] <PsychobotIII> ** Please Wait - Retrieving Time for \"Singapore\" **
[00:41] <PsychobotIII> Current TimeZone Offset: <br /
[00:43] <Syele> !time NewMexico
[00:43] <PsychobotIII> ** Please Wait - Retrieving Time for \"NewMexico\" **
[00:43] <PsychobotIII> Sorry, No Match Found for \"NewMexico\"
[00:43] <Syele> !time New Mexico
[00:43] <PsychobotIII> ** Please Wait - Retrieving Time for \"New\" **
[00:43] <PsychobotIII> Current TimeZone Offset: <br /
[00:44] <Syele> !time Sydney
[00:44] <PsychobotIII> ** Please Wait - Retrieving Time for \"Sydney\" **
[00:44] <PsychobotIII> Current TimeZone Offset: <strong class=\"big\" id=\"cta\"
 Respond  
Phoenix847   -  Apr 18, 2008
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.
* /sockopen: \'wtimed\' socket in use (line 26, TimeGlobal)

I\'m not good with sockets so theres absolute no way I could fix it lol
 Respond  
OrJawLan   -  Nov 05, 2007
Not work !!
* /sockopen: \'timed\' socket in use (line 11, script1.ini)
-
* /sockwrite: \'timed\' not connected (line 15, script1.ini)

How can i fix it ??
 Respond  
M[n]M   -  Oct 22, 2007
not
workin
man..
=(
SOME ON FIX IT!
---->
+04:33+ <M[n]M> !time usa
+04:33+ <M-Bot> ** Please Wait - Retrieving Time for \"usa\" **
+04:33+ <M-Bot> Current TimeZone Offset: </tr
---->
WHAT IS \"</tr\" ??

Quote


NOT WORKING AT ALL!
 Respond  
Abbas   -  Oct 16, 2007
not working for me :(
 Respond  
ermansanidhya   -  Sep 01, 2007
same with me, not work
 Respond  
Pangaea   -  Jul 19, 2007
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.

<Pangaea> !time dublin
<|BAYRON|> ** Please Wait - Retrieving Time for \"dublin\" **
<Pangaea> !time sydney
<|BAYRON|> ** Please Wait - Retrieving Time for \"sydney\" **
<[Chimp]> !time perth
<|BAYRON|> ** Please Wait - Retrieving Time for \"perth\" **



and thats all that happens?



Best Regards Pan
 Respond  
AHBARAR   -  Jun 03, 2007
well it looks many liked it but im having some thing wrong
* /sockopen: \'wtimed\' socket in use (line 26, time.txt)
sockopen wtimed www.timeanddate.com 80 <--- line 26
 Respond  
Sanjie   -  Jan 07, 2007
not too bad.
 Respond  
spitfire3292   -  May 01, 2006
It was working earlier. I think that the website got changed around a bit so it gives an error saying that the socket is already in use. Wondering if you can fix it.
 Respond  
sentience   -  Apr 30, 2006
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] <MacMikey> !time london
[14:48:22] <paradismus> ** Please Wait - Retrieving Time for \"london\" **
[14:48:24] <paradismus> ** London, Ontario, Canada **
[14:48:24] <paradismus> Current TimeZone Offset: UTC/GMT -5 hours

It would seem to me they use the capitol of england first ;)
 Respond  
bearruler   -  Feb 07, 2006
I think this is a very handy snippet for gaming channels with people from all around the world
Nice job :)


Bear
 Respond  
PCTech   -  Feb 07, 2006
Very nice - I would use it more for my own information as in not necessarily echo to the channel, any way to do that and also maybe a /time sydney so I could trigger it myself (somehow) lol - Good Job though.
 Respond  
HRaZoR   -  Feb 06, 2006
thanks i will be updating abit in it when i get the time to
 Respond  
Urza   -  Feb 06, 2006
nicely done :) i was planning on writing something similar to this for my bot but you just saved me the bother :P with just a few little tweaks
 Respond  
Urza   -  Feb 06, 2006
nicely done :) i was planning on writing something similar to this for my bot but you just saved me the bother :P with just a few little tweaks
 Respond  
Raid   -  Feb 05, 2006
It needs to have something where you can search for all your text. Like *new york* instead of just hittin on \"New\". Other than that this is kinda fun. +adds to his bot+
 Respond  
Flak   -  Feb 05, 2006
I like this (Y)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.