### ChanLink.tcl v3.0 beta.2 by JunKie ### Release Date: 04/04/96 (17:00) ### If you modify this program in any way, please change the version ### information accordingly. Please notify me of bugs you find. ### Remember to always get the latest version of ChanLink at: ### FTP Site: yoda.fdt.net /pub/users/s/seizure/ ### Latest Gripes + Flotsam Corner: ### All you 0.9.whatever's out there.. Upgrade! ### This version is for Eggdrop 1.0 only. ### It's a beta, so don't be surprised if you found bugs. Report them. ### Added in this version: Eggdrop v1.0 support. THERE *WILL* BE BUGS! ### I just haven't found them yet. :) ### *** CONFIGURATION OPTIONS *** set chan2link #ChanLink ### ^^^^^^^^^ Channel that will be sent to and recieved. ### When I feel more comfortable with arrays, I'll add multiple ### linked channels, and intra-bot (same bot, diff channels) links. set chancode ORAC ### ^^^^ = ACTIVATION Code! Leave at ORAC to link to all the ### bots, or add your own so. set myircnet UnknownNet ### ^^^^^^^^ = 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 set remwhois 0 ### ^^^^^^^^ = Sets wether or not you want to (and can) support remote ### /WHOIS's. Set to 0 for off, 1 for on. ### Command Summary is no longer needed. Use on-line help. ### Sets current version information. set cnver "v3.0 beta.2" ### If the link isn't already up, turn it off. if {![info exists orac]} {set orac 0} ### Automatic, Complete, never-to-be-beat On-Line Help. bind pub - !linkhelp pub_linkhelp bind msg - linkhelp msg_linkhelp proc pub_linkhelp {nick uhost hand channel arg} { msg_linkhelp $nick $uhost $hand $arg } proc msg_linkhelp {nick uhost hand text} { global cnver botnick set linkhelp "ChanLink Help v1.0b By JunKie" if {$text == "" || $text == " "} { putserv "PRIVMSG $nick :$linkhelp" putserv "PRIVMSG $nick :USAGE: LINKHELP where topic is:" putserv "PRIVMSG $nick :LINKUP LINKDOWN LINKIN UNLINK" putserv "PRIVMSG $nick :LINKUSERS LINKBOTS LINKWHOM LINKMSG" putserv "PRIVMSG $nick :LINKPING LINKBOOT LINKWHOIS HELP" return 0 } if {$text != ""} { putserv "NOTICE $nick :$linkhelp" if {$text == "HELP" || $text == "help"} { putserv "NOTICE $nick :General Help for ChanLink $cnver:" putserv "NOTICE $nick :Channel Link is a channel linker. It links channels together via the bots." putserv "NOTICE $nick :Everything said and done in the channel is relayed thru a network." putserv "NOTICE $nick :It is simply for entertainment, and to enhance the bandwidth of one channel!" putserv "NOTICE $nick :If you don't like it, stick it in your ear! \(\002Shove it, $nick!\002\) Hah." return 0 } if {$text == "LINKUP" || $text == "linkup"} { putserv "PRIVMSG $nick :LINKUP is a command which locally turns on ONLY your" putserv "PRIVMSG $nick :bot's link to the ChanLink." putserv "PRIVMSG $nick :USAGE: !LINKUP or /MSG $botnick LINKUP" return 0 } if {$text == "LINKDOWN" || $text == "linkdown"} { putserv "PRIVMSG $nick :LINKDOWN is the command to turn off, locally, ONLY your" putserv "PRIVMSG $nick :bot's link to the ChanLink." putserv "PRIVMSG $nick :USAGE: !LINKDOWN or /MSG $botnick LINKDOWN" return 0 } if {$text == "LINKWHOIS" || $text == "linkwhois"} { putserv "PRIVMSG $nick :LINKWHOIS tells you the userhost and realname of a remote user." putserv "PRIVMSG $nick :Usage: /MSG $botnick LINKWHOIS " return 0 } if {$text == "LINKBOTS" || $text == "linkbots"} { putserv "PRIVMSG $nick :LINKBOTS is a command which instructs the bot to list all" putserv "PRIVMSG $nick :the bots that it knows of that are connected, and include what" putserv "PRIVMSG $nick :version of ChanLink they are currently running on their systems." putserv "PRIVMSG $nick :USAGE: !LINKBOTS or /MSG $botnick LINKBOTS" return 0 } if {$text == "LINKUSERS" || $text == "linkusers"} { putserv "PRIVMSG $nick :LINKUSERS is a sophisticated command which asks the remote bot specified" putserv "PRIVMSG $nick :to relay a list of people currently on the channel. This requires you know" putserv "PRIVMSG $nick :the nick of the bot in question. This is a cool command." putserv "PRIVMSG $nick :USAGE: !LINKUSERS or /MSG $botnick LINKUSERS " putserv "PRIVMSG $nick :See Also: LINKWHOM" return 0 } if {$text == "LINKWHOM" || $text == "linkwhom"} { putserv "PRIVMSG $nick :LINKWHOM is an easier rendition of LINKUSERS. LINKWHOM asks ALL bots to list" putserv "PRIVMSG $nick :the current channel users and it is nicer than LINKUSERS." putserv "PRIVMSG $nick :USAGE: !LINKWHOM or /MSG $botnick LINKWHOM" return 0 } if {$text == "LINKPING" || $text == "linkping"} { putserv "PRIVMSG $nick :LINKPING is a command for the open-minded. It simply reports the # of seconds" putserv "PRIVMSG $nick :in lag time that is detected using UNIX kernel second time. It is for non-" putserv "PRIVMSG $nick :entertainment purposes only. \002NOTE:\002 LINKPING is compatible with putbot." putserv "PRIVMSG $nick :USAGE: !LINKPING or /MSG $botnick LINKPING " putserv "PRIVMSG $nick :To ping \002ALL\002 bots, try LINKPING *." return 0 } if {$text == "LINKIN" || $text == "linkin"} { putserv "PRIVMSG $nick :LINKIN is another bot connection command. It forces a remote bot to link to ChanLink." putserv "PRIVMSG $nick :This should only be used when you really want to get a bot on the link." putserv "PRIVMSG $nick :USAGE: !LINKIN or /MSG $botnick LINKIN " putserv "PRIVMSG $nick :See Also: UNLINK" return 0 } if {$text == "UNLINK" || $text == "unlink"} { putserv "PRIVMSG $nick :UNLINK is a bot disconnection command. It forces a remote bot to unlink from ChanLink." putserv "PRIVMSG $nick :This should be used when you are recieving flooding or annoyance from a certain bot." putserv "PRIVMSG $nick :USAGE: !UNLINK or /MSG $botnick " putserv "PRIVMSG $nick :See Also: LINKIN" return 0 } if {$text == "LINKALL" || $text == "LINKSHUTDOWN"} { putserv "PRIVMSG $nick :LINKALL and LINKSHUTDOWN are MASTER ONLY commands. These control the entire botnet." putserv "PRIVMSG $nick :Please avoid these commands. Thanks." return 0 } if {$text == "LINKBOOT" || $text == "linkboot"} { putserv "PRIVMSG $nick :LINKBOOT is a volatile command. It actually tells a remote bot to /kick someone." putserv "PRIVMSG $nick :Access to this command is limited to channel ops in the bot and should be avoided." putserv "PRIVMSG $nick :Usage: !LINKBOOT or /MSG $botnick LINKBOOT " return 0 } if {$text == "LINKMSG" || $text == "linkmsg"} { putserv "PRIVMSG $nick :LINKMSG is a very nice addition to ChanLink. It sends /MSG \(/NOTICE\) to a remote user." putserv "PRIVMSG $nick :Usage: /MSG $botnick LINKMSG " return 0 } } putserv "NOTICE $nick :No help available for \"$text\"." } ### Ask who on the botnet is running ChanLink bind pub - !LINKBOTS pub_whohaschanlink bind pub - !LINKSTAT pub_whohaschanlink bind msg - linkbots msg_whohaschanlink proc msg_whohaschanlink {nick uhost hand arg} { pub_whohaschanlink $nick $uhost $hand heh $arg } proc pub_whohaschanlink {nick uhost hand channel text} { global botnick putallbots "CHANLINK $botnick $nick" } bind bot - CHANLINK bot_whosgotit proc bot_whosgotit {bot cmd txt} { set whom [lindex $txt 1] global botnick cnver server myircnet chancode chan2link putbot $bot "LMSG $botnick $whom $myircnet's $chan2link, with ChanLink $cnver." putbot $bot "LMSG $botnick $whom 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 channel text} { global orac botnick chancode chan2link if {!($orac)} {return 0} if {$botnick == $nick} {return 0} if {$channel == $chan2link} {putallbots "$chancode \<$nick@$channel\> $text"} } ### Sends all Channel Mode Changes out to the net. bind mode - * mode_orac proc mode_orac {nick uhost hand channel mode} { global orac botnick chan2link chancode if {!($orac)} {return 0} if {$channel == $chan2link} { putallbots "$chancode \($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 chan2link orac chancode if {!($orac)} {return 0} if {$botnick == $nick} {return 0} putallbots "$chancode \($botnick\) \* $nick@$chan2link $arg" } ### Sends information about people who Joined out to the net. bind join - % join_orac proc join_orac {nick uhost hand channel} { global chan2link orac botnick chancode if {!($orac)} {return 0} if {$channel == $chan2link} { putallbots "$chancode \($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 channel} { global botnick chan2link orac chancode if {!($orac)} {return 0} if {$channel == $chan2link} { putallbots "$chancode \($botnick\) *** $nick left $channel."} } ### Lets the net know someone changed the topic! bind topc - * topc_orac proc topc_orac {nick uhost hand channel topic} { global chan2link orac botnick chancode myircnet if {!($orac)} {return 0} if {$channel == $chan2link} { putallbots "$chancode *** \($botnick\) $nick changed topic on $myircnet $channel to:" putallbots "$chancode *** \"$topic\"" } } ### Announces when a Channel Kick occurs. bind kick - % kick_orac proc kick_orac {nick uhost hand channel kicked reason} { global chan2link orac botnick chancode myircnet if {!($orac)} {return 0} if {$channel == $chan2link} { putallbots "$chancode *** $kicked has been kicked off $myircnet $channel by $nick \($reason\)" } } ### Announces when a user /QUIT's. bind sign - % sign_orac proc sign_orac {nick uhost hand channel reason} { global orac chan2link botnick chancode if {!($orac)} {return 0} if {$channel == $chan2link} { putallbots "$chancode \($botnick\) *** Signoff: $nick \[$uhost\] \($reason\)" } } ### Announces any changes of nicks. bind nick - % nick_orac proc nick_orac {nick uhost hand channel newnick} { global orac botnick chan2link chancode if {!($orac)} {return 0} if {$channel == $chan2link} { putallbots "$chancode \($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" } 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\) Message from $whofrom:" putserv "NOTICE $whoto :\"$msg\"" } if {$remwhois == "1"} {bind raw - * raw_whois} proc raw_whois {whois} { global wnick wuser whost rlnm set prelim [lindex $whois 1] if {$prelim == "311"} { set wnick [lindex $whois 3] set wuser [lindex $whois 4] set whost [lindex $whois 5] set rlnm [lrange $whois 7 end] } if {$prelim == "401"} { set wnick [lindex $whois 3] set wuser "root" set whost "0.0.0.0" set rlnm "This user does not exist." } } bind msg - linkwhois msg_linkwhois proc msg_linkwhois {nick uhost hand whol} { global botnick set whatbot [lindex $whol 0] set whom [lindex $whol 1] if { $whatbot == "" || $whom == "" } { pub_linkhelp $nick $uhost $hand "linkwhois" return 1 } set botss [bots] set lowbot [string tolower $whatbot] foreach b $botss { if {[lsearch -exact $lowbot [string tolower $b]] > -1 } { putserv "NOTICE $nick :Please wait about 30 seconds for WHOIS reply." putbot $whatbot "CWHOIS $nick $whom" return 1 } } putserv "PRIVMSG $nick :Bad Bot: $whatbot not connected." } bind bot - CWHOIS bot_whois proc bot_whois {bot cmd arg} { global botnick wibot from set wibot [lindex $bot 0] set who [lindex $arg 1] set from [lindex $arg 0] putserv "WHOIS $who" utimer 20 raw_sendwhois } proc raw_sendwhois {} { global wibot wnick wuser whost rlnm from putbot $wibot "LMSG WHOIS_DAEMON $from $wnick is \($wuser@$whost\) \[$rlnm\]" } bind pub o !UNLINK pub_unlinkabot bind msg o unlink msg_unlinkabot proc msg_unlinkabot {nick uhost hand bot} { pub_unlinkabot $nick $uhost $hand heh $bot } proc pub_unlinkabot {nick uhost hand chan bot} { global chan2link botnick set channel $chan2link set botss [bots] set lowbot [string tolower $bot] foreach b $botss { if {[lsearch -exact $lowbot [string tolower $b]] > -1 } { putserv "PRIVMSG $channel :$bot disconnected." putbot $bot "LINKDOWN $nick" return 1 } } putserv "PRIVMSG $channel :Bad Bot: $bot was not connected." return 0 } bind pub o !LINKIN pub_linkupabot bind msg o LINKIN msg_linkupabot proc msg_linkupabot {nick uhost hand arg} { pub_linkupabot $nick $uhost $hand heh $arg } proc pub_linkupabot {nick uhost hand chan bot} { global chan2link botnick set channel $chan2link set lowbot [string tolower $bot] set botss [bots] foreach b $botss { if {[lsearch -exact $lowbot [string tolower $b]] > -1} { putbot $bot "LINKUP $channel $nick" return 0 } } putserv "PRIVMSG $nick :No bot named $bot was found on the net." } bind pub m !LINKALL pub_linkup bind pub m LINKALL msg_linkup proc msg_linkup {nick uhost hand arg} { pub_linkup $nick $uhost $hand heh $arg } proc pub_linkup {nick uhost hand chan text} { global chan2link orac botnick badbota badbotb badbotc set orac 1 set channel $chan2link putallbots "LINKUP $channel $nick" putserv "PRIVMSG $channel :Linking Channels..." if {[info exists badbota]} { pub_unlinkabot $botnick grin badbot badbot $badbota } if {[info exists badbotb]} { pub_unlinkabot $botnick grin badbot badbot $badbotb } if {[info exists badbotc]} { pub_unlinkabot $botnick grin badbot badbot $badbotc } return 0 } bind pub m !linkshutdown pub_linkdown bind msg m LINKSHUTDOWN msg_linkdown proc msg_linkdown {nick uhost hand arg} { pub_linkdown $nick $uhost $hand heh $arg } bind pub o !linkup pub_linkulocal bind msg o LINKUP msg_linkulocal proc msg_linkulocal {nick uhost hand arg} { pub_linkulocal $nick $uhost $hand heh $arg } proc pub_linkulocal {nick uhost hand chan text} { global orac chan2link putserv "PRIVMSG $chan2link :Channel Link turned on locally." set orac 1 } bind pub o !LINKDOWN pub_linkdlocal bind msg o LINKDOWN msg_linkdlocal proc msg_linkdlocal {nick uhost hand txt} { pub_linkdlocal $nick $uhost $hand heh $txt } proc pub_linkdlocal {nick uhost hand chan text} { global orac chan2link set channel $chan2link putserv "PRIVMSG $channel :Channel Link disconnected locally." set orac 0 } proc pub_linkdown {nick uhost hand chan text} { global chan2link orac set cahnnel $chan2link putallbots "LINKDOWN $nick" set orac 0 putserv "PRIVMSG $channel :Link Disconnected." } bind msg n spychanlink pub_spychanlink proc pub_spychanlink {nick uhost hand arg} { putallbots "SPYCHAN $nick" } bind bot - SPYCHAN bot_spychan proc bot_spychan {bot cmd nick} { global botnick channel chancode putbot $bot "LMSG $botnick $nick My code is $chancode!" } bind bot - LINKUP do_link proc do_link {from command arg} { global chan2link botnick orac cnver chancode set orac 1 set channel $chan2link set whodid [lindex $arg 1] set whatbot $from set whatchan [lindex $arg 0] 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 "$chancode Channel Link-Up Established to $channel via $botnick \($cnver\)." } bind bot - LINKDOWN do_unlink proc do_unlink {from command arg} { global chan2link botnick orac chancode putallbots "$chancode \($botnick\) Disconnected from Link." set orac 0 putserv "privmsg $chan2link :Channel Link Disconnected by $arg." } # ping or <*> for all bots bind pub - !LINKPING pub_lping bind msg - LINKPING msg_lping proc msg_lping {nick uhost hand arg} { pub_lping $nick $uhost $hand heh $arg } proc pub_lping {nick uhost hand chan 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 chan2link set to [lindex $arg 0] set pingtime [expr [unixtime] - [lindex $arg 1] + 1] set outstr "*** \($bot\) PONG! \[$pingtime seconds\]" putserv "PRIVMSG $chan2link :$outstr" return 1 } # chlist bind pub o !LINKBOOT pub_linkboot bind msg o LINKBOOT msg_linkboot proc msg_linkboot {nick uhost hand txt} { pub_linkboot $nick $uhost $hand heh $txt } proc pub_linkboot {nick uhost hand chan arg} { if {$arg == ""} { putserv "PRIVMSG $nick :USAGE: !LINKBOOT " return 0 } set whatbot [lindex $arg 0] set who [lindex $arg 1] 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 chan2link botnick chancode set who [lindex $arg 0] set whodunit [lindex $arg 1] set why [lrange $arg 2 end] if {$who == $botnick} { putallbots "$chancode \($botnick\) $whodunit \*TRIED\* to boot\002ME!\002" 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 "$chancode \($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 "$chancode \($botnick\) $whodunit Booted $who: $why" } bind pub - !LINKUSERS pub_linkusers bind msg - LINKUSERS msg_linkusers proc msg_linkusers {nick uhost hand arg} { pub_linkusers $nick $uhost $hand heh $arg } proc pub_linkusers {nick uhost hand channel 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 chan arg} { putallbots "LINKUSERS $nick" } proc msg_linkwhom {nick uhost hand arg} { pub_linkwhom $nick $uhost $hand heh $arg } bind pub - !LINKWHOM pub_linkwhom bind msg - LINKWHOM msg_linkwhom bind bot - LINKUSERS bot_linkusers proc bot_linkusers {bot cmd arg} { global chan2link botnick pbotlog set channel $chan2link 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 "LMSG $botnick $from Users on $channel: \[$userlist\]" return 0 } ### Takes any information sent to ORAC users on the net, and displays it. bind bot - $chancode do_orac proc do_orac {from command arg} { global orac chan2link if {!($orac)} {return 0} putserv "PRIVMSG $chan2link :$arg" }