on *:sockopen:bot.*:{ $sw $sockname user $r(1111111,9999999) T F $+(:,$tag) $sw $sockname nick $gettok($sockname,2-,46) } on *:sockread:bot.*:{ if ($sockerr) halt | var %1 | sockread %1 if ($sockbr) { tokenize 32 %1 | var %s = $sockname if (!$window(@sock)) window @sock if ($1 != ping) echo @sock $1- if ($2 = PRIVMSG) { var %n = $xnick($1), %g = $xgate($1), %c = $3 | tokenize 32 $strip($right($4-,-1)) if ($1 = VERSION) $sw %s notice %n :VERSION KaysWorld if (%n = $me) { if ($1 = 'sinfo) $sw %s privmsg %c :Uptime: $+ $duration($sock(%s).to) Data sent: $+ $bytes($sock($sockname).sent,bkmgt3d).suf Data Resived: $+  $+ $bytes($sock($sockname).rcvd,bkmgt3d).suf Protocal: $+ $upper($sock($sockname).type) $+  SSL: $+ $iif($sock($sockname).ssl == $true,ON,OFF) if ($1 = 'say) $sw %s privmsg %c : $+($2-) if ($1 = 'join) $sw %s join $2 if ($1 = 'part) $sw %s part %c %n if ($1 = 'hop) $sw %s part %c $cr join %c if ($1 = 'quit) $sw %s quit $nick if ($1 == 'resock) { hadd -mu5 %s resock $true hadd -m %s cchan %c $sw %s quit : $+ $iif($2,$2-,resock) } } } if ($1 = ping) $sw %s pong $2- $iif($hget(%s,kchan),$cr join $hget(%s,kchan)) if ($2 = 001) $sw %s join $hget(%s,cchan) $cr mode $gettok($sockname,2-,46) +B if ($2 == 366) { if ($hget(%s,kchan) = $4) { hdel -s %s kchan } } } if ($2 = kick) { $sw %s join $3 hadd -m %s kchan $3 } } on *:sockclose:Bot.*:var %s = $sockname, %ip = $sock($sockname).ip | sockclose %s | if ($hget(%s,resock)) sockopen %s %ip 6667 alias sc { var %s = $+(bot.,$1) hadd -m %s cchan $active sockopen %s $server $2 } alias squit .signal sbloop quit : $+ $1- $chr(40) $+ Bye $+ $chr(41) alias sjoin .signal sbloop join $1 alias spart .signal sbloop part $1 alias sraw .signal sbloop $1- alias sbx return $sock(bot.*,$1) alias sw return sockwrite -n alias xgate return $gettok($1,2,33) alias xnick return $mid($gettok($1,1,33),2) alias tag return KaysWorld on *:signal:Sbloop: { var %x = $sbx(0), %y = 0 :loop inc %y $sw $sbx(%y) $1- if (%x == %y) halt if (%x != %y) goto loop }