The author never responded to nobody, but I'm here for help.
This new worldtime1.2.tcl solves output problems such as:
<hanson_sp> The time in Lima,Peru is <font size="7">1:31 PM
and I have added all the cities and countries (some codes was changed) available in http://www.worldtimeserver.com
Added update by speechles
Code: Select all
#######################################################################
#######################################################################
# Worldtime by Murf #
# v1.1 #
# v1.2 (modified by LOQUILLO_) #
# v1.3 (updated by speechles) #
# --Purpose --------------------------------------------------------- #
# Gets the time from around the world from www.worldtimeserver.com #
# Not much else to say, simple but handy. #
# #
# --Usage ----------------------------------------------------------- #
# .chanset #yourchan +worldtime #
# !tz <Any city[, Any country]> #
# #
# --Current info ---------------------------------------------------- #
# For help with this script, use the following url: #
# http://forum.egghelp.org/viewtopic.php?t=9255&start=15 #
# #
# --Old, outdated info no longer relevant --------------------------- #
# Latest version @ http://www.blueday.org #
# Comments & Questions to murf@mindless.com #
#######################################################################
# -- tested on tcl v8.3 and eggdrop v1.6x using linux. #
# -- tested on tcl v8.4 and eggdrop v1.6.17 using CYGWIN_NT (windrop) #
#######################################################################
# #
# Commands #
# #
# !tz <Any city[, Any country]> #
# or #
# /msg YourBot !tz <Any city[, Any country]> #
# #
# City and country list is somewhat limited to major cities #
# and countries. #
# #
# Version #
# v1.3 Nov 02 2007 updated by speechles #
# -- Fixed the regexp scraper. #
# -- Added scraper for new info to display, exciting! :P #
# -- Added chanset ability .chanset #yourchan +worldtime #
# -- Added preliminary Multi-Language ability. #
# -- Script now scrapes entire output line directly from the #
# webpage, and how it has multilanguage capability, default #
# at the moment is english. #
# #
# v1.2 Mar 03 2005 modified by LOQUILLO_ #
# -- Solve output bug like: #
# <hanson_sp> The time in Lima,Peru is <font size="7">1:31PM #
# and added all the cities and countries (somes codes was #
# changed) available in http://www.worldtimeserver.com #
# #
# v1.1 Nov 01 2001 #
# -- Got rid of 'string equal' so people with old (v8.0) TCL #
# can run (not really worthy of .1 but what the hell!) #
# #
# v1.0 ??? ?? 2000 #
# -- first version and been running forever without problems or #
# changes to the script. #
# #
#######################################################################
#######################################################################
###Nothing to setup or configure#####
# If you want something to set up or configure in this script, feel free
# to modify sections to make it happen, your destiny is in your hands.
#Set up the channel flag indicator
setudef flag worldtime
##########binds######################
bind pub - !tz pub_world_time
bind msg - !tz msg_world_time
##########Procs######################
proc pub_world_time {nick uhost handle chan location} {
if {[lsearch -exact [channel info $chan] +worldtime] == -1} { return }
regexp -nocase -- {\.(.+?)\s(.+?)$} $location - lang location
if {![info exists lang]} {
set lang "en"
}
set loclist [get_tzloc $location $nick]
if {$loclist == 0} {
return
}
set url [lindex [split $loclist] 0]
set temploc [lindex [split $loclist] 1]
if {$temploc == "toilet"} {
putserv "PRIVMSG $chan : If ya gotta crap goto the toilet. No one wants\
your stank around here!"
return
}
if {$temploc == "kick"} {
putkick $chan $nick "It's time to stop being so lame"
return
}
set tztime [get_tztime $url $lang]
regsub -all {_} $temploc { } outloc
putserv "PRIVMSG $chan :$tztime"
}
proc msg_world_time {nick uhost handle location} {
regexp -nocase -- {\.(.+?)\s(.+?)$} $location - lang location
if {![info exists lang]} {
set lang "en"
}
set loclist [get_tzloc $location $nick]
if {$loclist == 0} {
return
}
set url [lindex [split $loclist] 0]
set temploc [lindex [split $loclist] 1]
if {$temploc == "toilet"} {
putserv "NOTICE $nick : If ya gotta crap goto the toilet. No one wants\
your stank around here!"
return
}
if {$temploc == "kick"} {
putserv "NOTICE $nick : It's time to stop being so lame!"
return
}
set tztime [get_tztime $url $lang]
regsub -all {_} $temploc { } outloc
putserv "NOTICE $nick :$tztime"
}
proc get_tztime {url lang} {
set tzsock [socket -async www.worldtimeserver.com 80]
puts $tzsock "GET $url HTTP/1.1"
puts $tzsock "Host: www.worldtimeserver.com"
puts $tzsock "Accept-Language: ${lang}-${lang},${lang};q=0.9,${lang};q=0.8,${lang};q=0.7,*;q=0.6"
puts $tzsock "Connection: close"
puts $tzsock "User-Agent: Tcl http client (TCL 8.4.7; worldtime 1.2; ${lang}-${lang}; CYGWIN_NT-5.1)"
puts $tzsock ""
flush $tzsock
while {![eof $tzsock]} {
append tzout [gets $tzsock]
}
close $tzsock
set tztime ""
regexp {<div id="analog-digital">.+?<span class="font7">(.+?)<.+?\)</font> \-\-\>(.+?)<br.+?<span class="font1">(.+?)<} $tzout {} tztime tzdate tzzone
regexp {<td valign="top">.*?<div style="width.*?">(.+?)</div>} $tzout {} tztext
return [cleanthisstring "[string trim $tztext] [string trim $tzzone] @ [string trim $tzdate]"]
}
proc cleanthisstring {input} {
regsub -all -- {<(.+?)>} $input { } input
while {[string match "* *" $input ]} {
regsub -all -- { } $input " " input
}
return $input
}
proc get_tzloc {location nick} {
set city_list {
UTC:UTC/GMT
RU-KK&city=Abakan:Abakan,Russia
CI&city=Abidjan:Abidjan,Cote_D'Ivoire
AE&city=Abu_Dhabi:Abu_Dhabi,United_Arab_Emirates
NG&city=Abuja:Abuja,Nigeria
GH&city=Accra:Accra,Ghana
PN&city=Adamstown:Adamstown,Pitcairn
ET&city=Addis_Ababa:Addis_Ababa,Ethiopia
AU-SA&city=Adelaide:Adelaide,Australia
RU-AGB&city=Aginskoye:Aginskoye,Russia
KZ1&city=Aktau:Aktau,Kazakhstan
KZ2&city=Aktyubinsk:Aktyubinsk,Kazakhstan
US-NY&city=Albany:Albany,United_States
US-NM&city=Albuquerque:Albuquerque,United_States
DZ&city=Algiers:Algiers,Algeria
KZ&city=Almaty:Almaty,Kazakhstan
ID3&city=Ambon:Ambon,Indonesia
JO&city=Amman:Amman,Jordan
NL&city=Amsterdam:Amsterdam,Netherlands
RU-CHU&city=Anadyr':Anadyr',Russia
US-AK&city=Anchorage:Anchorage,United_States
AD&city=Andorra_La_Vella:Andorra_La_Vella,Andorra
TR&city=Ankara:Ankara,Turkey
US-MD&city=Annapolis:Annapolis,United_States
MG&city=Antananarivo:Antananarivo,Madagascar
WS&city=Apia:Apia,Samoa
RU-ARK&city=Arkhangelsk:Arkhangelsk,Russia
CA-NT2B&city=Arviat:Arviat,Canada
TM&city=Ashgabat:Ashgabat,Turkmenistan
ER&city=Asmara:Asmara,Eritrea
KZ&city=Astana:Astana,Kazakhstan
RU-AST&city=Astrakhan':Astrakhan',Russia
PY&city=Asuncion:Asuncion,Paraguay
GR&city=Athens:Athens,Greece
US-GA&city=Atlanta:Atlanta,United_States
KZ1&city=Atyrau:Atyrau,Kazakhstan
NZ&city=Auckland:Auckland,NewZealand
US-ME&city=Augusta:Augusta,United_States
US-TX&city=Austin:Austin,United_States
IQ&city=Baghdad:Baghdad,Iraq
AR-BA&city=Bahía_Blanca:Bahía_Blanca,Argentina
AZ&city=Baku:Baku,Azerbaijan
US-MB&city=Baltimore:Baltimore,United_States
ML&city=Bamako:Bamako,Mali
BN&city=Bandar_Seri_Begawan:Bandar_Seri_Begawan,Brunei_Darussalam
IN&city=Bangalore:Bangalore,India
TH&city=Bangkok:Bangkok,Thailand
CF&city=Bangui:Bangui,Central_African_Republic
ID2&city=Banjarmasin:Banjarmasin,Indonesia
GM&city=Banjul:Banjul,Gambia
ES&city=Barcelona:Barcelona,Spain
RU-ALT&city=Barnaul:Barnaul,Russia
KN&city=Basseterre:Basseterre,SaintKitts_and_Nevis
RU-SA2&city=Batagay:Batagay,Russia
CN&city=Beijing:Beijing,China
LB&city=Beirut:Beirut,Lebanon
BR-PA1&city=Belém:Belém,Brazil
GB&city=Belfast:Belfast,United_Kingdom
RU-BEL&city=Belgorod:Belgorod,Russia
CS&city=Belgrade:Belgrade,Serbia_and_Montenegro
BZ&city=Belize_City:Belize_City,Belize
BR-MG&city=Belo_Horizonte:Belo_Horizonte,Brazil
DE&city=Berlin:Berlin,Germany
CH&city=Bern:Bern,Switzerland
US-MT&city=Billings:Billings,United_States
GB&city=Birmingham:Birmingham,United_Kingdom
US-AL&city=Birmingham:Birmingham,United_States
RU-YEV&city=Birobidzhan:Birobidzhan,Russia
KG&city=Bishkek:Bishkek,Kyrgyzstan
US-ND&city=Bismarck:Bismarck,United_States
GW&city=Bissau:Bissau,Guinea-Bissau
RU-AMU&city=Blagoveshchensk:Blagoveshchensk,Russia
CO&city=Bogota:Bogota,Colombia
US-MA&city=Boise:Boise,United_States
DE&city=Bonn:Bonn,Germany
US-MA&city=Boston:Boston,United_States
BR-DF&city=Brasilia:Brasilia,Brazil
SK&city=Bratislava:Bratislava,Slovakia
RU-IRK&city=Bratsk:Bratsk,Russia
CG&city=Brazzaville:Brazzaville,Congo
RU-CT&city=Bridgeport:Bridgeport,United_States
BB&city=Bridgetown:Bridgetown,Barbados
AU-QLD&city=Brisbane:Brisbane,Australia
BE&city=Brussels:Brussels,Belgium
RU-BRY&city=Bryansk:Bryansk,Russia
RO&city=Bucharest:Bucharest,Romania
HU&city=Budapest:Budapest,Hungary
AR-DF&city=Buenos_Aires:Buenos_Aires,Argentina
US-NY&city=Buffalo:Buffalo,United_States
BI&city=Bujumbura:Bujumbura,Burundi
US-VT&city=Burlington:Burlington,United_States
EG&city=Cairo:Cairo,Egypt
IN&city=Calcutta:Calcutta,India
CA-AB&city=Calgary:Calgary,Canada
AU-ACT&city=Canberra:Canberra,Australia
ZACape&city=Town:Town,South_Africa
VE&city=Caracas:Caracas,Venezuela
GB&city=Cardiff:Cardiff,United_Kingdom
MA&city=Casablanca:Casablanca,Morocco
LC&city=Castries:Castries,Saint_Lucia
AR-CT&city=Catamarca:Catamarca,Argentina
GF&city=Cayenne:Cayenne,French_Guiana
US-WV&city=Charleston:Charleston,United_States
US-NC&city=Charlotte:Charlotte,United_States
RU-CU&city=Cheboksary:Cheboksary,Russia
RU-CHE&city=Chelyabinsk:Chelyabinsk,Russia
CN&city=Chengdu:Chengdu,China
IN&city=Chennai:Chennai,India
RU-KC&city=Cherkessk:Cherkessk,Russia
US-WY&city=Cheyenne:Cheyenne,United_States
US-IL&city=Chicago:Chicago,United_States
MD&city=Chisinau:Chisinau,Moldova,Republic_of
RU-CHI&city=Chita:Chita,Russia
CN&city=Chongqing:Chongqing,China
US-OH&city=Cincinnati:Cincinnati,United_States
MX2-3&city=Ciudad_Juárez:Ciudad_Juárez,Mexico
US-OH&city=Cleveland:Cleveland,United_States
LK&city=Colombo:Colombo,Sri_Lanka
US-SC&city=Columbia:Columbia,United_States
US-OH&city=Columbus:Columbus,United_States
GN&city=Conakry:Conakry,Guinea
US-NH&city=Concord:Concord,United_States
DK&city=Copenhagen:Copenhagen,Denmark
AR-CB&city=Córdoba:Córdoba,Argentina
AR-CN&city=Corrientes:Corrientes,Argentina
BJ&city=Cotonou:Cotonou,Benin
CA-BC1&city=Creston:Creston,Canada
MX2-2&city=Culiacán:Culiacán,Mexico
BR-PR&city=Curitiba:Curitiba,Brazil
SN&city=Dakar:Dakar,Senegal
US-TX&city=Dallas:Dallas,United_States
SY&city=Damascus:Damascus,Syrian_Arab_Republic
TZ&city=Dar_es_Salaam:Dar_es_Salaam,Tanzania,United_Republic_of
AU-NT&city=Darwin:Darwin,Australia
CA-BC1&city=Dawson_Creek:Dawson_Creek,Canada
CA-YT&city=Dawson:Dawson,Canada
ID2&city=Denpasar:Denpasar,Indonesia
US-CO&city=Denver:Denver,United_States
US-IA&city=Des_Moines:Des_Moines,United_States
US-MI&city=Detroit:Detroit,United_States
BD&city=Dhaka:Dhaka,Bangladesh
TL&city=Dili:Dili,Timor-Leste
DJ&city=Djibouti:Djibouti,Djibouti
QA&city=Doha:Doha,Qatar
US-DE&city=Dover:Dover,United_States
AE&city=Dubai:Dubai,United_Arab_Emirates
IE&city=Dublin:Dublin,Ireland
RU-TAY&city=Dudinka:Dudinka,Russia
TJ&city=Dushanbe:Dushanbe,Tajikistan
GB&city=Edinburgh:Edinburgh,United_Kingdom
CA-AB&city=Edmonton:Edmonton,Canada
US-TX1&city=ElPaso:ElPaso,United_States
RU-KL&city=Elista:Elista,Russia
MX3&city=Ensenada:Ensenada,Mexico
US-IN1&city=Evansville:Evansville,United_States
TK&city=Fakaofo:Fakaofo,Tokelau
US-ND&city=Fargo:Fargo,United_States
AR-FM&city=Formosa:Formosa,Argentina
US-IN&city=Fort_Wayne:Fort_Wayne,United_States
BR-CE&city=Fortaleza:Fortaleza,Brazil
DE&city=Frankfurt:Frankfurt,Germany
SL&city=Freetown:Freetown,SierraLeone
TV&city=Funafuti:Funafuti,Tuvalu
BW&city=Gaborone:Gaborone,Botswana
US-IN1&city=Gary:Gary,United_States
CH&city=Geneva:Geneva,Switzerland
GY&city=Georgetown:Georgetown,Guyana
GB&city=Glasgow:Glasgow,United_Kingdom
RU-AL&city=Gorno-Altaisk:Gorno-Altaisk,Russia
RU-CE&city=Groznyy:Groznyy,Russia
MX&city=Guadalajara:Guadalajara,Mexico
GT&city=Guatemala_City:Guatemala_City,Guatemala
NL&city=Hague:Hague,The,Netherlands
CA-NS&city=Halifax:Halifax,Canada
BM&city=Hamilton:Hamilton,Bermuda
VN&city=Hanoi:Hanoi,Viet_Nam
ZW&city=Harare:Harare,Zimbabwe
US-CT&city=Hartford:Hartford,United_States
CU&city=Havana:Havana,Cuba
FI&city=Helsinki:Helsinki,Finland
MX2A&city=Hermosillo:Hermosillo,Mexico
VN&city=Ho_Chi_Minh_City:Ho_Chi_Minh_City,Viet_Nam
AU-TAS&city=Hobart:Hobart,Australia
HK&city=HongKong:HongKong,HongKong
SB&city=Honiara:Honiara,Solomon_Islands
US-HI&city=Honolulu:Honolulu,United_States
US-TX&city=Houston:Houston,United_States
US-IN&city=Indianapolis:Indianapolis,United_States
RU-IRK&city=Irkutsk:Irkutsk,Russia
PK&city=Islamabad:Islamabad,Pakistan
TR&city=Istanbul:Istanbul,Turkey
RU-IVA&city=Ivanovo:Ivanovo,Russia
RU-UD&city=Izhevsk:Izhevsk,Russia
US-MS&city=Jackson:Jackson,United_States
US-FL&city=Jacksonville:Jacksonville,United_States
ID&city=Jakarta:Jakarta,Indonesia
ID3&city=Jayapura:Jayapura,Indonesia
IL&city=Jerusalem:Jerusalem,Israel
ZA&city=Johannesburg:Johannesburg,South_Africa
AR-JY&city=Jujuy:Jujuy,Argentina
US-AK&city=Juneau:Juneau,United_States
AF&city=Kabul:Kabul,Afghanistan
RU-KGD&city=Kaliningrad:Kaliningrad,Russia
RU-KLU&city=Kaluga:Kaluga,Russia
UG&city=Kampala:Kampala,Uganda
CD2&city=Kananga:Kananga,Congo,Democratic_Republic_of
NG&city=Kano:Kano,Nigeria
US-MO&city=Kansas_City:Kansas_City,United_States
PK&city=Karachi:Karachi,Pakistan
RU-TA&city=Kazan':Kazan',Russia
RU-KEM&city=Kemerovo:Kemerovo,Russia
RU-KHA&city=Khabarovsk:Khabarovsk,Russia
SD&city=Khartoum:Khartoum,Sudan
UA&city=Kiev:Kiev,Ukraine
RW&city=Kigali:Kigali,Rwanda
JM&city=Kingston:Kingston,Jamaica
VC&city=Kingstown:Kingstown,Saint_Vincent_and_The_Grenadines
CD&city=Kinshasa:Kinshasa,Congo,Democratic_Republic_of
RU-KIR&city=Kirov:Kirov,Russia
US-TN1&city=Knoxville:Knoxville,United_States
FM&city=Kolonia:Kolonia,Micronesia,Federated_States_Of
CD2&city=Kolwezi:Kolwezi,Congo,Democratic_Republic_of
KZ&city=Konstanai:Konstanai,Kazakhstan
PW&city=Koror:Koror,Palau
RU-KOS&city=Kostroma:Kostroma,Russia
RU-SA3&city=Kotenko:Kotenko,Russia
PL&city=Krakow:Krakow,Poland
RU-KDA&city=Krasnodar:Krasnodar,Russia
RU-KYA&city=Krasnoyarsk:Krasnoyarsk,Russia
MY&city=Kuala_Lumpur:Kuala_Lumpur,Malaysia
RU-KOP&city=Kudymkar:Kudymkar,Russia
ID2&city=Kupang:Kupang,Indonesia
RU-KGN&city=Kurgan:Kurgan,Russia
RU-KRS&city=Kursk:Kursk,Russia
KW&city=KuwaitCity:KuwaitCity,Kuwait
JP&city=Kyoto:Kyoto,Japan
RU-TY&city=Kyzyl:Kyzyl,Russia
KZ&city=Kyzylorda:Kyzylorda,Kazakhstan
BOLa&city=Paz:Paz,Bolivia
AR-BA&city=La_Plata:La_Plata,Argentina
AR-LR&city=La_Rioja:La_Rioja,Argentina
US-MI&city=Lansing:Lansing,United_States
US-NV&city=Las_Vegas:Las_Vegas,United_States
MX&city=León:León,Mexico
US-KY&city=Lexington:Lexington,United_States
GA&city=Libreville:Libreville,Gabon
MW&city=Lilongwe:Lilongwe,Malawi
PE&city=Lima:Lima,Peru
US-NE&city=Lincoln:Lincoln,United_States
RU-LIP&city=Lipetsk:Lipetsk,Russia
PT&city=Lisbon:Lisbon,Portugal
US-AR&city=Little_Rock:Little_Rock,United_States
SI&city=Ljubljana:Ljubljana,Slovenia
CA-SK1&city=Lloydminster:Lloydminster,Canada
TG&city=Lome:Lome,Togo
GB&city=London:London,United_Kingdom
US-CA&city=Los_Angeles:Los_Angeles,United_States
US-KY&city=Louisville:Louisville,United_States
AO&city=Luanda:Luanda,Angola
CD2&city=Lubumbashi:Lubumbashi,Congo,Democratic_Republic_of
ZM&city=Lusaka:Lusaka,Zambia
LU&city=Luxembourg:Luxembourg,Luxembourg
US-WI&city=Madison:Madison,United_States
ES&city=Madrid:Madrid,Spain
RU-MAG&city=Magadan:Magadan,Russia
MH&city=Majuro:Majuro,Marshall_Islands
ID2&city=Makassar:Makassar,Indonesia
RU-DA&city=Makhachkala:Makhachkala,Russia
GQ&city=Malabo:Malabo,EquatorialGuinea
MV&city=Male:Male,Maldives
NI&city=Managua:Managua,Nicaragua
BH&city=Manama:Manama,Bahrain
BR-AM&city=Manaus:Manaus,Brazil
PH&city=Manila:Manila,Philippines
MZ&city=Maputo:Maputo,Mozambique
AR-BA&city=Mar_del_Plata:Mar_del_Plata,Argentina
LS&city=Maseru:Maseru,Lesotho
RU-AD&city=Maykop:Maykop,Russia
SZ&city=Mbabane:Mbabane,Swaziland
CD2&city=Mbuji-Mayi:Mbuji-Mayi,Congo,Democratic_Republic_of
SA&city=Mecca:Mecca,Saudi_Arabia
ID&city=Medan:Medan,Indonesia
AU-VIC&city=Melbourne:Melbourne,Australia
US-TN&city=Memphis:Memphis,United_States
AR-MZ&city=Mendoza:Mendoza,Argentina
MX&city=Mexico_City:Mexico_City,Mexico
US-FL&city=Miami:Miami,United_States
IT&city=Milan:Milan,Italy
US-WI&city=Milwaukee:Milwaukee,United_States
US-MN&city=Minneapolis:Minneapolis,United_States
BY&city=Minsk:Minsk,Belarus
SO&city=Mogadishu:Mogadishu,Somalia
LR&city=Monrovia:Monrovia,Liberia
MX&city=Monterrey:Monterrey,Mexico
UY&city=Montevideo:Montevideo,Uruguay
US-AL&city=Montgomery:Montgomery,United_States
US-VT&city=Montpelier:Montpelier,United_States
CA-QC&city=Montreal:Montreal,Canada
KM&city=Moroni:Moroni,Comoros
RU-MOS&city=Moscow:Moscow,Russia
IN&city=Mumbai:Mumbai,India
RU-MUR&city=Murmansk:Murmansk,Russia
OM&city=Muscat:Muscat,Oman
KE&city=Nairobi:Nairobi,Kenya
RU-KB&city=Nal'chik:Nal'chik,Russia
RU-NEN&city=Nar'yan-Mar:Nar'yan-Mar,Russia
US-TN&city=Nashville:Nashville,United_States
BS&city=Nassau:Nassau,Bahamas
RU-IN&city=Nazran:Nazran,Russia
TD&city=N'Djamena:N'Djamena,Chad
AR-NQ&city=Neuquén:Neuquén,Argentina
IN&city=New_Delhi:New_Delhi,India
US-LA&city=New_Orleans:New_Orleans,United_States
US-NY&city=New_York:New_York,United_States
US-NJ&city=Newark:Newark,United_States
NE&city=Niamey:Niamey,Niger
CY&city=Nicosia:Nicosia,Cyprus
RU-KHM&city=Nizhnevartovsk:Nizhnevartovsk,Russia
RU-NIZ&city=Nizhniy_Novgorod:Nizhniy_Novgorod,Russia
US-AK&city=Nome:Nome,United_States
RU-TAY&city=Noril'sk:Noril'sk,Russia
MR&city=Nouakchott:Nouakchott,Mauritania
RU-NGR&city=Novgorod:Novgorod,Russia
RU-NVS&city=Novosibirsk:Novosibirsk,Russia
GL&city=Nuuk:Nuuk,Greenland
US-OK&city=Oklahoma_City:Oklahoma_City,United_States
US-NE&city=Omaha:Omaha,United_States
RU-OMS&city=Omsk:Omsk,Russia
RU-ORL&city=Orël:Orël,Russia
RU-ORE&city=Orenburg:Orenburg,Russia
US-FL&city=Orlando:Orlando,United_States
JP&city=Osaka:Osaka,Japan
NO&city=Oslo:Oslo,Norway
CA-ON&city=Ottawa:Ottawa,Canada
BF&city=Ouagadougou:Ouagadougou,BurkinaFaso
RU-KOR&city=Palana:Palana,Russia
FM&city=Palikir:Palikir,Micronesia,Federated_States_Of
PA&city=PanamaCity:PanamaCity,Panama
SR&city=Paramaribo:Paramaribo,Suriname
AR-ER&city=Paraná:Paraná,Argentina
FR&city=Paris:Paris,France
US-FL1&city=Pensacola:Pensacola,United_States
RU-PNZ&city=Penza:Penza,Russia
RU-PER&city=Perm:Perm,Russia
AU-WA&city=Perth:Perth,Australia
RU-KA&city=Petropavlovsk-Kamchatskiy:Petropavlovsk-Kamchatskiy,Russia
RU-KR&city=Petrozavodsk:Petrozavodsk,Russia
US-PA&city=Philadelphia:Philadelphia,United_States
KH&city=PhnomPenh:PhnomPenh,Cambodia
US-AZ&city=Phoenix:Phoenix,United_States
US-SD&city=Pierre:Pierre,United_States
US-PA&city=Pittsburgh:Pittsburgh,United_States
MU&city=Port_Louis:Port_Louis,Mauritius
PG&city=Port_Moresby:Port_Moresby,Papua_New_Guinea
FK&city=Port_Stanley:Port_Stanley,Falkland_Islands_(Malvinas)
HT&city=Port-au-Prince:Port-au-Prince,Haiti
US-OR&city=Portland:Portland,United_States
US-ME&city=Portland:Portland,United_States
BR-RS&city=Porto_Alegre:Porto_Alegre,Brazil
TT&city=Port-of-Spain:Port-of-Spain,Trinidad_and_Tobago
VU&city=Port-Vila:Port-Vila,Vanuatu
AR-MN&city=Posadas:Posadas,Argentina
CZ&city=Prague:Prague,CzechRepublic
CV&city=Praia:Praia,CapeVerde
ZA&city=Pretoria:Pretoria,SouthAfrica
US-RI&city=Providence:Providence,United_States
RU-PSK&city=Pskov:Pskov,Russia
MX&city=Puebla:Puebla,Mexico
KP&city=Pyongyang:Pyongyang,Korea,Democratic_People's_Republic_of
EC&city=Quito:Quito,Ecuador
MA&city=Rabat:Rabat,Morocco
US-NC&city=Raleigh:Raleigh,United_States
PS&city=Ramallah:Ramallah,PalestinianTerritory
MM&city=Rangoon:Rangoon,Myanmar
US-SD1&city=Rapid_City:Rapid_City,United_States
CK&city=Rarotonga:Rarotonga,CookIslands
AR-CH&city=Rawson:Rawson,Argentina
BR-PE&city=Recife:Recife,Brazil
CA-SK&city=Regina:Regina,Canada
US-NV&city=Reno:Reno,United_States
AR-CC&city=Resistencia:Resistencia,Argentina
IS&city=Reykjavik:Reykjavik,Iceland
US-VA&city=Richmond:Richmond,United_States
LV&city=Riga:Riga,Latvia
BR-RJ&city=Rio_de_Janeiro:Rio_de_Janeiro,Brazil
AR-SC&city=Rio_Gallegos:Rio_Gallegos,Argentina
SA&city=Riyadh:Riyadh,Saudi_Arabia
IT&city=Rome:Rome,Italy
AR-SF&city=Rosario:Rosario,Argentina
DM&city=Roseau:Roseau,Dominica
RU-ROS&city=Rostov-na-Donu:Rostov-na-Donu,Russia
RU-RYA&city=Ryazan':Ryazan',Russia
US-CA&city=Sacramento:Sacramento,United_States
GD&city=Saint_George's:Saint_George's,Grenada
RU-YAN&city=Salekhard:Salekhard,Russia
US-OR&city=Salem:Salem,United_States
US-UT&city=Salt_Lake_City:Salt_Lake_City,United_States
AR-SA&city=Salta:Salta,Argentina
BR-BA&city=Salvador:Salvador,Brazil
AT&city=Salzburg:Salzburg,Austria
RU-SAM&city=Samara:Samara,Russia
US-TX&city=San_Antonio:San_Antonio,United_States
US-CA&city=San_Diego:San_Diego,United_States
US-CA&city=San_Francisco:San_Francisco,United_States
CR&city=San_Jose:San_Jose,Costa_Rica
AR-SJ&city=San_Juan:San_Juan,Argentina
PR&city=San_Juan:San_Juan,Puerto_Rico
MX2&city=San_Lucas:San_Lucas,Mexico
AR-SL&city=San_Luis:San_Luis,Argentina
SV&city=San_Salvador:SanSalvador,El_Salvador
YE&city=Sanaa:Sanaa,Yemen
AR-SF&city=Santa_Fe:Santa_Fe,Argentina
AR-LP&city=Santa_Rosa:Santa_Rosa,Argentina
AR-SE&city=Santiago_del_Estero:Santiago_del_Estero,Argentina
CL&city=Santiago:Santiago,Chile
DO&city=Santo_Domingo:Santo_Domingo,Dominican_Republic
BR-SP&city=Sao_Paulo:Sao_Paulo,Brazil
BA&city=Sarajevo:Sarajevo,Bosnia_and_Herzegovina
RU-MO&city=Saransk:Saransk,Russia
RU-SAR&city=Saratov:Saratov,Russia
CA-SK&city=Saskatoon:Saskatoon,Canada
GL3&city=Scoresbysund:Scoresbysund,Greenland
US-WA&city=Seattle:Seattle,United_States
KR&city=Seoul:Seoul,Korea,Republicof
CN&city=Shanghai:Shanghai,China
SG&city=Singapore_City:Singapore_City,Singapore
US-SD&city=Sioux_Falls:Sioux_Falls,United_States
MK&city=Skopje:Skopje,Macedonia,The_Former_Yugoslav_Republic_Of
RU-SMO&city=Smolensk:Smolensk,Russia
BG&city=Sofia:Sofia,Bulgaria
US-IL&city=Springfield:Springfield,United_States
AG&city=St._John's:St._John's,Antigua_and_Barbuda
CA-NF&city=St._John's:St._John's,Canada
US-MO&city=St._Louis:St._Louis,United_States
US-MN&city=St._Paul:St._Paul,United_States
RU-LEN&city=St._Petersburg:St._Petersburg,Russia
RU-STA&city=Stavropol':Stavropol',Russia
SE&city=Stockholm:Stockholm,Sweden
ID&city=Surabaya:Surabaya,Indonesia
FJ&city=Suva:Suva,Fiji
AU-NSW&city=Sydney:Sydney,Australia
RU-KO&city=Syktyvkar:Syktyvkar,Russia
TW&city=Taipei:Taipei,Taiwan
US-FL&city=Tallahassee:Tallahassee,United_States
EE&city=Tallinn:Tallinn,Estonia
RU-TAM&city=Tambov:Tambov,Russia
MA&city=Tangier:Tangier,Morocco
UZ&city=Tashkent:Tashkent,Uzbekistan
GE&city=Tbilisi:Tbilisi,Georgia
HN&city=Tegucigalpa:Tegucigalpa,Honduras
IR&city=Tehran:Tehran,Iran,Islamic_Republic_of
IL&city=Tel_Aviv:Tel_Aviv,Israel
MX2-1&city=Tepic:Tepic,Mexico
US-IN&city=Terre_Haute:Terre_Haute,United_States
BT&city=Thimphu:Thimphu,Bhutan
GL2&city=Thule:Thule,Greenland
MX3&city=Tijuana:Tijuana,Mexico
AL&city=Tirane:Tirane,Albania
JP&city=Tokyo:Tokyo,Japan
RU-TOM&city=Tomsk:Tomsk,Russia
US-KS&city=Topeka:Topeka,United_States
CA-ON&city=Toronto:Toronto,Canada
US-NJ&city=Trenton:Trenton,United_States
LY&city=Tripoli:Tripoli,Libyan_Arab_Jamahiriya
US-AZ&city=Tucson:Tucson,United_States
AR-TM&city=Tucumán:Tucumán,Argentina
RU-TUL&city=Tula:Tula,Russia
TN&city=Tunis:Tunis,Tunisia
RU-EVE&city=Tura:Tura,Russia
RU-TVE&city=Tver':Tver',Russia
RU-TYU&city=Tyumen':Tyumen',Russia
RU-BA&city=Ufa:Ufa,Russia
MN&city=Ulaanbaatar:Ulaanbaatar,Mongolia
RU-BU&city=Ulan-Ude:Ulan-Ude,Russia
RU-ULY&city=Ul'yanovsk:Ul'yanovsk,Russia
KZ1&city=Uralsk:Uralsk,Kazakhstan
AR-TF&city=Ushuaia:Ushuaia,Argentina
RU-UOB&city=Ust'-Ordynskiy:Ust'-Ordynskiy,Russia
LI&city=Vaduz:Vaduz,Liechtenstein
MT&city=Valletta:Valletta,Malta
CA-BC&city=Vancouver:Vancouver,Canada
CA-BC&city=Victoria:Victoria,Canada
SC&city=Victoria:Victoria,Seychelles
AR-RN&city=Viedma:Viedma,Argentina
AT&city=Vienna:Vienna,Austria
LA&city=Vientiane:Vientiane,Lao_People's_Democratic_Republic
LT&city=Vilnius:Vilnius,Lithuania
US-VA&city=Virginia_Beach:Virginia_Beach,United_States
RU-SE&city=Vladikavkaz:Vladikavkaz,Russia
RU-VLA&city=Vladimir:Vladimir,Russia
RU-PRI&city=Vladivostok:Vladivostok,Russia
RU-VGG&city=Volgograd:Volgograd,Russia
RU-VLG&city=Vologda:Vologda,Russia
RU-KO&city=Vorkuta:Vorkuta,Russia
RU-VOR&city=Voronezh:Voronezh,Russia
PL&city=Warsaw:Warsaw,Poland
US-DC&city=Washington:Washington,United_States
NZ&city=Wellington:Wellington,NewZealand
US-KS&city=Wichita:Wichita,United_States
US-DE&city=Wilmington:Wilmington,United_States
NA&city=Windhoek:Windhoek,Namibia
CA-MB&city=Winnipeg:Winnipeg,Canada
CN&city=Wuhan:Wuhan,China
RU-SA&city=Yakutsk:Yakutsk,Russia
CM&city=Yaounde:Yaounde,Cameroon
RU-YAR&city=Yarolavl':Yarolavl',Russia
RU-SVE&city=Yekaterinburg:Yekaterinburg,Russia
AM&city=Yerevan:Yerevan,Armenia
JP&city=Yokohama:Yokohama,Japan
RU-ME&city=Yoshkar-Ola:Yoshkar-Ola,Russia
RU-SAK&city=Yuzhno-Sakhalinsk:Yuzhno-Sakhalinsk,Russia
HR&city=Zagreb:Zagreb,Croatia
CH&city=Zurich:Zurich,Switzerland
}
set itmatched 0
if {$location == ""} {
putserv "NOTICE $nick :\002\037Worldtime.tcl 1.3 Help\037:\002"
putserv "NOTICE $nick :USAGE: \002!tz\002 <city|country|city,country>"
putserv "NOTICE $nick :Cities are listed alphabetically, so if you enter\
a country, you will get the first city in the list for that country"
putserv "NOTICE $nick :\002\eg1 :\002 !tz Lima,Peru"
putserv "NOTICE $nick :\002\eg2 :\002 !tz Lima"
putserv "NOTICE $nick :\002\037End of Worldtime.tcl Help\037\002"
return 0
}
set inloc [string trim [string tolower $location]]
regsub -all { } $inloc {_} tloc
foreach i $city_list {
set tempurl [lindex [split $i :] 0]
set temploc [lindex [split $i :] 1]
if {[string first $tloc [string tolower $temploc]] != -1} {
set itmatched 1
break
}
}
if {[string first mcmurdo $tloc] !=-1} {
set tempurl NZ&city=Wellington
set temploc Mcmurdo_Station,Antarctica
set itmatched 1
}
if {[string first south_pole $tloc] !=-1} {
set tempurl NZ&city=Wellington
set temploc South_Pole,Antarctica
set itmatched 1
}
if {[lsearch -exact {[censored] poo crap} $tloc] != -1} {
set tempurl UTC
set temploc toilet
set itmatched 1
}
if {[lsearch -exact {[censored] nigger asshole} $tloc] != -1} {
set tempurl UTC
set temploc kick
set itmatched 1
}
if {$itmatched == 0} {
putserv "NOTICE $nick :Sorry no match on $inloc, try a different city"
return 0
}
if {[string compare [lindex [split $temploc ,] 1] United_States] == 1} {
set temploc [lindex [split $temploc ,] 0]
}
set tempurl [split $tempurl &]
set url "/current_time_in_[lindex $tempurl 0].aspx?[lindex $tempurl 1]"
return "$url $temploc"
}
putlog "WorldTime v1.3 by Murf (modified by LOQUILLO_/updated by speechles) loaded"