Code: Select all
#**********#
# SETTINGS #
#**********#
# main bot ident
set mainbot "BOT"
# main channel
set mainchannel "#channel"
#************************#
# DO NOT EDIT UNDERNEATH #
#************************#
putlog "main-backup.tcl"
foreach bind [binds botjoin] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
foreach bind [binds botpart] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
bind join - * botjoin
bind part - * botpart
bind sign - * botpart
proc botjoin {nick uhost hand channel args} {
global mainbot mainchannel
set ident [string range [lindex [split $uhost @] 0] 1 end]
if {[string match -nocase $ident $mainbot]} {
putlog "Leaving $mainchannel"
channel remove $mainchannel
}
}
proc botpart {nick uhost hand channel args} {
global mainbot mainchannel
set ident [string range [lindex [split $uhost @] 0] 1 end]
if {[string match -nocase $ident $mainbot]} {
putlog "Joining $mainchannel"
channel add $mainchannel
}
}