View previous topic :: View next topic |
Author |
Message |
Koach Voice
Joined: 19 Apr 2009 Posts: 21
|
Posted: Mon Mar 27, 2017 10:50 pm Post subject: |
|
|
heartbroken,
I wonder if you have any idea why this happens. Periodically, the bot will just hang and stop responding. The error message I get in the party line is:
couldn't open socket: Name or service not known ,error
The bot isn't hanging in any other way, just in talking via pandorabots.
Thanks.
Koach |
|
Back to top |
|
 |
heartbroken Halfop

Joined: 23 Jun 2011 Posts: 98 Location: somewhere out there
|
Posted: Tue Mar 28, 2017 1:31 pm Post subject: |
|
|
I am not regularly using any AI scripts. I am only testing when needed to see whats wrong . and i still didn't get any error from this while my tests.
I assume, your bot/shell sometimes having an issue to resolve dns address of this pandorabots link.
Anyway I've just changed the script little bit and added somethings to handle this "couldn't open socket*" error.
now if that happen once again ; it will try to get ip of the host and callback with host's ip instead until got a real response from them.
I have tested in my home PC with tclsh.
Whatever , here is the 'new' code:
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"
# enable chat in bot pm : 1 ,disable : 0 or ""
set botpm 1
# user must wait xx seconds between messages to get a response from bot.
set chatstop 10
#STOP EDITING HERE
package require http 2.5
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]
}
# .chanset #channel +talk
setudef flag talk
bind pubm - "*" talkto_pub
bind msgm - "*" talkto_pvt
proc talkto_pub {nick uhost hand chan text} {
if {![channel get $chan talk] || ([expr {[lsearch -nocase [fix_chars $text] $::pandoraNick*]}] == "-1")} { return 0 }
talkto $nick $uhost $hand $chan $text
}
proc talkto_pvt {nick uhost hand text} {
if {[expr {[lsearch -nocase [fix_chars $text] $::pandoraNick*]}] == "-1"} { return 0 }
if {[string length $::botpm] && $::botpm >= "1"} {
talkto $nick $uhost $hand $nick $text
}
return 0
}
proc talkto {nick uhost hand chan text} {
if {[info exists ::flooder($nick)] && [expr {$::flooder($nick) + $::chatstop}] > [clock seconds]} { return 0 }
regsub -all -nocase $::pandoraNick [fix_chars $text] {} TxT
puthelp "privmsg $chan :$nick: [fetch_pandora https://pandorabots.com/pandora/talk-xml $nick $TxT]"
set ::flooder($nick) [clock seconds]
return 0
}
proc fetch_pandora {pandurl who {str ""}} {
set ua "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5"
set token [::http::config -useragent $ua -urlencoding "utf-8"]
set query [::http::formatQuery botid $::botid custid $who input $str]
catch {set token [::http::geturl $pandurl -query $query -timeout 16000]} err
if {[string match -nocase "*open socket*" $err]} {
catch { eval exec host pandorabots.com } res
if {[regexp {(?i)address\s(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})} $res -> pandip]} {
fetch_pandora https://$pandip/pandora/talk-xml $who $str
} else {
fetch_pandora $pandurl $who $str
}
putlog "[string map [list \n " ,"] $err] ,[::http::status $token]"
::http::cleanup $token
} elseif {[string match -nocase "timeout" [::http::status $token]]} {
putlog "[::http::code $token]"
fetch_pandora $pandurl $who $str
::http::cleanup $token
} elseif {![string equal -nocase [::http::status $token] "ok"]} {
putlog "[::http::code $token] ,[::http::status $token]"
::http::cleanup $token
} elseif {[::http::ncode $token] == "200" && [string equal -nocase [::http::status $token] "ok"]} {
set pandata [::http::data $token]
::http::cleanup $token
} else {
putlog "Error: [string map [list \n " ,"] $err]"
fetch_pandora $pandurl $who $str
::http::cleanup $token
}
if {[info exists pandata] && [llength $pandata]} {
if {![regexp {<that>(.*?)</that>} $pandata -> responce]} {
return -code error "This regex sucks!!! Source codes changed or what?!?"
} else {
return [fix_talk $responce]
}
}
}
proc fix_chars {txt} {
return [string map {\\ \\\\ [ \\\[ ] \\\] \{ \\\{ \} \\\} \$ \\\$ \" \\\"} $txt]
}
proc fix_talk {str} {
return [string map {" " " " "&" {\&} """ "\'" "©" "(c)"\
"&#" "#" "<" "<" ">" ">" "%20" " "} $str]
} |
_________________ Life iS Just a dReaM oN tHE wAy to DeaTh |
|
Back to top |
|
 |
Koach Voice
Joined: 19 Apr 2009 Posts: 21
|
Posted: Tue Mar 28, 2017 4:16 pm Post subject: |
|
|
Thanks once again, heartbroken.
I am still still having problems with fovea, the bot I have been asking about.
Here is an example in the channel.
[14:06] <Koach> hi fovea
[14:07] <Fovea> Koach:
and partyline:
<Fovea> [16:10:50] couldn't open socket: Name or service not known ,error
So I tested another eggdrop I have online, running on the same server, using the script you posted just before your last fixes, and it seems to be working fine.
So, it seems the problem is with Fovea. I will recompile the bot, make sure everything else is correct, and try again.
I will post here what I find out in case others have the same problem.
Thanks again. By now you have probably pulled all your hair out, and banged your head on your keyboard several times lol
I appreciate your patience and help more than you can imagine.
Koach |
|
Back to top |
|
 |
Koach Voice
Joined: 19 Apr 2009 Posts: 21
|
Posted: Tue Mar 28, 2017 11:14 pm Post subject: |
|
|
heartbroken,
It seems the problem was the bot. I recompiled, from 1.8.0 to 1.8.1, went through the conf line by line, making some minor changes, but nothing that should have affected anything.
But, when i was done, everything works beautifully. Thanks again for all your time and work.
Koach |
|
Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1116
|
Posted: Sun Apr 02, 2017 12:32 pm Post subject: |
|
|
heartbroken :
Have you had an opportunity to look into the alice script any more, yet?
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 |
|
 |
anotherrace Voice
Joined: 14 May 2014 Posts: 17
|
Posted: Mon Apr 10, 2017 1:23 am Post subject: |
|
|
I've been using my alice.tcl on Dalnet for a long time now, and all of a sudden it stopped working. This is my script :
geocities.ws/zakforradio/alice2.txt
But pandorabots seems to be working fine
https://www.pandorabots.com/pandora/talk?botid=fca65e917e343663
I'm getting the error message:
Tcl error [alice:msg_query]: invalid command name "egghttp:geturl"
I don't know whats wrong, please help |
|
Back to top |
|
 |
Koach Voice
Joined: 19 Apr 2009 Posts: 21
|
Posted: Sun Mar 18, 2018 3:54 pm Post subject: |
|
|
anotherrace, I realize it's been almost a year since you posted your question, but if you would like, I can post the script that I am using. Sorry I didn't see this sooner.
Koach |
|
Back to top |
|
 |
AllMassive Voice
Joined: 09 Aug 2008 Posts: 2
|
Posted: Thu Apr 05, 2018 9:34 pm Post subject: |
|
|
Why you even ask :/
Yes - pls post your working Version. |
|
Back to top |
|
 |
Koach Voice
Joined: 19 Apr 2009 Posts: 21
|
Posted: Wed Apr 25, 2018 9:13 pm Post subject: |
|
|
I hope this pastes ok.
Code: |
######################################################################
# Script to create an AI bot for a chat room.
# Uses https://www.pandorabots.com/botmaster/en/home for the AI brain
# Written by heartbroken
# version 2.4.1
# Written/edited by Branson
# version 2.4.3
# More info about the script: http://forum.egghelp.org/viewtopic.php?t=19887&start=45
# 12-26-2107 edited/repaired by Branson
# If you need help or have questions,
# go to #koachsworkshop on chat.koach.com and ask for koach
#####################################################################
# Bot's Nickname to Respond to: ex. Gazer, what's 1+1?
set pandoraNick "Fovea"
# Your Pandora Bot ID. (Feel free to use the existing one if you want,
# but the bot will think it is fovea.
# pandorabots.com will give you a link like this with the botid
# https://www.pandorabots.com/pandora/talk?botid=fba0b9735e362e4d
set botid "fba0b9735e362e4d"
# enable chat in bot pm : 1 ,disable : 0 or ""
set botpm 1
# user must wait X seconds between messages sent to bot.
set chatstop 1
# .chanset #channel +talk - Turn tells bot to chat in #channel
setudef flag talk
bind pubm - "*" talkto_pub
bind msgm - "*" talkto_pvt
#STOP EDITING HERE
package require http 2.5
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]
}
proc talkto_pub {nick uhost hand chan text} {
if {![channel get $chan talk] || ([expr {[lsearch -nocase [fix_chars $text] $::pandoraNick*]}] == "-1")} { return 0 }
talkto $nick $uhost $hand $chan $text
}
proc talkto_pvt {nick uhost hand text} {
if {[expr {[lsearch -nocase [fix_chars $text] $::pandoraNick*]}] == "-1"} { return 0 }
if {[string length $::botpm] && $::botpm >= "1"} {
talkto $nick $uhost $hand $nick $text
}
return 0
}
proc talkto {nick uhost hand chan text} {
if {[info exists ::flooder($nick)] && [expr {$::flooder($nick) + $::chatstop}] > [clock seconds]} { return 0 }
regsub -all -nocase $::pandoraNick [fix_chars $text] {} TxT
set TxTx [string map { " " "+" "?" " " } $TxT];
puthelp "privmsg $chan :$nick: [fetch_pandora https://pandorabots.com/pandora/talk-xml?botid=fc05baafee345e53&custid=0&input=$TxTx]"
set ::flooder($nick) [clock seconds]
return 0
}
proc fetch_pandora {pandurl} {
set pandata [exec curl -sSL $pandurl]
if {[info exists pandata] && [llength $pandata]} {
if {![regexp {<that>(.*?)</that>} $pandata -> responce]} {
return -code error "This regex sucks!!! Source codes changed or what?!?"
} else {
return [fix_talk $responce]
}
}
}
proc fix_chars {txt} {
return [string trim $txt "?"]
}
proc fix_talk {str} {
return [string map {" " " " "&" {\&} """ "\'" "©" "(c)" "&#" "#" "<" "<" ">" ">" "%20" " "} $str]
}
putlog "Loaded pandora.2.4.3.tcl"
|
|
|
Back to top |
|
 |
Merky Voice
Joined: 21 Jan 2007 Posts: 17
|
Posted: Thu Apr 26, 2018 1:47 am Post subject: |
|
|
error
Code: |
Tcl error [talkto_pub]: This regex sucks!!! Source codes changed or what?!?
This regex sucks!!! Source codes changed or what?!?
while executing
"fetch_pandora https://pandorabots.com/pandora/talk-xml?botid=fba0b9735e362e4d&custid=0&input=$TxTx"
(procedure "talkto" line 8)
invoked from within
"talkto $nick $uhost $hand $chan $text "
(procedure "talkto_pub" line 3)
invoked from within
"talkto_pub $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5"
|
|
|
Back to top |
|
 |
Koach Voice
Joined: 19 Apr 2009 Posts: 21
|
Posted: Thu Apr 26, 2018 11:09 pm Post subject: |
|
|
ok, let's try this again:
Code: |
####################################################################### Script to create an AI bot for a chat room.
# Uses https://www.pandorabots.com/botmaster/en/home for the AI brain
# Written by heartbroken
# version 2.4.3
# More info about the script: http://forum.egghelp.org/viewtopic.php?t=19887&start=45
# 12-26-2107 edited/repaired by Branson
# If you need help or have questions,
# go to #koachsworkshop on chat.koach.com and ask for koach
#####################################################################
# Bot's Nickname to Respond to: ex. Fovea, what's 1+1?
set pandoraNick "Fovea"
#Your Pandora Bot ID. (Feel free to use the existing one if you want,
# but the bot will think it is fovea.
# pandorabots.com will give you a link like this with the botid
# https://www.pandorabots.com/pandora/talk?botid=fba0b9735e362e4d
set botid "fba0b9735e362e4d"
# enable chat in bot pm : 1 ,disable : 0 or ""
set botpm 1
# user must wait X seconds between messages sent to bot.
set chatstop 1
# .chanset #channel +talk - Turn tells bot to chat in #channel
setudef flag talk
bind pubm - "*" talkto_pub
bind msgm - "*" talkto_pvt
#STOP EDITING HERE
package require http 2.5
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]
}
proc talkto_pub {nick uhost hand chan text} {
if {![channel get $chan talk] || ([expr {[lsearch -nocase [fix_chars $text] $::pandoraNick*]}] == "-1")} { return 0 }
talkto $nick $uhost $hand $chan $text
}
proc talkto_pvt {nick uhost hand text} {
if {[expr {[lsearch -nocase [fix_chars $text] $::pandoraNick*]}] == "-1"} { return 0 }
if {[string length $::botpm] && $::botpm >= "1"} {
talkto $nick $uhost $hand $nick $text
}
return 0
}
proc talkto {nick uhost hand chan text} {
global botid
if {[info exists ::flooder($nick)] && [expr {$::flooder($nick) + $::chatstop}] > [clock seconds]} { return 0 }
regsub -all -nocase $::pandoraNick [fix_chars $text] {} TxT
set TxTx [string map { " " "+" "?" " " } $TxT];
puthelp "privmsg $chan :$nick: [fetch_pandora https://pandorabots.com/pandora/talk-xml?botid=$botid&custid=0&input=$TxTx]"
set ::flooder($nick) [clock seconds]
return 0
}
proc fetch_pandora {pandurl} {
set pandata [exec curl -sSL $pandurl]
if {[info exists pandata] && [llength $pandata]} {
if {![regexp {<that>(.*?)</that>} $pandata -> responce]} {
return -code error "This regex sucks!!! Source codes changed or what?!?"
} else {
return [fix_talk $responce]
}
}
}
proc fix_chars {txt} {
return [string trim $txt "?"]
}
proc fix_talk {str} {
return [string map {" " " " "&" {\&} """ "\'" "©" "(c)" "&#" "#" "<" "<" ">" ">" "%20" " "} $str]
}
putlog "Loaded pandora.2.4.4.tcl"
|
|
|
Back to top |
|
 |
Koach Voice
Joined: 19 Apr 2009 Posts: 21
|
Posted: Thu Apr 26, 2018 11:23 pm Post subject: |
|
|
The last code I pasted still has a problem. If you put a unmatched bracket, the bot will not respond and will show the error in the party line.
Like this, for example: fovea, what is your name?]
You'll see this error in party line:
Tcl error [talkto_pub]: curl: (3) [globbing] unmatched close brace/bracket in column 105
I am too tired to fix it tonight, but I will look at it tomorrow. If anyone else wants to fix it, feel free.
Koach |
|
Back to top |
|
 |
Koach Voice
Joined: 19 Apr 2009 Posts: 21
|
Posted: Fri Apr 27, 2018 6:46 pm Post subject: |
|
|
I think this works now (crosses fingers)
I am sure parts of this script might be written better. So, to all TCL experts (and non experts), please feel free to give me constructive criticism.
Code: |
####################################################################### Script to create an AI bot for a chat room.
# Uses https://www.pandorabots.com/botmaster/en/home for the AI brain
# Written by heartbroken
# version 2.4.3
# More info about the script: http://forum.egghelp.org/viewtopic.php?t=19887&start=45
# 12-26-2107, 4/27/2018 edited/repaired by Branson
# If you need help or have questions,
# go to #koachsworkshop on chat.koach.com and ask for koach
#####################################################################
# Bot's Nickname to Respond to: ex. Fovea, what's 1+1?
set pandoraNick "Fovea"
#Your Pandora Bot ID. (Feel free to use the existing one if you want,
# but the bot will think it is fovea.
# pandorabots.com will give you a link like this with the botid
# https://www.pandorabots.com/pandora/talk?botid=fba0b9735e362e4d
set botid "fba0b9735e362e4d"
# enable chat in bot pm : 1 ,disable : 0 or ""
set botpm 1
# user must wait X seconds between messages sent to bot.
set chatstop 1
# .chanset #channel +talk - Turn tells bot to chat in #channel
setudef flag talk
bind pubm - "*" talkto_pub
bind msgm - "*" talkto_pvt
#STOP EDITING HERE
package require http 2.5
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]
}
proc talkto_pub {nick uhost hand chan text} {
if {![channel get $chan talk] || ([expr {[lsearch -nocase [fix_chars $text] $::pandoraNick*]}] == "-1")} { return 0 }
talkto $nick $uhost $hand $chan $text
}
proc talkto_pvt {nick uhost hand text} {
if {[expr {[lsearch -nocase [fix_chars $text] $::pandoraNick*]}] == "-1"} { return 0 }
if {[string length $::botpm] && $::botpm >= "1"} {
talkto $nick $uhost $hand $nick $text
}
return 0
}
proc talkto {nick uhost hand chan text} {
global botid
if {[info exists ::flooder($nick)] && [expr {$::flooder($nick) + $::chatstop}] > [clock seconds]} { return 0 }
regsub -all -nocase $::pandoraNick [fix_chars $text] {} TxT
set TxTx [string map { " " "+" "?" "+" "]" "+" "[" "+" "{" "+" "}" "+" } $TxT];
puthelp "privmsg $chan :$nick: [fetch_pandora https://pandorabots.com/pandora/talk-xml?botid=$botid&custid=0&input=$TxTx]"
set ::flooder($nick) [clock seconds]
return 0
}
proc fetch_pandora {pandurl} {
set pandata [exec curl -sSL $pandurl]
if {[info exists pandata] && [llength $pandata]} {
if {![regexp {<that>(.*?)</that>} $pandata -> responce]} {
return -code error "This regex sucks!!! Source codes changed or what?!?"
} else {
return [fix_talk $responce]
}
}
}
proc fix_chars {txt} {
return [string trim $txt "?"]
}
proc fix_talk {str} {
return [string map {" " " " "&" {\&} """ "\'" "©" "(c)" "&#" "#" "<" "<" ">" ">" "%20" " "} $str]
}
putlog "Loaded pandora.2.4.4.tcl"
|
|
|
Back to top |
|
 |
Merky Voice
Joined: 21 Jan 2007 Posts: 17
|
Posted: Fri May 11, 2018 10:17 am Post subject: |
|
|
Error bro
Code: | [21:15:41] Tcl error [talkto_pub]: This regex sucks!!! Source codes changed or what?!?
This regex sucks!!! Source codes changed or what?!?
while executing
"fetch_pandora https://pandorabots.com/pandora/talk-xml?botid=$botid&custid=0&input=$TxTx"
(procedure "talkto" line 7)
invoked from within
"talkto $nick $uhost $hand $chan $text "
(procedure "talkto_pub" line 3)
invoked from within
"talkto_pub $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5"
|
|
|
Back to top |
|
 |
Koach Voice
Joined: 19 Apr 2009 Posts: 21
|
Posted: Tue May 15, 2018 4:12 pm Post subject: |
|
|
Hi Merky,
I can't duplicate your error. What did you type when you received the error?
Although I didn't write this script, I can probably get it fixed, and any info you can provide will help.
Thanks,
Koach |
|
Back to top |
|
 |
|