Moderation.tcl
#1
Soir tlm

J ai un soucis avec ce script : Moderation.tcl

En PL j ai ceci -->
TCL
Tcl error [pubcheck]: can't read "moderation(cptmotmax)": no such element in array



Et ayant fais le '.set error'

j ai ceci --> " Error: extra characters after close-quote "

Mais j vois pas ou se trouve CE CLOSE-QUOTE..

J ai essayé ligne par ligne mais j sais pas si c moi ( de nouveau ) mais j le vois pas l érreur.

Voice le script :

TCL
#================================================================================#
#----- Www.euroueb.com ----------------------------------------------------------#
#	  ________						  ___		 #
#	 /        |						 |   |		 #
#	|    _____|						 |   |		 #
#	|   |___  ___   ___ ___ ____ _______   _______  ___   ___|   |____	 #
#	|   	||   | |   |   '    |       \ /       \|   | |   |        \ 	 #
#	|    ___||   | |   |     ___|   _    |    o    |   | |   |    _    |	 #
#	|   |____|   |_|   |    /  |   (_)   |    _____|   |_|   |   (_)   |	 #
#	|	  |        |   |   |         |    v    |         |         |	 #
#	 \________|_______/|___|    \_______/ \_______/ \_______/ \_______/	 #
#										 #
#--------------------------------------------------------------------------------#
#        Conçut et Devellopé par XyZ (xyz@euroueb.com) pour Euroueb Network	 #
#________________________________________________________________________________#
#================================================================================#
#										 #
#      	Fichier de config de bot eggdrop par XyZ - Http://www.euroueb.com	 #
#              	      Modération 1.0 (pour eggdrop1.6.X)			 #
#										 #
#  Pour contacter les auteurs de cette création configuration : xyz@euroueb.com	 #
#										 #
#		#==========================================#			 #
#		#-----------------------_------------------#			 #
#		#  ___   __ _  __ _  __| |_ __  ___  _ __  #			 #
#		# / _ \ / _` |/ _` |/ _` | '__|/ _ \| '_ \ #			 #
#		#|  __/| (_| | (_| | (_| | |  | (_) | |_) |#			 #
#		# \___| \__, |\__, |\__,_|_|   \___/| .__/ #			 #
#		#       |___/ |___/ Euroueb Network |_|v1.6#			 #
#		#__________________________________________#			 #
#		#==========================================#			 #
#--------------------------------------------------------------------------------#
#		                       _____          _     _		 	 #
#		                      |_   _|_      _(_)___| |_ ___ _ __  	 #
#		                        | | \ \ /\ / / / __| __/ _ \ '_ \ 	 #
#					Avec pour Hébergement:|  __/ | | |	 #
#		                        |_|   \_/\_/ |_|___/\__\___|_| |_|	 #
#										 #
#--------------------------------------------------------------------------------#
#================================================================================#
#  										 #
# Ce programme est libre, vous pouvez le redistribuer et/ou le modifier selon	 #
#  les termes de la Licence Publique Générale GNU publiée par la Free Software	 #
#  Foundation (version 2 ou bien toute autre version ultérieure choisie par vous)#
#										 #
# Ce programme est distribué car potentiellement utile, 			 #
#  mais SANS AUCUNE GARANTIE, ni explicite ni implicite, 			 #
#  y compris les garanties de commercialisation ou d'adaptation 		 #
#  dans un but spécifique. 							 #
#  										 #
#  Reportez-vous à la Licence Publique Générale GNU pour plus de détails.	 #
#										 #
# Vous devez avoir reçu une copie de la Licence Publique Générale GNU en même 	 #
#  temps que ce programme ; si ce n'est pas le cas, écrivez à la Free Software 	 #
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 	 #
#  										 #
#					      	      	  Copyright (C) 2004-2006#
#  							    Xyz - Euroueb Network#
#  										 #
#================================================================================#
# Information d'utilisation							 #
#================================================================================#
# Les Commandes actives via ce Tcl sont:					 #
#										 #
# .moderation --> Aide à la configuration de la modération.			 #
# .listword --> Liste les mots							 #
# .delword <mot> --> Efface un mot						 #
# .addword <mot> --> Ajoute un mot						 #
#										 #
# Commandes pour les canaux detection Pub					 #
# .antipub listchan --> Liste des Channels Antipub				 #
# .antipub <salon> off --> Efface un canal a surveiller				 #
# .antipub <salon> on --> Ajoute un canal a surveiller				 #
#										 #
# Commandes pour les canaux detection Flood, Majuscule, Mots Interdit & Limite	 #
# .modchan --> Liste les canaux							 #
# .-modchan <salon> --> Efface un canal surveillé				 #
# .+modchan <salon> --> Ajoute un canal a surveiller				 #
#										 #
#================================================================================#

#================================================================================#
# Configuration.
#--------------------------------------------------------------------------------#
# Flag d'accé autoriser à configurer la Modération de l'Eggy.
set moderation(flag) "m|m"

# Flag d'Exception pour ke la Modération de l'Eggy n'agisse pas sur une catégorie d'accé.
set moderation(flagexept) "fo|fo"

#================================================================================#
# Configuration de la Limite salon (mode +l...).
#--------------------------------------------------------------------------------#
#Indiquer ici de combien la limite doit etre augmenté
set moderation(plus) 3

#================================================================================#
# Configuration Publicité.
#--------------------------------------------------------------------------------#
# Temps apres lequel l'avertissement est oublié et le compteur des pub remis a zéro,
# ce qui permets que si kkun fait de la pub UNE fois, se fait kicker pour warning,
# et n'en refait que 2h plus tard, de pas le bannir (il risquerais de pas trop capter aussi)
# par defaut le temps de remise a zero du compteur est de 30 minutes (1800 secondes)
#set moderation(pubtime) 1800

# nombre de recidive entrainant le ban (si =3 la personne pourra faire 3 fois de la pub sans etre inquiete
# et sera banni a la 4 eme tentative... par defaut =1)
#set moderation(nb_check) 1

# liste des pubs interdites sur le channel.
#set moderation(pubnolist) 

# liste des pubs autorisées sur le channel.
#set moderation(puboklist) 

# prevenir avec un avertissement pour chaque pub envoyé dans le salon? 1/0
#set moderation(pubaverto) 1

# quel message?
#set moderation(pubavertomsg) "4Attention! Evitez vos Publicités! La prochaine fois vous serez Expulsé!"

# kicker pour pub? 1/0
#set moderation(pubkick) 1

# kel raison pour le kick?
#set moderation(pubkickraison)

# bannir pour pub? 1/0
#set moderation(pubban) 1

# bannir combien de temps? (en minute)
#set moderation(pubbantime) 10

#================================================================================#
# Configuration Mots Interdits.
#--------------------------------------------------------------------------------#
# prevenir 1 fois avant kick pour les badword? 1/0
set moderation(badaverto) 1

# si on previent kel est le message a envoyer?
set moderation(badavertomsg) "4Attention! surveillez votre langage! La prochaine fois vous serez Expulsé!"

# bannir pour badword? 1/0
set moderation(badban) 1

# bannir combien de temps? (en minute)
set moderation(badbantime) 5

# kicker pour badword? 1/0
set moderation(badkick) 1

# kel raison pour le kick?
set moderation(badkickraison) {
	"Exclu 5 minutes !"
	"Pas de ca ici stp"
	"Aux chiottes la vulgarité !"
}

#================================================================================#
# Configuration Répititions.
#--------------------------------------------------------------------------------#
# combien de repetion maxi?
set moderation(repeatmax) 2

# raisons de kick random pour les repetions
set moderation(repeatkickraison) {
	"pas besoin de répéter"
	"on ne répète pas"
	"tu nous dérange en répétant"
}

# bannir pour repetition? 1/0
set moderation(repeatban) 0

