X-Git-Url: https://git.distorted.org.uk/~mdw/ircbot/blobdiff_plain/281f2c0e568eb3fac93173a3d0b852259e61245f..db9ac35693ae44df2335407b7d986c08cf366d88:/usebnbot.tcl?ds=inline diff --git a/usebnbot.tcl b/usebnbot.tcl index f7a1ed4..b164f12 100644 --- a/usebnbot.tcl +++ b/usebnbot.tcl @@ -18,13 +18,13 @@ proc bnbot__vars {} { } def_bnbot ensure_connecting {} { - global musthaveping_ms bnbot + global muststartby_ms bnbot if {[info exists bnchan]} return defset bnport 6112 set bnchan [open [list | $bnbot $bnhost $bnport] w+] fconfigure $bnchan -buffering line - set bnmbokafter [after $musthaveping_ms \ + set bnmbokafter [after $muststartby_ms \ "fail {bot $botid not ok within timeout}"] set bnstate Connected fileevent $bnchan readable [list bnbot_onread $botid] @@ -42,7 +42,7 @@ def_bnbot writemsg {str} { def_bnbot onread {args} { global channel - if {[gets $bnchan l] == -1} { fail "bot $bot EOF/error on input" } + if {[gets $bnchan l] == -1} { fail "bot $botid EOF/error on input" } if {[regexp {^1005 TALK ([^ ]+) \w+ \"(.*)\"$} $l dummy n text]} { sendprivmsg $channel "\[$n] $text" return @@ -69,7 +69,7 @@ def_bnbot onread {args} { } elseif {[regexp {^1007 CHANNEL "(.*)"} $l dummy bnchanfn]} { after cancel $bnmbokafter unset bnmbokafter - } elseif {![string length $bnstate]} { + } elseif {[info exists bnchanfn]} { bnbot_event $botid $l } }