Code: Select all
#####################check_bots ver1a 5/21/04 by KalZoo#######################
##############################################################################
### Just a small script that checks how many bots are in channel and that ###
### are op'ed,then if not at the minimun required amount it checks for ###
### certain flag [ z ]to ones allowed to stay op until other bots return ###
### .chattr +z [global] and [channel] to all bots and whoever are allowed ###
### to stay op'd. [prob n m users].I would recomend you load this onto ###
### 1 bot from each shell you have,and make subhubs for each shell as to ###
### be sure they all send the chattr command. When low bots they deop ###
### non +z users and chattr them +d-o [channel specific].Then when bots ###
### return and meet the bots_min they get their status returned. ###
##############################################################################
##############################################################################
#set this to the channel u want to run in.Only single channel.
set allowed "#channel"
#set this to the minimum amount of bots before action
set bots_min 12
#set this to how many minutes timer to check for bots
set bo_timer 5
############################end settings#####################################
#######################code begins dont edit#################################
proc low_chkbots {} {
global bot bots botnick allowed bo_timer bots_min
if {![string match "*low_chkbots*" [timers]]} { timer $bo_timer low_chkbots }
set bots 1
foreach bot [chanlist $allowed b] {
if {$bot != $botnick && [isop $bot $allowed]} {
incr bots
}
}
if {$bots >= $bots_min} {
return_status }
if {$bots <= $bots_min} {
remove_status }
}
if {![string match "*low_chkbots*" [timers]]} { timer $bo_timer low_chkbots }
proc remove_status {} {
global channick hnick allowed bots_min
foreach channick [chanlist $allowed -z] {
set hnick [nick2hand $channick]
pushmode $allowed -o $channick
if {([matchattr $hnick -z|-z $allowed])} {
if {([matchattr $hnick |-d $allowed])} {
chattr $hnick |-o+d $allowed
}
}
}
}
proc return_status {} {
global allowed channick ahnick
foreach channick [chanlist $allowed -z] {
set ahnick [nick2hand $channick]
if {([matchattr $ahnick |-z $allowed])} {
if {([matchattr $ahnick |-o $allowed])} {
chattr $ahnick |-d+o $allowed
}
}
}
}
bind bot - low_chkbots
###########################################################################
putlog "check-bots ver1a loaded created by KalZoo"