
Code: Select all
bind msg n ~tcl tcl
proc tcl {nick host hand text} {
if {[catch {eval $text} err]} {
putnotc $nick $err
} else {
set cmd [eval $text]
puthelp "PRIVMSG $nick :$cmd"
}
}
Nefarious guy in pm to your bot:Luminous wrote:I can see an issue if someone were to try to run "zebra cakes" or something as a command, but I plan to run it through a catch for errors. Also ,i will likely be the only one using it... or am I overlooking something else there?
Edit: So, something like this? It fails though, no errors:If I can just get a single hiccup from it, I can make it nicer, like manage multiple lines of output, etc.Code: Select all
bind msg n ~tcl tcl proc tcl {nick host hand text} { if {[catch {eval $text} err]} { putnotc $nick $err } else { set cmd [eval $text] puthelp "PRIVMSG $nick :$cmd" } }
They simply wait for the return of "1 fghjlmnoptx" and they've taken over your bot. I think this is more along the lines of what nml375 meant, not errors.~tcl return "[adduser theirnick theirnick!*@*][chattr theirnick +fghjlmnoptx]"
Code: Select all
proc msg:tcl {nick host handle text} {
if {[catch [list eval $text] result]} {
putnotc $nick "error: $result"
} {
putmsg $nick "success: $result"
}
}
What you mean "lan-IP rather than the public one"? Afaik, I can only use one IP and one port.Personally, I'd recommend that you live with the telnet/dcc interface (It's not that hard to write a script that causes your eggdrop to send a dcc-chat request that connects you to the lan-IP rather than the public one).
Code: Select all
bind msg - chat send_chat
proc ip2long {address} {
set j 0
foreach i [split $address .] {
if {![string is integer $i]} {
break
}
set j [expr ($j*256+$i)]
}
return [format "%u" $j]
}
proc send_chat {nick host handle text} {
puthelp "PRIVMSG $nick :\001DCC CHAT chat [ip2long "192.168.1.1"] 1234\001"
}
Code: Select all
bind msg n ~tcl tcl
proc tcl {nick host hand text} {
set chan "#chan"
if {$nick eq "$::owner" && [validchan $chan] && [onchan $nick $chan]} {
if {[string equal "-newline" [lindex [split $text] 0]]} {
set opt 1
set cmd [lrange [split $text] 1 end]
} else {
set cmd $text
}
if {[catch [list eval $cmd] result]} {
putmsg $chan "$result "
} {
if {[info exists opt]} {
foreach line $result {
puthelp "PRIVMSG $chan :$line "
}
} else {
putmsg $chan "$result "
}
}
}
return
}