Code: Select all
# Keep nick v2.0 by Mezen <mezen0@msn.com>
# This script allows to solve connection issue after receiving
# Invalid Nick notice from the network. It will make the bot release
# its nickname and identify to it.
# This script is made for Dalnet but can be adapted to any other
# network with small modifications
# to install it, just copy it to the folder /path/to/eggdrop/scripts
# then add this line at the end of the eggdrop.conf
# source scripts/keepnick.tcl
#######################################
# Config #
#######################################
# set here bot's password
set KP(botpass) ""
# set here nickserv's hostname
set KP(nickserv) "nickserv@services.dal.net"
#######################################
# Do not edit below this line #
#######################################
# removing old binds
unbind evnt - init-server evnt:init_server
# creating new binds
foreach bind [binds kp_invalid_server_proc] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
bind evnt - init-server kp_init_server_proc
foreach bind [binds kp_invalid_nick_proc] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
bind raw - 432 kp_invalid_nick_proc
bind raw - 433 kp_invalid_nick_proc
# saving bot's nick in a variable
set KP(botnick) $nick
proc kp_invalid_nick_proc { from keyword text } {
global nick altnick botnet-nick
set newnick $nick
set chars "abcdefghijkmnopqrstuvwxyz023456789";
set anick $altnick
while {[regexp -all {\?} $anick]>0} {
set char [string index $chars [expr int(rand()*[string length $chars])]]
if {[expr rand()]>0.5} {set char [string toupper $char]}
regsub {\?} $anick $char anick
}
putlog "Alternating Nick: $nick -> $anick"
set nick $anick
if {[string match -nocase ${botnet-nick} $newnick]} {
putlog "Jumping to next server..."
jump
}
}
proc kp_init_server_proc {type} {
global nick KP
putquick "MODE $nick +i-ws"
putserv "PRIVMSG $KP(nickserv) :identify $KP(botnick) $KP(botpass)" -next
putserv "PRIVMSG $KP(nickserv) :release $KP(botnick) $KP(botpass)" -next
putserv "PRIVMSG $KP(nickserv) :ghost $KP(botnick) $KP(botpass)" -next
set nick $KP(botnick)
}
set KP(version) " 2.0"
set KP(script) "KP -- Keep Nick -- "
putlog "\002Loading\002: $KP(script)$KP(version) by Mezen."