# combien de temps? (en minute)
set moderation(repeatbantime) 0

#================================================================================#
# Configuration Majuscule.
#--------------------------------------------------------------------------------#
# Max de Caps ?
#set moderation(majmax) 30

# prevenir la personne en notice ? 1/0
#set moderation(majaverto) 1

# quel message?
set moderation(majavertomsg) "4Attention! Merci de ne pas ecrire en MAJUSCULE Svp..!"

# kicker les CAPS ? 1/0
#set moderation(majkick) 0

# quel raison pour le kick?
#set moderation(majkickraison) 

#================================================================================#
# Configuration Flood.
#--------------------------------------------------------------------------------#
# kicker les longs mots? 1/0
set moderation(motkick) 1

# taille maxi d'un mot? 1/0
set moderation(motmax) 40

# raison du kick ?
set moderation(motkickraison) {
	"Flood"
	"Evite le flood"
	"Pas de flood stp"
}

#================================================================================#
# Configuration Répitition mot en une phrase.
#--------------------------------------------------------------------------------#
# Nombre max de fois où un mot est répeté dans une seul et unique phrase.
#set moderation(cptmotmax) 4

# kicker pour mot répété plusieur fois dans une seul et unique phrase? 1/0
#set moderation(cptmotick) 1

# kel raison pour le kick?
#set moderation(cptmotkickraison) "Exclu pour répétition en une seul phrase !"
#set moderation(cptmotkickraison) 

# bannir pour mot répété plusieur fois dans une seul et unique phrase? 1/0
#set moderation(cptmotban) 0

# bannir combien de temps? (en minute)
#set moderation(cptmotbantime) 10

#================================================================================#
# Bind.
#--------------------------------------------------------------------------------#
bind dcc $moderation(flag) moderation moderation
bind dcc $moderation(flag) antipub dcc_antipub
bind dcc $moderation(flag) modchan listchan
bind dcc $moderation(flag) -modchan effacerchan
bind dcc $moderation(flag) +modchan ajouterchan
bind dcc $moderation(flag) listemot listmot
bind dcc $moderation(flag) effacermot effacermot
bind dcc $moderation(flag) ajoutermot ajoutermot
 
bind time - "* * * * *" effacetemp
 
bind pubm - * chanpub
bind pubm - * pubcheck
 
bind ctcp - action pubcheckactionsound
bind ctcp - sound pubcheckactionsound
 
bind raw - notice pubchecknotice

#================================================================================#
# Processus.
#--------------------------------------------------------------------------------#
proc moderation {hand idx args} {
	global moderation
	putdcc $idx "      Check Auto Chan      "
	putdcc $idx ""
	putdcc $idx "ce script comprend un anti mots-interdit, un anti répétition mot"
	putdcc $idx "un anti repetition phrase, un anti caps, un anti pub et un anti long mot."
	putdcc $idx "Il agit sur les msgs/notices/actions/sounds"
	putdcc $idx ""
	putdcc $idx "commandes pour les Badword"
	putdcc $idx "\002.listemot\002	14(liste les mots)"
	putdcc $idx "\002.effacermot\002	<mot> 14(efface un mot)"
	putdcc $idx "\002.ajoutermot\002	<mot> 14(ajoute un mot)"
	putdcc $idx ""
	putdcc $idx "commandes pour les canaux detection Pub"
	putdcc $idx "\002.antipub\002	14listchan (liste des Channels Antipub)"
	putdcc $idx "\002.antipub\002	14<salon> off (efface un canal a surveiller)"
	putdcc $idx "\002.antipub\002	14<salon> on (ajoute un canal a surveiller)"
	putdcc $idx ""
	putdcc $idx "commandes pour les canaux detection Flood, Majuscule & Badword"
	putdcc $idx "\002.modchan\002	14(liste les canaux)"
	putdcc $idx "\002.-modchan\002	14<salon> (efface un canal surveillé)"
	putdcc $idx "\002.+modchan\002	14<salon> (ajoute un canal a surveiller)"
	putdcc $idx ""
	putdcc $idx "Xyz 7- 14xyz@euroueb.com"
	putdcc $idx ""
	return 1
}
 
proc kickraison {} {
	global moderation
	return [lindex $moderation(repeatkickraison) [rand [llength $moderation(repeatkickraison)]]]
}
 
set bwc ""
foreach c [channels] {
	if {[file exists "moderation.[string tolower $c].list"]} {
		set f [open moderation.[string tolower $c].list r]
		set bwl([string tolower $c]) "[string tolower [gets $f]]"
		close $f
		lappend bwc [string tolower $c]
	}
}
 
proc checkchall {cha} {
	global bwc
	foreach c $bwc {
		if {$c == "$cha"} {return 1; break}
	}
	return 0
}
 
proc pubchecknotice {from keyword arg} {
	set from [split $from !]
	if {![validchan $from]} { return 0 }
	pubcheck [lindex $from 0] [lindex $from 1] * [lindex $arg 0] [lrange $arg 1 end]
}
proc pubcheckactionsound {nick userhost hand dest keyword text} {
	if {[string match &* $dest] || [string match #* $dest]} {
		pubcheck $nick $userhost $hand $dest $text
	}
}
 
proc pubcheck {nick userhost handle channel text} {
	global bwn bwl bwc rpt moderation
	if {[isop $nick $channel]} { return 0 }
	if {[matchattr $handle $moderation(flagexept) $channel]} { return 0 }
	if {[checkchall [string tolower $channel]]} {
		set hostban [lindex [split $userhost @] 1]
		if {[info exists cptmot]} {
			unset cptmot
		}
		foreach {w} $text {
			if {[info exists cptmot($w)]} {
				set cptmot($w) [expr $cptmot($w) + 1]
			}
			if {![info exists cptmot($w)]} {
				set cptmot($w) 1
			}
			if {$cptmot($w) > $moderation(cptmotmax)} {
				if {$moderation(cptmotban)=="1"} {newchanban $channel *!*@$hostban moderation "$moderation(cptmotkickraison)" $moderation(cptmotbantime)}
				if {$moderation(cptmotick)=="1"} {
					putserv "KICK $channel $nick :$moderation(cptmotkickraison)"
					return 0
				}
			}
		}
		set templist [join [split [string tolower $text] "!&\"'(-_)=~\{\[|`\\^@\]\}\$%µ?,;:/§"]]
		foreach wdt $bwl([string tolower $channel]) {
			if {[lsearch -exact "$templist" $wdt] != -1} {
				if {$moderation(badaverto)} {
					if {![info exists bwn([string tolower $userhost])]} {
						putserv "NOTICE $nick :$moderation(badavertomsg)"
						set bwn([string tolower $userhost]) [expr [clock seconds] + 1800]
					} else {
						if {$moderation(badban)=="1"} {newchanban $channel *!*@$hostban moderation "$moderation(badkickraison)" $moderation(badbantime)}
						if {$moderation(badkick)=="1"} {putserv "KICK $channel $nick :$moderation(badkickraison)"}
					}
					return 1
				} else {
					if {$moderation(badban)=="1"} {newchanban $channel *!*@$hostban moderation "$moderation(badkickraison)" $moderation(badbantime)}
					if {$moderation(badkick)=="1"} {putserv "KICK $channel $nick :$moderation(badkickraison)"}
					return 1
				}
			}
		}
		regsub -all {\\} $text {\\\\} text
		regsub -all {\{} $text {\{} text
		regsub -all {\}} $text {\}} text
		regsub -all {\]} $text {\]} text
		regsub -all {\[} $text {\[} text
		regsub -all {\"} $text {\"} text
		if {[info exists rpt($nick)]} {
			if {[lrange $rpt($nick) 2 end] == "$text"} {
				set cnt [lindex $rpt($nick) 1]; incr cnt
				set rpt($nick) "[lindex $rpt($nick) 0] $cnt [lrange $rpt($nick) 2 end]"
				if {[lindex $rpt($nick) 1] > $moderation(repeatmax)} {
					putserv "KICK $channel $nick :[kickraison]"
					if {$moderation(repeatban)=="1"} {newchanban $channel *!*@$hostban moderation "Repeat" 10}
					unset rpt($nick)
				}
			} else {set rpt($nick) "[expr [clock seconds] + 10] 1 $text"}
		} else {set rpt($nick) "[expr [clock seconds] + 10] 1 $text"}
		set upper 0
		set space 0
		foreach i [split $text {}] {
			if [string match \[A-Z\] $i] {incr upper}
			if {$i == " "} {incr space}
		}
		if {$upper > $moderation(majmax)} {
	 		if {$moderation(majaverto)=="1"} {putserv "NOTICE $nick :$moderation(majavertomsg)"}
			if {$moderation(majkick)=="1"} {putserv "KICK $channel $nick :$moderation(majkickraison)"}
		}
		if {$space == 0 && [string length $text] > $moderation(motmax)} {
			if {$moderation(motkick)=="1"} {putserv "KICK $channel $nick :$moderation(motkickraison)"}
		}
	}
}
 
proc zerotime {} {
	global rpt
	foreach nick [array names rpt] {
		if {[lindex $rpt($nick) 0] < [clock seconds]} {unset rpt($nick)}
	}
	utimer 5 zerotime
}
 
foreach t [utimers] {
	if {[lindex $t 1] == "zerotime"} {killutimer [lindex $t 2]}
}
zerotime
 
proc effacetemp {min hour day month year} {
	global bwn rpt moderation
	foreach nt [array names bwn] {
		if {$bwn($nt) < [clock seconds]} {unset bwn($nt)}
	}
	set limite_actuelle 0
	foreach chan [channels] {
		if {[checkchall [string tolower $chan]]} {
			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 moderation($chan,stop)]} {
				set moderation($chan,stop) 0
			}
			set moderation($chan,total) [llength [chanlist $chan]]
			if {![info exists moderation($chan,total,old)]} {
				set moderation($chan,total,old) $moderation($chan,total)
			}
			if {![info exists moderation($chan,danger)]} {
				set moderation($chan,danger) 1
			}
			if {$moderation($chan,total) == [expr $moderation($chan,total,old) + $moderation(plus)]} {
				if {![info exists moderation($chan,danger,moment)]} {
					set moderation($chan,danger,moment) "$hour:$min"
				}
				if {([lindex [split $moderation($chan,danger,moment) :] 0] == $hour) && ([expr [lindex [split $moderation($chan,danger,moment) :] 1] + 1] == $min)} {
					set moderation($chan,danger) [expr $moderation($chan,danger) + 1]
				}
 
			}
			if {$moderation($chan,danger) == 2} {
				set moderation($chan,stop) 4
				set moderation($chan,danger) 1
			} else {
				if {$moderation($chan,stop) > 0} {
					set moderation($chan,stop) [expr $moderation($chan,stop) - 1]
				} else {
					if {$moderation($chan,danger) < 2} {
						if {$limite_actuelle != [expr $moderation($chan,total) + $moderation(plus)]} {
							pushmode $chan +l [expr $moderation($chan,total) + $moderation(plus)]
							set moderation($chan,total,old) $moderation($chan,total)
						}
					}
				}
			}
		}
	}
}
 
proc ajoutermot {hand idx args} {
	global bwl
	set chan [string tolower [lindex [console $idx] 0]]
	if {![validchan $chan]} {putdcc $idx "Console invalide ($chan)"; return 0}
	if {![matchattr [idx2hand $idx] o|o $chan]} {putdcc $idx "Acces refusé pour $chan"; return 0}
	set word [string tolower [lindex $args 0]]
	if {$word == ""} {putdcc $idx ".addword <mot> (ajoute un mot)"; return 0}
	if {![info exists bwl($chan)]} {set bwl($chan) ""}
	if {[lsearch -exact "x $bwl($chan)" "$word"] == -1} {
		lappend bwl($chan) $word
		set f [open moderation.$chan.list w]
		puts $f "$bwl($chan)"
		close $f
		putdcc $idx "$word ajouté."
		return 1
	} else {putdcc $idx "$word est deja dans la liste! (taper .listword pour voir la liste)"; return 0}
}
 
proc effacermot {hand idx args} {
	global bwl
	set chan [string tolower [lindex [console $idx] 0]]
	if {![validchan $chan]} {putdcc $idx "Console invalide ($chan)"; return 0}
	if {![matchattr [idx2hand $idx] o|o $chan]} {putdcc $idx "Acces refusé pour $chan"; return 0}
	if {![info exists bwl($chan)]} {putdcc $idx "Aucun mot pour $chan"; return 0}
	set word [string tolower [lindex $args 0]]
	if {$word == ""} {putdcc $idx ".delword <mot> (efface un mot)"; return 0}
	if {[lsearch -exact "$bwl($chan)" "$word"] != -1} {
		set f [open moderation.$chan.list r]
		gets $f tmpl
		close $f
		set newlist ""
		foreach t $tmpl {
			if {$t != "$word"} {lappend newlist $t}
		}
		set f [open moderation.$chan.list w]
		puts $f "$newlist"
		set bwl($chan) $newlist
		close $f
		putdcc $idx "$word éffacé."
		return 1
	} else {putdcc $idx "$word est pas dans la liste! (taper .listword pour voir la liste)"; return 0}
}
 
proc listmot {hand idx args} {
	global bwl
	set chan [string tolower [lindex [console $idx] 0]]
	if {![validchan $chan]} {putdcc $idx "Console invalide ($chan)"; return 0}
	if {![matchattr [idx2hand $idx] o|o $chan]} {putdcc $idx "Acces refusé pour $chan"; return 0}
	if {![info exists bwl($chan)]} {putdcc $idx "Aucun mot pour $chan"; return 0}
	putdcc $idx "Liste des Badwords: $bwl($chan)"
	return 1
}
 
proc ajouterchan {hand idx args} {
	global bwc bwl
	set tchan [string tolower [lindex $args 0]]
	if {$tchan == ""} {putdcc $idx ".+modchan <#channel> (ajoute un canal a surveiller)"; return 0}
	if {![validchan $tchan]} {putdcc $idx "Channel invalide ($tchan)"; return 0}
	if {![matchattr [idx2hand $idx] o|o $tchan]} {putdcc $idx "Acces refusé pour $tchan"; return 0}
	if {[lsearch -exact "x $bwc" "$tchan"] == -1} {
 
		set f [open moderation.$tchan.list w]
		close $f
		set bwl($tchan) ""
 
		set f [open moderation.chan w]
		puts $f [lappend bwc $tchan]
		close $f
		putdcc $idx "$tchan ajouté."
		return 1
	} else {putdcc $idx "$tchan est deja dans la liste! (taper .modchan pour voir la liste)";return 0}
}
 
proc effacerchan {hand idx args} {
	global bwc
	set tchan [string tolower [lindex $args 0]]
	if {$tchan == ""} {putdcc $idx ".-modchan <#channel> (efface un canal surveillé)"; return 0}
	if {![validchan $tchan]} {putdcc $idx "Channel invalide ($tchan)"; return 0}
	if {![matchattr [idx2hand $idx] o|o $tchan]} {putdcc $idx "Acces refusé pour $tchan"; return 0}
	if {[lsearch -exact "x $bwc" "$tchan"] != -1} {
		set f [open moderation.chan r]
		set tmpl [gets $f]
		close $f
		set newlist ""
		foreach t $tmpl {
			if {$t != "$tchan"} {lappend newlist $t}
		}
		set f [open moderation.chan w]
		puts $f "$newlist"
		close $f
		set bwc $newlist
		putdcc $idx "$tchan éffacé."
		return 1
	} else {putdcc $idx "$tchan est pas dans la liste! (taper .modchan pour voir la liste)";return 0}
}
 
