egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pandorabot.tcl
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
willyw
Owner


Joined: 15 Jan 2009
Posts: 925

PostPosted: Wed Mar 15, 2017 1:06 pm    Post subject: Reply with quote

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 !
Back to top
View user's profile Send private message
Jonny12
Voice


Joined: 28 Jun 2012
Posts: 9

PostPosted: Wed Mar 15, 2017 3:36 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 925

PostPosted: Wed Mar 15, 2017 4:00 pm    Post subject: Reply with quote

Jonny12 wrote:
Well, the website seems to be back up, but I am still



Still ?

Quote:

getting the 301 Moved Permanently message.


Had you mentioned this one before?

Quote:

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 !
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 925

PostPosted: Wed Mar 15, 2017 4:08 pm    Post subject: Reply with quote

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 !
Back to top
View user's profile Send private message
Jonny12
Voice


Joined: 28 Jun 2012
Posts: 9

PostPosted: Wed Mar 15, 2017 5:08 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Anahel
Halfop


Joined: 03 Jul 2009
Posts: 48
Location: Dom!

PostPosted: Wed Mar 15, 2017 7:05 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Jonny12
Voice


Joined: 28 Jun 2012
Posts: 9

PostPosted: Wed Mar 15, 2017 7:24 pm    Post subject: Reply with quote

That might be it, Anahel.

Unfortunately, I have no idea how to fix that.
Back to top
View user's profile Send private message
heartbroken
Halfop


Joined: 23 Jun 2011
Posts: 72
Location: somewhere out there

PostPosted: Wed Mar 15, 2017 8:35 pm    Post subject: Reply with quote

Code:
#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
Back to top
View user's profile Send private message
Jonny12
Voice


Joined: 28 Jun 2012
Posts: 9

PostPosted: Wed Mar 15, 2017 8:50 pm    Post subject: Reply with quote

Very nice, heartbroken

Works like a charm. Thanks!
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 925

PostPosted: Wed Mar 15, 2017 9:39 pm    Post subject: Reply with quote

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-0-1-alice-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 !
Back to top
View user's profile Send private message
heartbroken
Halfop


Joined: 23 Jun 2011
Posts: 72
Location: somewhere out there

PostPosted: Thu Mar 16, 2017 12:35 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Settore
Voice


Joined: 05 Mar 2017
Posts: 7

PostPosted: Thu Mar 16, 2017 10:13 am    Post subject: Same story today also Reply with quote

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.
Back to top
View user's profile Send private message
heartbroken
Halfop


Joined: 23 Jun 2011
Posts: 72
Location: somewhere out there

PostPosted: Thu Mar 16, 2017 10:41 am    Post subject: Reply with quote

Well , nothings wrong from pandorabots side.

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


Code:
# 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
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 925

PostPosted: Thu Mar 16, 2017 2:41 pm    Post subject: Reply with quote

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. Smile )

Quote:

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.

Quote:

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:

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.
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !


Last edited by willyw on Thu Mar 16, 2017 4:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
Settore
Voice


Joined: 05 Mar 2017
Posts: 7

PostPosted: Thu Mar 16, 2017 2:53 pm    Post subject: $token error Reply with quote

Hello again.

All went fine untill now... Smile

Now shows up the error:
Code:
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:
#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
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber