### ChanLink.tcl v2.2e by JunKie ### Remember to always get the latest version of ChanLink at: ### ftp.fdt.net /pub/users/s/seizure/ ### This Requires Eggdrop v0.9tp or better to run properly. ### Sorry, all you 0.9r's out there.. your version is buggy. ### This is version 2.2e. ### Added in this version: Revisions, working on stuff to get it to work. ### Conflict with tcl.putbot was found and fixed; you must have ChanLink ### v2.2e now to do anything related to statistics screens again. ### *** CONFIGURATION OPTIONS *** set myircnet UnderNet ### ^^^^^^^^ = IRC Net your bot is located on. set badbota H2O set badbotb LamestBot set badbotc BotNick ### ^^^^^^^ ^^^^^^^^^^ = We are having problems with bots. Add the offending ### Bot's nicks and they will be disconnected on !LINKALLs ### Command Summary: ### !LINKHELP in your channel gives a list of commands. ### !LINKALL send out a command, and all bots on the net that have ### ChanLink will link in, and give their info. ### !LINKSHUTDOWN tells all bots on the net to quit the link. ### !LINKUP tells only your bot to join the link, quietly. ### !LINKDOWN tells only your bot to quit the link, quietly. ### !UNLINK discretely cuts a bot's access to the link. ### !LINKIN discretely tells a bot to join in! ### !LINKBOTS tells you what bots are currently running ChanLink. ### !LINKBOOT kicks a user remotely! (Useful!) ### !LINKUSERS lists the people on 's channel. ### !LINKPING pings a remote linked bot and gives a reply in seconds. ### !LINKWHOM lists everyone on the link. ### /MSG LINKMSG sends a ### /NOTICE to with in it. :) ### Sets current version information. set cnver v2.2e ### If the link isn't already up, turn it off. if {![info exists orac]} {set orac 0} ### Ask who on the botnet is running ChanLink bind pub - !LINKBOTS pub_whohaschanlink bind pub - !LINKSTAT pub_whohaschanlink bind pub - !linkstats pub_whohaschanlink bind msg - linkbots pub_whohaschanlink proc pub_whohaschanlink {nick uhost hand text} { global botnick putallbots "CHANLINK $botnick" } bind bot - CHANLINK bot_whosgotit proc bot_whosgotit {bot cmd txt} { global botnick channel cnver server myircnet putbot $txt "ORAC \($botnick\) $myircnet's $channel, with ChanLink $cnver." putbot $txt "ORAC \($botnick\) I am on server $server" } ### Sends all public messages, save those sent by the bot, out to the net. bind pubm - * pub_orac proc pub_orac {nick uhost hand text} { global orac botnick channel if {!($orac)} {return 0} if {$botnick == $nick} {return 0} putallbots "ORAC \<$nick@$channel\> $text" } ### Sends all Channel Mode Changes out to the net. *NEW IN v2.2!* bind mode - * mode_orac proc mode_orac {nick uhost hand mode} { global orac botnick channel if {!($orac)} {return 0} putallbots "ORAC \($botnick\) Mode Change \"$mode\" on channel $channel by $nick." } ### Send all ACTIONS out on the net. bind ctcp - ACTION ctcp_orac proc ctcp_orac {nick uhost hand dest cmd arg} { global botnick channel orac if {!($orac)} {return 0} if {$botnick == $nick} {return 0} putallbots "ORAC \($botnick\) \* $nick@$channel $arg" } ### Sends information about people who Joined out to the net. bind join - % join_orac proc join_orac {nick uhost hand} { global channel orac botnick if {!($orac)} {return 0} putallbots "ORAC \($botnick\) *** $nick \($uhost\) just joined $channel." } ### Sends information about people who have LEFT, out to the net. bind part - % part_orac proc part_orac {nick uhost hand} { global botnick channel orac if {!($orac)} {return 0} putallbots "ORAC \($botnick\) *** $nick left $channel." } ### Lets the net know someone changed the topic! bind topc - * topc_orac proc topc_orac {nick uhost hand topic} { global channel orac botnick if {!($orac)} {return 0} putallbots "ORAC *** $nick changed the topic on $botnick's $channel to:" putallbots "ORAC *** \"$topic\"" } ### Announces when a Channel Kick occurs. bind kick - % kick_orac proc kick_orac {nick uhost hand kicked reason} { global channel orac botnick if {!($orac)} {return 0} putallbots "ORAC *** $kicked has been kicked off $botnick's $channel by $nick \($reason\)" } ### Announces when a user /QUIT's. bind sign - % sign_orac proc sign_orac {nick uhost hand reason} { global orac channel botnick if {!($orac)} {return 0} putallbots "ORAC \($botnick\) *** Signoff: $nick \[$uhost\] \($reason\)" } ### Announces any changes of nicks. bind nick - % nick_orac proc nick_orac {nick uhost hand newnick} { global orac botnick channel if {!($orac)} {return 0} putallbots "ORAC \($botnick\) *** $nick \($uhost\) is now known as $newnick on $channel." } bind msg - linkmsg msg_linkmsg proc msg_linkmsg {nick uhost hand txt} { if {$txt == ""} { putserv "PRIVMSG $nick :USAGE: linkmsg " return 0 } set whatbot [lindex $txt 0] set whoto [lindex $txt 1] set msg [lrange $txt 2 end] putbot $whatbot "LMSG $nick $whoto $msg" putserv "NOTICE $nick :Message Delivered to $whoto." } bind bot - LMSG msg_sendlinkmsg proc msg_sendlinkmsg {bot cmd arg} { set whofrom [lindex $arg 0] set whoto [lindex $arg 1] set msg [lrange $arg 2 end] putserv "NOTICE $whoto :\($bot\) Link Message from $whofrom:" putserv "NOTICE $whoto :\"$msg\"" } bind pub o !UNLINK pub_unlinkabot bind msg o unlink pub_unlinkabot proc pub_unlinkabot {nick uhost hand bot} { global channel botnick if {[string compare [string tolower $bot] [string tolower $botnick]] == 0} { putserv "PRIVMSG $channel :Bad Bot: $bot was not connected." return 1 } putserv "PRIVMSG $channel :Bad Bot Detected! $bot disconnected." putbot $bot "LINKDOWN $nick" return 0 } bind pub o !LINKIN pub_linkupabot proc pub_linkupabot {nick uhost hand bot} { global channel botnick putbot $bot "LINKUP $channel $botnick" } bind pub o !LINKALL pub_linkup proc pub_linkup {nick uhost hand text} { global channel orac botnick badbota badbotb badbotc set orac 1 putallbots "LINKUP $nick $channel $botnick" putserv "PRIVMSG $channel :Linking Channels..." pub_unlinkabot $botnick grin badbot $badbota pub_unlinkabot $botnick grin badbot $badbotb pub_unlinkabot $botnick grin badbot $badbotc return 0 } bind pub m !linkshutdown pub_linkdown bind pub o !linkup pub_linkulocal proc pub_linkulocal {nick uhost hand text} { global orac channel putserv "PRIVMSG $channel :Channel Link turned on locally." set orac 1 } bind pub o !LINKDOWN pub_linkdlocal proc pub_linkdlocal {nick uhost hand text} { global orac channel putserv "PRIVMSG $channel :Channel Link disconnected locally." set orac 0 } proc pub_linkdown {nick uhost hand text} { global channel orac putallbots "LINKDOWN $nick" set orac 0 putserv "PRIVMSG $channel :Link Disconnected." } bind pub - !linkhelp pub_linkhelp proc pub_linkhelp {nick uhost hand text} { global cnver putserv "PRIVMSG $nick :Channel Link $cnver by JunKie" putserv "PRIVMSG $nick :!LINKUP !LINKDOWN !LINKBOTS" putserv "PRIVMSG $nick :!LINKUSERS !LINKPING !LINKHELP" putserv "PRIVMSG $nick :E-Mail JunKie, for more help." } bind bot - LINKUP do_link proc do_link {from command arg} { global channel botnick orac cnver set orac 1 set whodid [lindex $arg 0] set whatbot [lindex $arg 2] set whatchan [lindex $arg 1] putserv "privmsg $channel :Channel Link Established!" putserv "privmsg $channel :We are now linked to $whatchan via $whatbot." putserv "privmsg $channel :This link was authorized by $whodid!" putbot $whatbot "ORAC Channel Link-Up Established to $channel via $botnick \($cnver\)." } bind bot - LINKDOWN do_unlink proc do_unlink {from command arg} { global channel botnick orac putallbots "ORAC \($botnick\) Disconnected from Link." set orac 0 putserv "privmsg $channel :Channel Link Disconnected by $arg." } # ping or <*> for all bots bind pub - !LINKPING dcc_ping proc dcc_ping {nick uhost hand arg} { global botnick if {$arg == ""} { putserv "PRIVMSG $nick :USAGE: !LINKPING or !LINKPING * (pings all bots)" return 0 } if {[string compare [string tolower $arg] [string tolower $botnick]] == 0} { putserv "PRIVMSG $nick :$nick, you must specify a bot that is linked to $botnick!" return 0 } if {$arg == "\*"} { putallbots "ping $hand [unixtime]" return 0 } putbot $arg "ping $hand [unixtime]" return 1 } bind bot - ping bot_ping proc bot_ping {bot cmd arg} { set from [lindex $arg 0] set rtime [lindex $arg 1] putbot $bot "pong $from $rtime" } bind bot - pong bot_pong proc bot_pong {bot cmd arg} { global channel set to [lindex $arg 0] set pingtime [expr [unixtime] - [lindex $arg 1] + 1] set outstr "*** \($bot\) PONG! \[$pingtime seconds\]" putserv "PRIVMSG $channel :$outstr" return 1 } # chlist bind pub o !LINKBOOT pub_linkboot proc pub_linkboot {nick uhost hand arg} { if {$arg == ""} { putserv "PRIVMSG $nick :USAGE: !LINKBOOT " return 0 } set whatbot [lindex $arg 0] set who [lindex $arg 1] if {$who == "W"} {return 0} if {$who == "w"} {return 0} set why [lrange $arg 2 end] putbot $whatbot "KICK $who $nick $why" putserv "PRIVMSG $nick :Trying to boot $who via $whatbot." } bind bot - KICK bot_kick proc bot_kick {bot cmd arg} { global channel botnick set who [lindex $arg 0] set whodunit [lindex $arg 1] set why [lrange $arg 2 end] if {$who == $botnick} { putallbots "ORAC \($botnick\) $whodunit \*TRIED\* to boot me!" return 0 } if {![onchan $who]} { return 0 } if {[onchanSplit $who]} { return 0 } append userhost $who "!" [getchanhost $who] set target [finduser $userhost] if {$target != "*"} { if {([matchattr $target o] || [matchattr $target m] || [matchattr $target f])} { putallbots "ORAC \($botnick\) $whodunit \*TRIED\* to boot $who." return 0 } } putlog "Link Booting $who: $why by $whodunit" if {$who == "W"} {return 0} putserv "KICK $channel $who :$why" putallbots "ORAC \($botnick\) $whodunit Booted $who: $why" } #bind dcc m chlist dcc_chlist bind pub - !LINKUSERS dcc_chlist proc pub_linkusers {nick uhost hand arg} { global botnick if {$arg == ""} { putserv "PRIVMSG $nick :USAGE: !LINKUSERS " return 0 } if {[string compare [string tolower $arg] [string tolower $botnick]] == 0} { putserv "PRIVMSG $nick :$nick, you must specify a bot that is linked to $botnick!" return 0 } putbot $arg "LINKUSERS $nick" return 1 } proc pub_linkwhom {nick uhost hand arg} { putallbots "LINKUSERS $nick" } bind pub - !LINKWHOM pub_linkwhom bind bot - LINKUSERS bot_linkusers proc bot_linkusers {bot cmd arg} { global channel botnick pbotlog set from [lindex $arg 0] if {$channel == {}} { putbot $bot "result $from $from, I'm currently not on a channel!" return 0 } set users [chanlist] foreach user $users { if {[isop $user]} { append userlist "@" $user " " } else { append userlist $user " " } } putbot $bot "ORAC \($botnick\) Users on $channel: \[$userlist\]" return 1 } ### Takes any information sent to ORAC users on the net, and displays it. bind bot - ORAC do_orac proc do_orac {from command arg} { global orac channel if {!($orac)} {return 0} putserv "PRIVMSG $channel :$arg" }