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.

Pandorabot.tcl

Support & discussion of released scripts, and announcements of new releases.
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Jonny12 wrote:Thanks willyw,
At least I know it's not just me. I tried emailing them. I'll let you know if I find anything out.
Very nice.
Thank you.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
J
Jonny12
Voice
Posts: 9
Joined: Thu Jun 28, 2012 7:57 pm

Post by Jonny12 »

Well, the website seems to be back up, but I am still getting the 301 Moved Permanently message. Is your bot working in IRC, willyw?

Thanks to all who are helping.
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Jonny12 wrote:Well, the website seems to be back up, but I am still
Still ?
getting the 301 Moved Permanently message.
Had you mentioned this one before?
Is your bot working in IRC, willyw?
Yes. It's in the channel in my signature.
I haven't checked to see if alice started working again though. (I doubt it has).
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Jonny12 wrote:Well, the website seems to be back up...

I find:
http://www.pandorabots.com/botmaster/en/new-account
is back up.

Using web browser, I can log into my pandorabot, and it works.
Does not work, with alice.tcl and eggdrop.

So... it's back to where it has been, for a while now.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
J
Jonny12
Voice
Posts: 9
Joined: Thu Jun 28, 2012 7:57 pm

Post by Jonny12 »

I heard back from pandorabots and as you found, the service is back up.
But, I still get that 301 Moved Permanently error.

I asked them if they could think of any reason on their end that would cause that message. I'll let you know what I find out.

Btw, not that this matters, but ...

I don't know why I am signed up with the Jonny12 nick, but my chat nick is Koach.

Talk to you soon, I am sure.
User avatar
Anahel
Halfop
Posts: 48
Joined: Fri Jul 03, 2009 6:18 pm
Location: Dom!

Post by Anahel »

Jonny12 wrote: But, I still get that 301 Moved Permanently error.
i think that is because site is switching to secure https:// from insecure http:// - and that is why script fails
J
Jonny12
Voice
Posts: 9
Joined: Thu Jun 28, 2012 7:57 pm

Post by Jonny12 »

That might be it, Anahel.

Unfortunately, I have no idea how to fix that.
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

Post by heartbroken »

Code: Select all

#Bot's Nickname to Respond to: ex. MyBot - Usage: MyBot, what's 1+1?
set pandoraNick "MyBot"

#Your Pandora Bot ID. (Feel free to use the existing one if you want, but the bot will think its name is AlphaBot
set botid "a5cd504e4e342614"

#STOP EDITING HERE

package require http
if {[catch {package require tls 1.6}]} {
	putcmdlog "https links requires tcltls : https://core.tcl.tk/tcltls/wiki/Download"
	set enabletls 0
} else {
	set enabletls 1
	tls::init -ssl3 0 -ssl2 0 -tls1 1
	http::register https 443 [list ::tls::socket -require 0 -request 1]
}

bind pubm - "% ${pandoraNick}*" talkto