proc listchan {hand idx args} {
	global bwc
	putdcc $idx "Liste des canaux: $bwc"
	return 1
}
 
set dir ""
set pubfile "chans.pub"
 
proc dcc_antipub {hand idx arg} {
	global dir pubfile
	set cmd [lindex $arg 0]
	set cmd2 [lindex $arg 1]
 
	if {$cmd == "help" } {
		putdcc $idx " Cette commande permet d'activer l'antipub sur un chan."
		return 0
	}
 
	if {$cmd == "listchan"} {
		putcmdlog "#$hand# antipub listchan"
		putidx $idx "Liste des chans où l'antipub est actif:"
		if {[file exists ${dir}${pubfile}]} {
			set read [open ${dir}${pubfile} r]
			while {![eof $read]} {
				set data [string tolower [gets $read]]
				if {[eof $read]} {break}
				if {$data != ""} {
					putidx $idx "$data"
				}
			}
			close $read
		}
		return 0
	}
 
	if { $cmd == "" } {
		putdcc $idx "\002Usage:\002 .antipub #chan on/off ou .antipub listchan, tapez .antipub help pour obtenir de l'aide sur cette commande"
		return 0
	}
 
	if {![validchan $cmd]} {
		putdcc $idx "Je ne suis pas sur $cmd.\r"
		return 0
	}
 
	if {![matchattr $hand n|n $cmd]} { 
		putdcc $idx "Cette commande n'est accessible qu'aux owners globaux ou sur $cmd."
		return 0
	}
 
	if {$cmd2 == "on"} {
		putcmdlog "#$hand# antipub $cmd on"
		if {[trouvchan $cmd $pubfile]} {
			putidx $idx "L'antipub est deja actif sur le chan $cmd !"
			return 0
		}
		set temp [addedchan $cmd $pubfile]
		putidx $idx "L'antipub est maintenant actif sur le chan $cmd !"
		return 0
	}
 
	if {$cmd2 == "off"} {
		putcmdlog "#$hand# antipub $cmd off"
		if {![file exists ${dir}${pubfile}]} {
			putidx $idx "Vous devez d'abord utiliser .antipub #chan on !"
			return 0
		}
		if {![trouvchan $cmd $pubfile]} {
			putidx $idx "L'antipub sur $cmd n'est pas actif !"
			return 0
		}
		set temp [rmchannel $cmd $pubfile]
		putidx $idx "L'antipub sur $cmd n'est plus actif."
		return 0
	}      
}
 
proc chanpub {nick userhost hand chan arg} {
	global okipub badpub check_recidive botnick pubfile moderation
	if {![trouvchan $chan $pubfile] || ![botisop $chan] } { return 0 }
	if {[isop $nick $chan]} { return 0 }
	if {[matchattr $hand $moderation(flagexept) $chan]} { return 0 }
	if {[string match *$chan* $arg]} { return 0 }
	set hostban [lindex [split $userhost @] 1]
 
	foreach okip $moderation(puboklist) {
		if {[string match *$okip* $arg]} {
			return 0
		}
	}
	foreach badp $moderation(pubnolist) {
		if {[string match *$badp* $arg]} {
			if {[info exists moderation($userhost)]} {
				if {$moderation($userhost)>=1} {
 
					if {[unixtime]>[expr $moderation($userhost.TIME)+$moderation(pubtime)]} {
						putserv "NOTICE $nick :4Attention! Evitez vos Publicités! La prochaine fois vous serez Expulsé!"	
						set moderation($userhost) 1
						set moderation($userhost.TIME) [unixtime]	
						return 0
					}
					if {$moderation(pubban)=="1"} { newchanban $chan *!*@$hostban moderation "$moderation(pubkickraison)" $moderation(pubbantime) }
					if {$moderation(pubkick)=="1"} { putserv "KICK $chan $nick :$moderation(pubkickraison)" }
					unset moderation($userhost)
					unset moderation($userhost.TIME)
					return 0
 
				} else {
					if {$moderation(pubaverto)=="1"} {
						putserv "NOTICE $nick : $moderation(pubavertomsg)"
					}
					incr moderation($userhost)
					set moderation($userhost.TIME) [unixtime]
					return 0	
				}
			} else {
				if {$moderation(pubaverto)=="1"} {
					putserv "NOTICE $nick : $moderation(pubavertomsg)"
				}
				set moderation($userhost) 1
				set moderation($userhost.TIME) [unixtime]
				return 0
			}
		}
	}
	return 0
}
 
