criticalmass.tcl

criticalmass.tcl

When your channel loses "critical mass" of opped bots or opped humans his script will ask all human ops in the channel to get ops and help hold the channel until critical mass is returned. When there's human ops, but no opped bots, it will beg humans for ops. Will also set user defined channel modes

Postat de Copyright Categorie Review user Vizualizari Data
btc FireEgl protections Cod netestat 360 2023-12-25 00:00:34

# Critical Mass v1.1 - by FireEgl@EFNet <FireEgl@LinuxFan.com> - 12/26/99

## Description:
# When your channel loses "critical mass" of opped bots or opped humans
# this script will ask all human ops in the channel to get ops and help
# hold the channel until critical mass is returned.
# When there's human ops, but no opped bots, it will beg humans for ops.
# Will also set user defined channel modes when critical mass is lost.

## Reasons:
# I've been running low on bots lately, and get scared that I'll lose ops
# because the ops on my channel are lazy about asking a bot for ops even
# when there's only one or two bots..

## Notes:
# Load this script on all your bots.

## Suggestions?
# If it's something easy to implement I'll consider it.
# I'm open to suggestions for other scripts also.
## Comments?
# I like comments. =)
## Bugs?
# Gosh I hope not!
## Flames?
# Leave me alone! =)

# My Email address is FireEgl@LinuxFan.com

## Options:
# Trigger when bot mass is this or below:
set cm(criticalbotmass) "2"

# Trigger when op (human and bot) mass is this or below:
set cm(criticalopmass) "4"

# (un)set these modes when critical mass is lost:
set cm(chanmodes) "+sn-t"

# Send this /notice to un-opped ops on the channel when critical mass is lost:
set cm(notice1) "Please ask a bot for ops to help hold the channel."

# When there's human ops, but no bots opped, send this /notice to all unopped ops:
set cm(notice2) "Please ask somebody for ops, and op me!"

# When there's human ops, but no bots opped, send this /notice to all opped nicks:
set cm(notice3) "Please op me!"

bind join - * join:cm
proc join:cm {n u h c} { return [check_cm $c] }
bind part - * part:cm
proc part:cm {n u h c} { return [check_cm $c] }
bind sign - * sign:cm
proc sign:cm {n u h c r} { return [check_cm $c] }
bind kick - * kick:cm
proc kick:cm {n u h c t r} { return [check_cm $c] }
bind mode - "* -o*" mode:cm
proc mode:cm {n u h c m v} { utimer 1 [split "check_cm $c"] }
proc check_cm {chan} { global cm
   set opped ""
   set oppedbots ""
   set notopped ""
   foreach n [chanlist $chan o|o] {
      if {[isop $n $chan]} {
         lappend opped $n
         if {[matchattr [nick2hand $n $chan] b $chan]} { lappend oppedbots $n }
      } else {
         if {[matchattr [nick2hand $n $chan] -b]} { lappend notopped $n }
      }
   }
   if {([llength $opped] <= $cm(criticalopmass)) || ([llength $oppedbots] <= $cm(criticalbotmass))} {
      if {$oppedbots == ""} {
         if {$opped != ""} { foreach n $notopped { puthelp "NOTICE $n :(WALLOP/$chan) $cm(notice2)" } }
         if {![botisop $chan]} { foreach n [chanlist $chan -b] { if {[isop $n $chan]} { puthelp "NOTICE $n :(WALLOP/$chan) $cm(notice3)" } } }
      } else {
         foreach n $notopped { puthelp "NOTICE $n :(WALLOP/$chan) $cm(notice1)" }
      }
      if {(([info exists cm(chanmodes)]) && ($cm(chanmodes) != ""))} { pushmode $chan $cm(chanmodes) }
   }
}
putlog "Critical Mass v1.1 - by FireEgl@EFNet <FireEgl@LinuxFan.com> - Loaded."