proc talkto {n u h c t} {
	set query [::http::formatQuery botid $::botid custid $n input [join [lrange [split $t] 1 end]]]
	if {[catch {set token [::http::geturl https://pandorabots.com/pandora/talk-xml -query $query -timeout 16000]} error]} {
		putlog "[string map [list \n " ,"] $error] ,[::http::status $token]"
		::http::cleanup $token
	}
	if {[string match -nocase "timeout" [::http::status $token]]} {
		putlog "[::http::code $token]"
		::http::cleanup $token
	}
	if {![string equal -nocase [::http::status $token] "ok"]} {
		putlog "[::http::code $token] ,[::http::status $token]"
		::http::cleanup $token
	}
	if {[::http::ncode $token] == "200" && [string equal -nocase [::http::status $token] "ok"]} {
		set pandata [::http::data $token]
		::http::cleanup $token
	}
	if {![regexp {<that>(.*?)</that>} $pandata -> responce]} {
		putlog "This regex sucks!!! Source codes changed or what?!?"
		return
	} else {
		puthelp "privmsg $c :$responce"
	}
	return 0
}
You need to have tcltls for https links. https://core.tcl.tk/tcltls/wiki/Download , http://wiki.tcl.tk/2630
Life iS Just a dReaM oN tHE wAy to DeaTh
J
Jonny12
Voice
Posts: 9
Joined: Thu Jun 28, 2012 7:57 pm

Post by Jonny12 »

Very nice, heartbroken

Works like a charm. Thanks!
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

heartbroken wrote: ...
You need to have tcltls for https links. https://core.tcl.tk/tcltls/wiki/Download , http://wiki.tcl.tk/2630

If you would be so kind, have a look at the alice.tcl script :
http://www.egghelp.org/tclhtml/3478-4-0 ... ce-tcl.htm

and let us know if it repairable or not.

I'm not much good with doctoring on scripts that fetch from the web in the first place, but as soon as you see how they wrote alice.tcl - I'm suspecting that it cannot be fixed, and it is not something that I can say definitively.

Thanks.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

Post by heartbroken »

Could you test this : http://paste.tclhelp.net/?id=6cfb
Replace it with your own settings.
and change http://www.pandorabots... links to https

pandorabots urls redirecting http to https now and i couldn't see any lines about to check this redirected links and callback to 'new url' in the script.

so it's probably better to set https://... instead.

He is using his own http (egghttp.tcl) script to get data and i didn't read this script yet.
( 07 AM in the morning here now. ) so I don't know how he was manage to get these done.


it was an obfuscated script and when i unobfuscate it ,i have to fix the lines again, because it was crash the bot. it took some time to fix the lines.
You can try now.
Life iS Just a dReaM oN tHE wAy to DeaTh
S
Settore
Voice
Posts: 8
Joined: Sun Mar 05, 2017 4:55 am

Same story today also

Post by Settore »

Jonny12 wrote:Thanks willyw,
At least I know it's not just me. I tried emailing them. I'll let you know if I find anything out.
It seems the pandorabots.com website changed something/some code/somewhere and the TCL script can't fetch the reply.


If any good TCL developer is reading this, we would thank you a lot if you do find a fix for this.


Thank you from all the pandorabots/alice.tcl users.
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

Post by heartbroken »

Well , nothings wrong from pandorabots side.

You can make your own tests with a simple snippet like this:

Code: Select all

# what you wanna say ?
set saysmth "Do You Love me ?" 
package require http
package require tls
tls::init -ssl3 0 -ssl2 0 -tls1 1
http::register https 443 [list ::tls::socket -require 0 -request 1]
set url "https://www.pandorabots.com/pandora/talk?botid=f5d922d97e345aa1&skin=custom_input"
set token [::http::geturl $url -query [http::formatQuery input $saysmth] -timeout 16000]
upvar #0 $token state
puts "state array got these: \n [parray state]"
set data [::http::data $token]
::http::cleanup $token
regexp {<em>[^:]*:([^<]*)</em>.+<b>([^:]*):<em>([^<]*)</em>} $data - me bot botalk
puts "without cookie: human says: $me || botname: $bot || bot response: $botalk"
I've used default alice_url pandorabots link in script ,you can replace it with your own botID link. and make your own test in tclsh / wish etc.
Life iS Just a dReaM oN tHE wAy to DeaTh
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Thank you for taking time to look into it.

heartbroken wrote:Could you test this : http://paste.tclhelp.net/?id=6cfb
Replace it with your own settings.
and change http://www.pandorabots... links to https
Done.
Sorry.. still no response.

( There was one missing closing curly brace. The crash message told me where to look, and I think I found it. Added one } and started bot again. :) )
it was an obfuscated script
That's why I thought it might be impossible to fix it.
Once upon a time, I read about how to un-do that, but I can't find it now.
and when i unobfuscate it ,i have to fix the lines again, because it was crash the bot. it took some time to fix the lines.
You can try now.
Could there be other packages that need to be loaded?

I saw something about tls in other posts here.
For what it is worth, here is some info:

Code: Select all

dpkg -l *tls* |grep ii

ii  tcl-tls                                                    1.5.0.dfsg-10build1           the TLS OpenSSL extension to Tcl
That's what is apparently installed on that shell.


Edit:
Look for another post here.
I've spent some time with it, and have more info for you.
Last edited by willyw on Thu Mar 16, 2017 4:20 pm, edited 1 time in total.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
S
Settore
Voice
Posts: 8
Joined: Sun Mar 05, 2017 4:55 am

$token error

Post by Settore »

Hello again.

All went fine untill now... :)

Now shows up the error:

Code: Select all

Tcl error [talkto]: can't read "token": no such variable
Using eggdrop 1.8.0 / OpenSSL 1.0.2k 26 Jan 2017

Code used:

Code: Select all

#Bot's Nickname to Respond to: ex. MyBot - Usage: MyBot, what's 1+1?
set pandoraNick "AI"

#Your Pandora Bot ID. (Feel free to use the existing one if you want, but the bot will think its name is AlphaBot
set botid "f60ea9654e345adb"

#STOP EDITING HERE

package require http
if {[catch {package require tls 1.6}]} {
   putcmdlog "https links requires tcltls : https://core.tcl.tk/tcltls/wiki/Download"
   set enabletls 0
} else {
   set enabletls 1
   tls::init -ssl3 0 -ssl2 0 -tls1 1
   http::register https 443 [list ::tls::socket -require 0 -request 1]
}

bind pubm - "% ${pandoraNick}*" talkto

proc talkto {n u h c t} {
   set query [::http::formatQuery botid $::botid custid $n input [join [lrange [split $t] 1 end]]]
   if {[catch {set token [::http::geturl https://pandorabots.com/pandora/talk-xml -query $query -timeout 16000]} error]} {
      putlog "[string map [list \n " ,"] $error] ,[::http::status $token]"
      ::http::cleanup $token
   }
   if {[string match -nocase "timeout" [::http::status $token]]} {
      putlog "[::http::code $token]"
      ::http::cleanup $token
   }
   if {![string equal -nocase [::http::status $token] "ok"]} {
      putlog "[::http::code $token] ,[::http::status $token]"
      ::http::cleanup $token
   }
   if {[::http::ncode $token] == "200" && [string equal -nocase [::http::status $token] "ok"]} {
      set pandata [::http::data $token]
      ::http::cleanup $token
   }
   if {![regexp {<that>(.*?)</that>} $pandata -> responce]} {
      putlog "This regex sucks!!! Source codes changed or what?!?"
      return
   } else {
      puthelp "privmsg $c :$responce"
   }
   return 0
}
Post Reply