limit
limit
- Code:
# limit (10/09/2002) #
#################################################################################
# ___ ___ ___ ___ _____ #
# / /\ / /\ / /\ / /\ / /::\ #
# / /:/ / /::\ / /::\ / /::\ / /:/\:\ #
# /__/::\ / /:/\:\ / /:/\:\ / /:/\:\ / /:/ \:\ #
# \__\/\:\ / /:/~/::\ / /:/~/:/ / /:/ \:\ /__/:/ \__\:| #
# \ \:\ /__/:/ /:/\:\ /__/:/ /:/___ /__/:/ \__\:\ \ \:\ / /:/ #
# \__\:\ \ \:\/:/__\/ \ \:\/:::::/ \ \:\ / /:/ \ \:\ /:/ #
# / /:/ \ \::/ \ \::/~~~~ \ \:\ /:/ \ \:\/:/ #
# /__/:/ \ \:\ \ \:\ \ \:\/:/ \ \::/ #
# \__\/ \ \:\ \ \:\ \ \::/ \__\/ #
# \__\/ \__\/ \__\/ #
# #
# #
# ___ #
# ___ / /\ #
# / /\ / /:/ #
# / /:/ / /:/ ___ ___ #
# / /:/ / /:/ ___ /__/\ / /\ #
# / /::\ /__/:/ / /\ \ \:\ / /:/ #
# /__/:/\:\ \ \:\ / /:/ \ \:\ /:/ #
# \__\/ \:\ \ \:\ /:/ \ \:\/:/ #
# \ \:\ \ \:\/:/ \ \::/ #
# \__\/ \ \::/ \__\/ #
# \__\/ #
# #
# #
# web : http://tcl.lagon-bleu.org #
# mail : jarod_angel@yahoo.fr #
# IRC : Jarod_@IRCNet #buffy #
# Asco@UNDERNet #tyranz #
# #
#################################################################################
# #
# Limit.tcl permet de mettre à jour le mode +l sur un channel. #
# #
#################################################################################
##### CONFIGURATION #####
### Channels sur lesquels la limite doit etre mise en place (mettre "all" pour tous les channels où le bot est)
### Séparer les channels par un espace
set limit(channel) "#test #france"
### Indiquer ici de combien la limite doit etre augmenté
set limit(plus) 5
##### FIN DE LA CONFIGURATION #####
##### DEBUT DU PROGRAMME #####
bind time - "* * * * *" limit:time:check
proc limit:time:check { min hour day month year } {
global limit
set limite_actuelle 0
foreach chan [channels] {
if {(($limit(channel) != "all") && ([lsearch -exact $limit(channel) $chan] != -1)) || ($limit(channel) == "all")} {
if {[string match *l* [lindex [getchanmode $chan] 0]]} {
if {[string match *k* [lindex [getchanmode $chan] 0]]} {
set limite_actuelle [lindex [getchanmode $chan] 2]
} else {
set limite_actuelle [lindex [getchanmode $chan] 1]
}
}
if {![info exists limit($chan,stop)]} {
set limit($chan,stop) 0
}
set limit($chan,total) [llength [chanlist $chan]]
if {![info exists limit($chan,total,old)]} {
set limit($chan,total,old) $limit($chan,total)
}
# on regarde si y'a pas trop de gens qui sont rentrés sur le channel en 1 minute
if {![info exists limit($chan,danger)]} {
set limit($chan,danger) 1
}
if {$limit($chan,total) == [expr $limit($chan,total,old) + $limit(plus)]} {
if {![info exists limit($chan,danger,moment)]} {
set limit($chan,danger,moment) "$hour:$min"
}
if {([lindex [split $limit($chan,danger,moment) :] 0] == $hour) && ([expr [lindex [split $limit($chan,danger,moment) :] 1] + 1] == $min)} {
# si la limite était pleine il y a une minute deja alors on incremente le danger
set limit($chan,danger) [expr $limit($chan,danger) + 1]
}
}
if {$limit($chan,danger) == 2} {
putlog "#LIMIT# Je trouve qu'il y a bcp de personne qui ont rejoin $chan ... je n'augmente plus la limite pendant 5 minutes !"
puthelp "privmsg $chan :#LIMIT# Je trouve qu'il y a bcp de personne qui ont rejoin $chan ... je n'augmente plus la limite pendant 5 minutes !"
set limit($chan,stop) 4
set limit($chan,danger) 1
} else {
if {$limit($chan,stop) > 0} {
set limit($chan,stop) [expr $limit($chan,stop) - 1]
} else {
if {$limit($chan,danger) < 2} {
if {$limite_actuelle != [expr $limit($chan,total) + $limit(plus)]} {
pushmode $chan +l [expr $limit($chan,total) + $limit(plus)]
set limit($chan,total,old) $limit($chan,total)
}
}
}
}
}
}
return 0
}
putlog "\0032LIMIT.TCL\003 (\0031310/09/2002\003) par Jarod_"
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|