proc addedchan {channel typefile} {
	global privfile dir pubfile
	set chan [string tolower $channel]
	if {![file exists ${dir}${typefile}]} {
		set create [open ${dir}${typefile} w]
		puts $create $chan
		close $create
		return 0
	}
	if {[file exists ${dir}${typefile}]} {
		set addfile [open ${dir}${typefile} a]
		puts $addfile $chan
		close $addfile
		return 0
	}
	return 0
}
 
proc trouvchan {channel typefile} {
	global privfile dir pubfile
	set chan [string tolower $channel]
	if {[file exists ${dir}${typefile}]} {
		set read [open ${dir}${typefile} r]
		while {![eof $read]} {
			set data [string tolower [gets $read]]
			if {[eof $read]} {break}
			if {$chan == $data && $data != ""} {
				close $read
				return 1
			}
		}
		close $read
	}
	return 0
}
 
proc rmchannel {channel typefile} {
	global privfile dir pubfile
	set chan [string tolower $channel]
	if {![file exists ${dir}${typefile}]} {
		return 0
	}
	if {[file exists ${dir}${typefile}]} {
		set read [open ${dir}${typefile} r]
		while {![eof $read]} {
			set data [string tolower [gets $read]]
			if {[eof $read]} {break}
			if {$chan != $data && $data !=""} {
				set addfile [open ${dir}${typefile}.new a]
				puts $addfile $data
				close $addfile
			}
		}
		close $read
		if {![file exists ${dir}${typefile}.new]} {
			set addfile [open ${dir}${typefile}.new a]
			puts $addfile ""
			close $addfile
		}
		set removefile [file delete -force ${dir}${typefile}]
		set copynew [file copy -force ${dir}${typefile}.new ${dir}${typefile}]
		set removeold [file delete -force ${dir}${typefile}.new]
	}
	return 0
}




Merci en avance pour vos aides.
Répondre Avertir
#2
pour ton erreur :
TCL
Tcl error [pubcheck]: can't read "moderation(cptmotmax)": no such element in array



essaye par décommenter ici:

TCL
#=============================================================================== =#
# Configuration Répitition mot en une phrase.
#--------------------------------------------------------------------------------#
# Nombre max de fois où un mot est répeté dans une seul et unique phrase.
#set moderation(cptmotmax) 4
 
# kicker pour mot répété plusieur fois dans une seul et unique phrase? 1/0
#set moderation(cptmotick) 1
 
# kel raison pour le kick?
#set moderation(cptmotkickraison) "Exclu pour répétition en une seul phrase !"
#set moderation(cptmotkickraison)
 
# bannir pour mot répété plusieur fois dans une seul et unique phrase? 1/0
#set moderation(cptmotban) 0
 
# bannir combien de temps? (en minute)
#set moderation(cptmotbantime) 10



lis bien le tcl en entier !! car y a pas mal de choses à décommenter !!
[font=Times New Roman]La différence entre Linux et Windows ,c'est que Linux c'est comme une belle fille , il faut l'apprivoiser , la comprendre , la séduire tandis que Windows , c'est comme une prostitué , il faut payer et surtout bien se protéger.[/font]
Répondre Avertir


Atteindre :


Utilisateur(s) parcourant ce sujet : 2 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté