#--------------------------------------------------------------------- # recoverbotnick.tcl # TCL script for IRC bot eggdrop # This script attempts to "recover" the bots nick when someone else # is using it. # # By default this script is for dalnet. In case of another net, # change the "service" to your preference. # # Note: nick killing is tricky business and so is this script. # Initially it was observed on dalnet that in some instances # the bot killed itself or desynched servers. # # v0: 28-Feb-2002 #--------------------------------------------------------------------- #--------------------------------------------------------------------- # setting (check main config file for info on the keep-nick setting) #--------------------------------------------------------------------- set keep-nick 1 #--------------------------------------------------------------------- # bindings # The nick the bot is using is checked every 10 minutes or when # a user on the partylines attempts to .recover #--------------------------------------------------------------------- bind time - "*5 * * * *" recoverbotnick:time bind dcc o recover recoverbotnick:dcc #--------------------------------------------------------------------- # intermediate procs #--------------------------------------------------------------------- proc recoverbotnick:dcc { hand idx arg } { putdcc $idx [recoverbotnick] return 1 } proc recoverbotnick:time { min hour day month year } { putlog [recoverbotnick] } #--------------------------------------------------------------------- # procedure to recover botnick # set the "service" below to reflect your specific network #--------------------------------------------------------------------- proc recoverbotnick { } { global nick botnick recoverbotnickstamp set currenttime [unixtime] if {![info exists recoverbotnickstamp]} { set recoverbotnickstamp 0 } # in case botnick and nick are the same ... if {[string compare $nick $botnick] == 0} { return "No need to recover. Current botnick already is $nick!" } # The botnick is not the same as the desired nick... # Avoid sending many RECOVER's to the server by nervous # users typing .recover over and over again. if {[expr $currenttime - $recoverbotnickstamp] < 90 } { return "Recovery of botnick triggered too fast. Aborted." } # todo: add [isjuped] test for newest eggdrop versions? # set nick/service for recovery. # Password intentionally left out i.e. nickserv already must # recognise the bots userhost. set service nickserv@services.dal.net putserv "PRIVMSG $service :RECOVER $nick" # Sending the nick is of not much use... better trust on # keep-nick... # putserv "NICK $nick" # reset the timestamp to the currenttime set recoverbotnickstamp $currenttime return "Desired botnick ($nick) taken. Attempted to recover." }