This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

[SOLVED] Date | time | Unix time

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
Arnold_X-P
Master
Posts: 243
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

thanks heartbroken, thank you again
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
networks: DALnet #tcls ChatZona #tcl Libera.Chat #tcls
User avatar
bayo
Voice
Posts: 15
Joined: Tue Jan 25, 2022 4:14 pm
Location: Bulgaria
Contact:

Post by bayo »

Hi, when I try to add it to my bot and chanset it it shows:

[18:27:25] <BAYO> .chanset #Forbidden +wtime
[18:27:25] <ec|ipse> Error trying to set +wtime for #Forbidden, invalid mode.

Any help? :oops:
User avatar
CrazyCat
Revered One
Posts: 1347
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Which of the scripts in the thread do you try ?
The functionnal one is from heartbroken @ 14/11/2021 16:28
B
Bosco
Voice
Posts: 9
Joined: Mon Oct 31, 2022 10:57 pm

Post by Bosco »

<03@Freebsd> Connection failor! Unsupported URL type "https" <--- work but this thing spawn every time check .t


<03@Freebsd> 04 »04 North America »04 Canada »04 Ontario »04 London : Current local time: 7:53:53 pm Date: Wednesday 1 March 2023 Time zone: EST (Eastern Standard Time) Current time zone offset: -05:00 hours
<03@Freebsd> NOW: EST Eastern Standard Time 06 Nov 2022 Sunday 06 Nov 2022 at 1:00:00 am local time to 12 Mar 2023 Sunday 12 Mar 2023 at 2:00:00 am local time, the time changes to 3:00:00 am Offset: UTC -5:00 DST ended on 06 Nov 2022, clocks moved back 1 hour; from 2:00:00 am to 1:00:00 am
User avatar
CrazyCat
Revered One
Posts: 1347
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

This is probably because the register https is started only when the script is loaded, and peharps you have another script which unregister it.
a
aut
Voice
Posts: 12
Joined: Wed Oct 25, 2023 6:14 am

Re: [SOLVED] Date | time | Unix time

Post by aut »

.t Karachi
15(@Caro15): 04 &raquo; Asia &raquo; &nbsp;&nbsp;Pakistan &raquo; Karachi : Current local time: 3:31:39 am Date: Wednesday 18 September 2024 Time zone: PKT (Pakistan Time) Current time zone offset: +05:00 hours
15(@Caro15): PKT Pakistan Time has been in effect since 2009 Offset: UTC +5:00

it gave me this %araquo
User avatar
CrazyCat
Revered One
Posts: 1347
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: [SOLVED] Date | time | Unix time

Post by CrazyCat »

Probably the site now uses html entities rather than direct chars.
Find the line:
regsub -all -- {»} $str \003\u00bb\00304 str
Just after, add:
set str [string map {"&raquo;" "\003\u00bb\00304"} $str]
I use string map because there are potentialy others chars which will need to be replaced, I think it's better to not have one regexp per char.
User avatar
Arnold_X-P
Master
Posts: 243
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Re: [SOLVED] Date | time | Unix time

Post by Arnold_X-P »

This TCL has stopped working, when I request it, it only shows me this
.t japan
No any information found for "japan"

It worked fine before, the data I requested came out, please someone help me

Code: Select all

package require http
package require tls 1.6.4

bind pub - .t worldntime

proc worldntime {nick uhost hand chan text} {
	if {![channel get $chan wtime]} { return 0 }
	if {![llength $text]} { puthelp "privmsg $chan :Usage: $::lastbind <location>"; return 0 }
	set TxT [YouGotTheSource https://translate.googleapis.com/translate_a/single?[http::formatQuery client gtx sl auto tl en dt t q $text]]
	if {[regexp -- {\"([^\"]+)\"} $TxT - transout]} { set query $transout } { set query $text }
	set data [YouGotTheSource http://localtimes.mobi/search/?[http::formatQuery s $query x 0 y 0]]
	if {[regexp -- {Home</a>(.+?)</span>.+?<div class="timeinfo">(.+?)</div>.+?<div class="tz_container">(.+?)</li>} $data - loc t1 t2]} {
		puthelp "privmsg $chan :\00304[cleanup $loc]\003: [cleanup $t1]"
		puthelp "privmsg $chan :[cleanup $t2]"
	} else { puthelp "privmsg $chan :No any information found for \"$text\". Please be more specific!"; return }
	return 0
}

proc cleanup str {
	regsub -all -- {(?:<label>|</label>)} $str \002 str
	regsub -all -- "<.+?>" $str " " str
	regsub -all -- {»} $str \003\u00bb\00304 str
	regsub -all -- { } $str { } str
	regsub -all -- {\s+} $str { } str
	set str [string map {"&raquo;" "\003\u00bb\00304"} $str]
	return $str
}

proc YouGotTheSource URL {
	if {[catch {set token [http::geturl $URL -timeout 9000]} error]} {
		set err "Connection failor! [string map {\n " "} $error]"
	} elseif {[http::status $token] ne "ok" || [http::ncode $token] != "200"} {
		set err "[http::status $token] - [http::code $token]"
		::http::cleanup $token
	} else {
		set data [http::data $token]
		::http::cleanup $token
	}
	if {[info exists data] && [string length $data]} {
		return $data
	}
	if {[info exists err] && [string length $err]} {
		foreach _ [channels] { if {[channel get $_ wtime]} { puthelp "privmsg $_ :$err" }}
	}
}

::http::register https 443 [list ::tls::socket -ssl2 0 -ssl3 0 -tls1 1]

setudef flag wtime
Apparently Google updated something internally, which is why the TCL no longer provides the requested information.
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
networks: DALnet #tcls ChatZona #tcl Libera.Chat #tcls
User avatar
CrazyCat
Revered One
Posts: 1347
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: [SOLVED] Date | time | Unix time

Post by CrazyCat »

Google's API works fine but localtimes.mobi is now a parked domain, so it can't return you the localtime of countries.
Post Reply