Mise en forme de code: pensez à utiliser les balises [ tcl ] et [ /tcl ] (sans les espaces bien sûr) autour de vos codes tcl afin d'avoir un meilleur rendu et une coloration syntaxique. x


[Script] Moderation.tcl By Platine débug.
#1
Bonjour,

Voici un code TCL de modération de base qui et de Platine.

Version débug et refait.

Liens : https://scripts.eggdrop.fr/details-Moderation-s252.html

Et si jamais, vous voulais un système de Help avec ce tcl :


tcl
##############################################################
# Modération help.                                           #
# Code TCL pour la liste des commandes du TCL moderation.tcl #
#                                                            #
##############################################################
 
namespace eval ::mod.help {
 
    bind dcc o|o "xhelp" [namespace current]::dcc:mod
    proc dcc:mod { hand idx arg } {
        putdcc $idx "\00314Commandes Help du TCL de \002\0034Modération\0034\0031 :\0031\002"
        putdcc $idx ""
        putdcc $idx "\037Gestion des chans à modérer\037 :"
        putdcc $idx "\002.modchan\002 \00314(Permet de lister les chans modérés)\00314"
        putdcc $idx "\002.+modchan\002 <#chan> \00314(Permet d'ajouter un chan à modérer)\00314"
        putdcc $idx "\002.-modchan\002 <#chan> \00314(Permet de supprimer un chan à modérer)\00314"
        putdcc $idx ""
        putdcc $idx "\037Gestion des mots interdit\037 :"
        putdcc $idx "\002.modmot\002 \00314(Permet de lister les mots interdits)\00314"
        putdcc $idx "\002.+modmot\002 <mot> \00314(Permet d'ajouter un mot interdit)\00314"
        putdcc $idx "\002.-modmot\002 <mot> \00314(Permet de supprimer un mot interdit)\00314"
        putdcc $idx ""
        putdcc $idx "\037Gestion des spams interdit\037 :"
        putdcc $idx "\002.modspam\002 \00314(Permet de lister les spams interdits)\00314"
        putdcc $idx "\002.+modspam\002 <spam> \00314(Permet d'ajouter un spam interdit)\00314"
        putdcc $idx "\002.-modspam\002 <spam> \00314(Permet de supprimer un spam interdit)\00314"
        putdcc $idx ""
        putdcc $idx "\037Gestion des nicks interdit\037 :"
        putdcc $idx "\002.modnick\002 \00314(Permet de lister les nicks interdits)\00314"
        putdcc $idx "\002.+modnick\002 <nick> \00314(Permet d'ajouter un nick interdit)\00314"
        putdcc $idx "\002.-modnick\002 <nick> \00314(Permet de supprimer un nick interdit)\00314"
        putdcc $idx ""
        putdcc $idx "\037Gestion de la blacklist\037 :"
        putdcc $idx "\002.blacklist\002 \00314(Permet de lister la blacklist)\00314"
        putdcc $idx "\002.+blacklist\002 <host> \00314(Permet d'ajouter un host à la blacklist)\00314"
        putdcc $idx "\002.-blacklist\002 <host> \00314(Permet de supprimer un host à la blacklist)\00314"
        putdcc $idx ""
        putdcc $idx "\037Gestion des xtrusts (si Anticlones installé)\037 :"
        putdcc $idx "\002.xtrust\002 \00314(Permet de lister les hosts protégés (exemptés)\00314"
        putdcc $idx "\002.+xtrust\002 <host> \00314(Permet d'ajouter un host à exempter)\00314"
        putdcc $idx "\002.-xtrust\002 <host> \00314(Permet de supprimer un host exempté)\00314"
        putdcc $idx ""
        putdcc $idx "\037Gestion de la protection contre la modération\037 :"
        putdcc $idx "\002.protect\002 \00314(Permet de lister les hosts protégés)\00314"
        putdcc $idx "\002.+protect\002 <host> \00314(Permet d'ajouter un host protégé)\00314"
        putdcc $idx "\002.-protect\002 <host> \00314(Permet de supprimer un host protégé)\00314"
        putdcc $idx ""
        putdcc $idx "\002Fin de la liste des commandes du tcl de modération.\002"
    }
 
    bind pub o|o "!aide" [namespace current]::pub:aide
    proc pub:aide { nick host hand chan arg } {
        puthelp "privmsg $nick :\00300,2_______________\002Moderation - Aide\002_______________\00300,2"
        puthelp "privmsg $nick :"
        puthelp "privmsg $nick :\037\00300,2Gestion de la protection\037\00300,2"
        puthelp "privmsg $nick :\0035 .protectlist\0035 (\0034Permet de lister les hosts protégés\0034)- \0033Protection contre toute cette modération\0033"
        puthelp "privmsg $nick :\0035.+protect\0035 <\0034host/pseudo*!*@*\0034> \0033(Permet d'ajouter un host/pseudo protégé)\0033"
        puthelp "privmsg $nick :\0035.-protect\0035 <\0034host/pseudo*!*@*\0034> \0033(Permet de supprimer un host/pseudo protégé)\0033"
        puthelp "privmsg $nick :"
        puthelp "privmsg $nick :\037\00300,2Gestion des mots interdits\037\00300,2"
        puthelp "privmsg $nick :\0035.badmotlist\0035 (\0033Permet de lister les mots interdits\0033)"
        puthelp "privmsg $nick :\0035.+badmot\0035 <\0034mot\0034> (\0033Permet d'ajouter un mot interdit\0033)"
        puthelp "privmsg $nick :\0035.-badmot\0035 <\0034mot\0034> (\0033Permet de supprimer un mot interdit\0033)"
        puthelp "privmsg $nick :"
        puthelp "privmsg $nick :\037\00300,2Gestion des Spams interdits\037\00300,2"
        puthelp "privmsg $nick :\0035.spamlist\0035 (\0033Permet de lister les spams\0033)"
        puthelp "privmsg $nick :\0035.+spam\0035 <\0034spam\0034> (\0033Permet d'ajouter un spam\0033)"
        puthelp "privmsg $nick :\0035.-spam\0035 <\0034spam\0034> (\0033Permet de supprimer un spam\0033)"
        puthelp "privmsg $nick :"
        puthelp "privmsg $nick :\037\00300,2Gestion des nicks interdits\037\00300,2"
        puthelp "privmsg $nick :\0035.badnicklist\0035 (\0033Permet de lister les nicks interdits\0033)"
        puthelp "privmsg $nick :\0035.+badnick\0035 <\0034nick\0034> (\0033Permet d'ajouter un nick interdit\0033)"
        puthelp "privmsg $nick :\0035.-badnick\0035 <\0034nick\0034> (\0033Permet de supprimer un nick interdit\0033)"
        puthelp "privmsg $nick :"
        puthelp "privmsg $nick :\037\00300,2Gestion de la Blacklist\037\00300,2"
        puthelp "privmsg $nick :\0035.bavlist\0035 (\0033Permet de lister la blacklist\0033)"
        puthelp "privmsg $nick :\0035.+bav\0035 <\0034host/pseudo*!*@*\0034> (\0033Permet d'ajouter un host/pseudo*!*@* à la blacklist\0033)"
        puthelp "privmsg $nick :\0035.-bav\0035 <\0034host/pseudo*!*@*\0034> (\0033Permet de supprimer un host/pseudo*!*@* à la blacklist\0033)"
        puthelp "privmsg $nick :\037\00300,2Gestion des xtrusts\037\00300,2"
        puthelp "privmsg $nick :\0035.xtrust\0035 (\0033Permet de lister les hosts protégés exemptés\0033)"
        puthelp "privmsg $nick :\0035.+xtrust\0035 <\0034host\0034> (\0033Permet d'ajouter un host à exempter\0033)"
        puthelp "privmsg $nick :\0035.-xtrust\0035 <\0034host\0034> (\0033Permet de supprimer un host exempté\0033)"
        puthelp "privmsg $nick :"
        puthelp "privmsg $nick :\037\00300,2Gestion des Salons à Modérer\037\00300,2"
        puthelp "privmsg $nick :\0034Level Admin Bot\0034"
        puthelp "privmsg $nick :\0035.listchan\0035 (\0033Permet de lister les chans modérés\0033)"
        puthelp "privmsg $nick :\0035.+chan\0035 <\0034#chan\0034> (\0033Permet d'ajouter un chan à modérer\0033)"
        puthelp "privmsg $nick :\0035.-chan\0035 <\0034#chan\0034> (\0033Permet de supprimer un chan à modérer\0033)"
        puthelp "privmsg $nick :\0034Level Admin Bot\0034"
        puthelp "privmsg $nick :"
        puthelp "privmsg $nick :\00300,2_______________\002Fin - Aide\002_______________\00300,2"
    }
}


J'ai oublié et aussi pas eut la fois de modifié pour le rajouter
Vous interdisez les erreurs, vous empêchez ainsi la victoire.

Ma super kikoo-page loll
  Reply
#2
Salut.
Jai un soucis avec le script

J'ai ce message sur SSH:

Tcl error in file 'eggdrop.conf':
can't define "fichier(modchan)": name refers to an element in an array
while executing
"variable fichier(modchan) "modchan.chan""
(in namespace eval "::mod" script line 60)
invoked from within
"namespace eval ::mod {

# Nous vérifions si ya le package requis pour le msgcat.
package require msgcat
# Nous mettons la langue de m..."
(file "scripts/Moderation.tcl" line 12)
invoked from within
"source scripts/Moderation.tcl"
(file "eggdrop.conf" line 111)
* FICHIER DE CONFIGURATION NON CHARGE (INTROUVABLE OU ERREUR)
  Reply
#3
Effectivement, ce script ne semble pas avoir été testé par l'auteur.
Il faut remplacer les lignes 71 à 76 par:

tcl
variable fichier
array set fichier {
   modchan "modchan.chan"
   modmot "modmot.mot"
   modspam "modspam.spam"
   modnick "modnick.nick"
   protect "protect.protect"
   blacklist "blacklist.black"
}

zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
  Reply
#4
Salut,

Je te file une légère modification tu me dit ce que sa donne. Pour la partie msgcat normalement c'est dans la librairie tcl8.5


tcl
####################################################################################################################
# Moderation.tcl                                                                                                   #
#                                                                                                                  #
# Script TCL de modération, fonctionnalité du code :                                                               #
# Anti-Majuscules, Anti-Répétition, Mode-Language, Mode-Spam, Anti-MassFlood, Anti-MassJoin, Mode-Nick, Blacklist. #
# Mode Vip Automatique                                                                                             #
#                                                                                                                  #
# Ce code et de base de Platine, version débug et modifié en Namespace avec des rajouts de commandes etc.          #
#                                                                                                                  #
####################################################################################################################
 
namespace eval ::mod {
 
    # Nous vérifions si ya le package requis pour le msgcat.
    package require msgcat
    # Nous mettons la langue de msgcat en français
    ::msgcat::mclocale fr
    # Les messages msgcat.
    ::msgcat::mcset fr AvertMaj "Doucement sur les majuscules !"
    ::msgcat::mcset fr KickMaj "Si tu veux crier tu vas dehors !"
    ::msgcat::mcset fr AvertRep "N'abuse pas des répétitions !"
    ::msgcat::mcset fr KickRep "Tu n'as pas besoin de te répéter autant de fois !"
    ::msgcat::mcset fr AvertLan "Fais attention à ton langage ! Si tu continues tu te feras expulser !"
    ::msgcat::mcset fr KickLan "Reviens nous voir dans 10 minutes en espérant que tu auras changer de langage !"
    ::msgcat::mcset fr AvertSpam "Si tu veux envoyé un lien c'est en Pv et pas en salon !"
    ::msgcat::mcset fr KickSpam "Va faire ta pub ailleurs !"
    ::msgcat::mcset fr KickNick "Veuillez modifier votre pseudo car celui-ci est incorrect !"
    ::msgcat::mcset fr KickBlack "\02\[\002Systeme B.A.V\02]\002 Indésirable!!"
    ::msgcat::mcset fr KickNoti "Pas de Notice Salon !"
    ::msgcat::mcset fr KickNic "Veuillez modifier votre pseudo car celui-ci est incorrect !"
    # Les limitations/Nombres
    # Expiration de la detection pour les majuscules (en seconde) ?
    set expiration(majuscule) "60"
    # Nombre de majuscule à détecter ?
    set detect(majuscule) "25"
    # Combien d'avertissement avant le kick ?
    set avert(majuscule) "1"
    # Expiration de la detection pour les repetitions (en seconde) ?
    set expiration(repetition) "60"
    # Nombre de repetition à détecter ?
    set detect(repetition) "6"
    # Combien d'avertissement avant le kick ?
    set avert(repetition) "1"
    # Expiration de la detection pour le langage (en seconde) ?
    set expiration(mot) "600"
    # Combien d'avertissement avant le kickban ?
    set avert(mot) "3"
    # Expiration de la detection pour le spam (en seconde) ?
    set expiration(spam) "600"
    # Combien d'avertissement avant le kickban ?
    set avert(spam) "1"
    # Nombre de message lors d'une détection mass/flood
    set mass(flood) "15"
    # Temp de rehash pour la remise à 0 du mass/flood (en seconde)
    set mass(rehashflood) "1"
    # Temp pour le retrait du +m (en minute)
    set mass(retraitm) "2"
    # Nombre de join lors d'une détection mass/join
    set mass(join) "10"
    # Temp de rehash pour la remise à 0 du mass/join (en seconde)
    set mass(rehashjoin) "1"
    # Temp pour le retrait du +i (en minute)
    set mass(retraiti) "2"
    # Salon de log
    set salonm "#Back-Eggdrop"
 
##########################
# création des fichiers. #
##########################
 
set fichier(modchan) "modchan.chan"
set fichier(modmot) "modmot.mot"
set fichier(modspam) "modspam.spam"
set fichier(modnick) "modnick.nick"
set fichier(protect) "protect.protect"
set fichier(blacklist) "blacklist.black"
 
set fichiers [list $::mod::fichier(modchan) $::mod::fichier(modmot) $::mod::fichier(modspam) $::mod::fichier(modnick) $::mod::fichier(protect) $::mod::fichier(blacklist)]
foreach txt $fichiers {
    if {![file exists $txt]} {
        set load [open $txt w+]
        close $load
        putlog "\2Je créer le(s) fichier(s) $fichiers\2"
    }
}
 
###################
# Les procédures. #
###################
 
bind pubm - "*" [namespace current]::moderation
proc moderation { nick host handle channel arg } {
    set arg [split $arg]
    set msg [join [lrange [split $arg] 0 end]]
    set hostv $nick!$host
    set userhost [getchanhost $nick]
    set userhost "*!*[string range $userhost [string first @ $userhost] e]"
    regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $msg "" msg
    regsub -all -- {\{|\}|\\{|[}{|]}} $msg "" msg
    if {![verify:b $::mod::fichier(modchan) $channel]} {
        return
    }
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![info exists modmajuscule($host)]} {
        set modmajuscule($host) 0
        utimer $::mod::expiration(majuscule) [list unset modmajuscule($host)]
    }
    set nombre 0
    foreach x [split $msg {}] {
        if [string match \[A-Z\] $x] {
            incr nombre
        }
    }
    if {$nombre > $::mod::detect(majuscule)} {
        incr modmajuscule($host) 1
        if {$::mod::avert(majuscule) < $modmajuscule($host)} {
            putnow "kick $channel $nick :[::msgcat::mc KickMaj]"
            set modmajuscule($host) 0
            return
        }
        putserv "NOTICE $nick :[::msgcat::mc AvertMaj]"
    }
    if {[info exists rpt($nick)]} {
        if {[lrange $rpt($nick) 2 end]  eq  "$msg"} {
            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] > $::mod::detect(repetition)} {
                if {![info exists modrepetition($host)]} {
                    set modrepetition($host) 0
                    utimer $::mod::expiration(repetition) [list unset modrepetition($host)]
                }
                incr modrepetition($host) 1
                if {$::mod::avert(repetition) < $modrepetition($host)} {
                    putnow "kick $channel $nick :[::msgcat::mc KickRep]"
                    set modrepetition($host) 0
                    return
                }
                putserv "NOTICE $nick :[::msgcat::mc AvertRep]"
                unset rpt($nick)
            }
            } else {
                set rpt($nick) "[expr [clock seconds] + 10] 1 $msg"
            }
            } else {
                set rpt($nick) "[expr [clock seconds] + 10] 1 $msg"
            }
            if {[verify:a $::mod::fichier(modmot) $msg]} {
                if {![info exists modmot($host)]} {
                    set modmot($host) 0
                    utimer $::mod::expiration(mot) [list unset modmot($host)]
                }
                incr modmot($host) 1
                if {$::mod::avert(mot) < $modmot($host)} {
                    putnow "mode $channel +b $userhost"
                    putquick "kick $channel $nick :[msgcat::mc KickLan]"
                    set modmot($host) 0
                    return
                }
                putserv "NOTICE $nick :[::msgcat::mc AvertLan]"
            }
            if {[verify:a $::mod::fichier(modspam) $msg]} {
                if {![info exists modspam($host)]} {
                    set modspam($host) 0
                    utimer $::mod::expiration(spam) [list unset modspam($host)]
                }
                incr modspam($host) 1
                if {$::avert(spam) < $modspam($host)} {
                    putnow "mode $channel +b $userhost"
                    putquick "kick $channel $nick :[::mdscat::mc KickSpam]"
                    set modspam($host) 0
                    return
                }
                putserv "NOTICE $nick :[::msgcat::mc AvertSpam]"
            }
}
 
bind pubm - "*" [namespace current]::massflood
proc massflood { nick uhost handle chan arg } {
    set hostv $nick!$uhost
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    if {![info exists massflood($chan)]} {
        set massflood($chan) 0
        utimer $::mod::mass(rehashflood) [list unset $massflood($chan)]
        incr $massflood($chan) 1
        if {$massflood($chan) eq "$::mod::mass(flood)"} {
            putserv "mode $chan +m"
            timer $::mass(retraitm) [list putserv "mode $chan -m"]
        }
    }
}
 
bind join - "*" [namespace current]::massjoin
proc massjoin {nick host hand chan} {
    set hostv $nick!$host
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    if {![info exists massjoin($chan)]} {
        set massjoin($chan) 0
        utimer $::mod::mass(rehashjoin) [list unset massjoin($chan)]
    }
    incr massjoin($chan) 1
    if {$::massjoin($chan) eq "$::massjoin($chan)"} {
        putserv "mode $chan +i"
        timer $::mass(retraitm) [list putserv "mode $chan -i"]
    }
}
 
bind notc - "*" [namespace current]::noticechan
proc noticechan {nick host handle text chan} {
    set hostv $nick!$host
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    putnow "mode $chan +b $userhost"
    putquick "kick $chan $nick :[::msgcat::mc KickNoti]"
}
 
bind dcc m "+modspam" [namespace current]::+modspam
proc +modspam {hand idx arg} {
    set spam [lindex $arg 0]
    if {$spam eq ""} {
        putdcc $idx "\002Erreur :\002 .+modspam <spam>"
        putdcc $idx "\002Exemple :\002 .+modspam *.*.com*"
        return
    }
    if {[verify:b $::mod::fichier(modspam) $spam]} {
        putdcc $idx "\002Erreur :\002 $spam est déjà enregistré."
        return
    }
    putdcc $idx "\002+modspam :\002 $spam a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modspam) $spam
}
 
bind dcc n "-modspam" [namespace current]::-modspam
proc -modspam {hand idx arg} {
    set spam [lindex $arg 0]
    if {$spam eq ""} {
        putdcc $idx "\002Erreur :\002 .-modspam <spam>"
        return
    }
    if {![verify:b $::mod::fichier(modspam) $spam]} {
        putdcc $idx "\002Erreur :\002 Le spam $spam n'est pas enregistré."
        return
    }
    putdcc $idx "\002-modspam :\002 $spam n'est plus enregistré."
    effacer:donnee $::mod::fichier(modspam) $spam
}
 
bind dcc m  "modspam" [namespace current]::modspam
proc modspam {hand idx arg} {
    putdcc $idx "---\002 LISTE DES SPAMS \002---"
    liste:donnee $idx $::mod::fichier(modspam)
}
 
bind pub o|o ".+spam" [namespace current]::+spam
proc +spam {nick uhost handle chan text} {
    set motspam [lindex $text 0]
    if {$motspam eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+spam <mot spam>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+spam msn.com"
        return
    }
    if {[verify:b $::mod::fichier(modspam) $motspam]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $motspam est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système AntiSpam\02]\002 \02$motspam \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modspam) $motspam
}
 
bind pub o|o ".-spam" [namespace current]::-spam
proc -spam {nick uhost handle chan text} {
    set motspam [lindex $text 0]
    if {$motspam eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-spam <motspam>"
        return
    }
    if {![verify:b $::mod::fichier(modspam) $motspam]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$motspam \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système AntiSpam\02]\002 \02$motspam \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modspam) $motspam
}
 
bind pub o|o ".spamlist" [namespace current]::pub:spamlist
proc pub:spamlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modspam) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :PRIVMSG $nick :\0032Liste des Spams\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc n "+modchan" [namespace current]::+modchan
proc +modchan {hand idx arg} {
    set chan [lindex $arg 0]
    if {$chan eq ""||[string index $chan 0] ne "#"} {
        putdcc $idx "\002Erreur :\002 .+modchan <#chan>"
        return
    }
    if {[verify:b $::mod::fichier(modchan) $chan]} {
        putdcc $idx "\002Erreur :\002 $chan est déjà modérer."
        return
    }
    putdcc $idx "\002+modchan :\002 $chan a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modchan) $chan
}
 
bind dcc n "-modchan" [namespace current]::-modchan
proc -modchan {hand idx arg} {
    set chan [lindex $arg 0]
    if {$chan eq ""||[string index $chan 0] ne "#"} {
        putdcc $idx "\002Erreur :\002 .-modchan <#chan>"
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        putdcc $idx "\002Erreur :\002 Le chan $chan n'est pas modérer."
        return
    }
    putdcc $idx "\002-modchan :\002 $chan n'est plus modéré."
    effacer:donnee $::mod::fichier(modchan) $chan
}
 
bind dcc n "modchan" [namespace current]::modchan
proc modchan {hand idx arg} {
    putdcc $idx "---\002 Liste des chans modérer \002---"
    liste:donnee $idx $::mod::fichier(modchan)
}
 
bind pub o|o ".+chan" [namespace current]::+chan
proc +chan {nick uhost handle chan text} {
    set moderechan [lindex $text 0]
    if {$moderechan eq "" ||[string index $chan 0] ne "#"} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+chan <#Salon>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+chan #Radio"
        return
    }
    if {[verify:b $::mod::fichier(modchan) $moderechan]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $moderechan est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Moderation Salon\02]\002 \02$moderechan \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modchan) $moderechan
}
 
bind pub o|o ".-chan" [namespace current]::-chan
proc -chan {nick uhost handle chan text} {
    set moderechan [lindex $text 0]
    if {$moderechan eq "" ||[string index $chan 0] ne "#"} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-chan <#Salon>"
        return
    }
    if {![verify:b $::mod::fichier(modchan) $moderechan]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$moderechan \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Moderation Salon\02]\002 \02$moderechan \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modchan) $moderechan
}
 
bind pub o|o ".listchan" [namespace current]::pub:listchan
proc pub:listchan {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modchan) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Salons\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc n "+modmot" [namespace current]::+modmot
proc +modmot {hand idx arg} {
    set mot [lindex $arg 0]
    if {$mot eq ""} {
        putdcc $idx "\002Erreur :\002 .+modmot <mot>"
        return
    }
    if {[verify:b $::mod::fichier(modmot) $mot]} {
        putdcc $idx "\002Erreur :\002 $mot est déjà enregistré."
        return
    }
    putdcc $idx "\002+modmot :\002 $mot a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modmot) $mot
}
 
bind dcc n "-modmot" [namespace current]::-modmot
proc -modmot {hand idx arg} {
    set mot [lindex $arg 0]
    if {$mot eq ""} {
        putdcc $idx "\002Erreur :\002 .-modmot <mot>"
        return
    }
    if {![verify:b $::mod::fichier(modmot) $mot]} {
        putdcc $idx "\002Erreur :\002 Le mot $mot n'est pas enregistré."
        return
    }
    putdcc $idx "\002-modmot :\002 $mot n'est plus enregistré."
    effacer:donnee $::mod::fichier(modmot) $mot
}
 
bind dcc n "modmot" [namespace current]::modmot
proc modmot {hand idx arg} {
    putdcc $idx "---\002 Liste des mots interdit \002---"
    liste:donnee $idx $::mod::fichier(modmot)
}
 
bind pub o|o ".+badmot" [namespace current]::+badmot
proc +badmot {nick uhost handle chan text} {
    set mot [lindex $text 0]
    if {$mot eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+badmot <mot>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+badmot con"
        return
    }
    if {[verify:b $::mod::fichier(modmot) $mot]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $mot est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Badmot\02]\002 \02$mot \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modmot) $mot
}
 
bind pub o|o ".-badmot" [namespace current]::-badmot
proc -badmot {nick uhost handle chan text} {
    set mot [lindex $text 0]
    if {$mot eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-badmot <mot>"
        return
    }
    if {![verify:b $::mod::fichier(modmot) $mot]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$mot \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Badmot\02]\002 \02$mot \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modmot) $mot
}
 
bind pub o|o ".badmotlist" [namespace current]::pub:badmotlist
proc pub:badmotlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modmot) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Badmot\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc n "+modnick" [namespace current]::+modnick
proc +modnick {hand idx arg} {
    set nick [lindex $arg 0]
    if {$nick eq ""} {
        putdcc $idx "\002Erreur :\002 .+modnick <nick>"
        putdcc $idx "\002Exemple :\002 .+modnick *.*.com*"
        return
    }
    if {[verify:b $::mod::fichier(modnick) $nick]} {
        putdcc $idx "\002Erreur :\002 $nick est déjà enregistré."
        return
    }
    putdcc $idx "\002+modnick :\002 $nick a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modnick) $nick
}
 
bind dcc n "-modnick" [namespace current]::-modnick
proc -modnick {hand idx arg} {
    set nick [lindex $arg 0]
    if {$nick eq ""} {
        putdcc $idx "\002Erreur :\002 .-modnick <nick>"
        return
    }
    if {![verify:b $::mod::fichier(modnick) $nick]} {
        putdcc $idx "\002Erreur :\002 Le nick $nick n'est pas enregistré."
        return
    }
    putdcc $idx "\002-modnick :\002 $nick n'est plus enregistré."
    effacer:donnee $::mod::fichier(modnick) $nick
}
 
bind dcc n "modnick" [namespace current]::dcc:modnick
proc dcc:modnick {hand idx arg} {
    putdcc $idx "---\002 Liste des nicks \002---"
    liste:donnee $idx $::mod::fichier(modnick)
}
 
bind pub o|o ".+badnick" [namespace current]::+badnick
proc +badnick {nick uhost handle chan text} {
    set nick [lindex $text 0]
    if {$nick eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+badnick <pseudo>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+badnick h_pour_cam*!*@*"
        return
    }
    if {[verify:b $::mod::fichier(modnick) $nick]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $nick est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Badnick\02]\002 \02$nick \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modnick) $nick
}
 
bind pub o|o ".-badnick" [namespace current]::-badnick
proc -badnick {nick uhost handle chan text} {
    set nick [lindex $text 0]
    if {$nick eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-badnick <pseudo>"
        return
    }
    if {![verify:b $::mod::fichier(modnick) $nick]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$nick \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système badnick\02]\002 \02$nick \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modnick) $nick
}
 
bind pub o|o ".badnicklist" [namespace current]::pub:badnicklist
proc pub:badnicklist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modnick) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Badnick\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind join - "*" [namespace current]::modnick
proc modnick { nick uhost handle channel } {
    set hostv $nick!$uhost
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {[string equal -nocase $nick $::botnick]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $channel]} {
        return
    }
    if {![verify:a $::mod::fichier(modnick) $nick]} {
        return
    }
    putnow "MODE $channel +b $nick*!*"
    putquick "KICK $channel $nick :[::msgcat::mc KickNic]"
}
 
bind nick - "*" [namespace current]::modnicksuite
proc modnicksuite { nick uhost handle chan newnick } {
    set hostv $nick!$uhost
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {[string equal -nocase $nick $::botnick]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    if {![verify:a $::mod::fichier(modnick) $nick]} {
        return
    }
    putnow "MODE $chan +b $newnick*!*"
    putquick "KICK $channel $nick :[::msgcat::mc KickNic]"
}
 
bind pub o|o ".+bav" [namespace current]::+bav
proc +bav {nick uhost handle chan text} {
    set host [lindex $text 0]
    set pseudo [lindex $text 0]
    if {$host eq "" } {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+bav <host>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+bav *!*@0000000.com"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+bav alias_angelius*!*"
        return
    }
    if {$pseudo eq "" || ![string match **!*@* $pseudo]} {
        putserv "PRIVMSG $chan :\0034Erreur\0034 : \0031.+bav <\0034host\0034\0031> ou <\0034pseudo*!*@*\0034\0031>"
        putserv "PRIVMSG $chan :\0031Exemple : \0031\0034.+bav *!*@0000000.com\0034"
        putserv "PRIVMSG $chan : \0031Exemple : \0031\0034.+bav bOulet*!*@*\0034"
        return
    }
    if {[verify:b $::mod::fichier(protect) $host]} {
        putserv "PRIVMSG $chan :\0034Refusé : \0034\002 Tu ne peux pas Blacklisté un host ou pseudo protégé.\002"
        putserv "PRIVMSG $::salonm :\0034\|Mode.Alerte.Admin\|\003\ \0034ATTENTION: \00314$nick \0034Host: \00314$uhost \0034a tenté de Blacklister \00314$pseudo \0034Host: \00314$host \0034sur: \00314$chan"
        return 1
    }
    if {[verify:b $::mod::fichier(blacklist) $host]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\002\[\002Système BAV\002]\002 \002$host \002à été mis dans la liste.\002"
    ajouter:donnee $::mod::fichier(blacklist) $host
}
 
bind pub o|o ".-bav" [namespace current]::-bav
proc -bav {nick uhost handle chan text} {
    set host [lindex $text 0]
    if {$host eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-bav <host>"
        return
    }
    if {![verify:b $::mod::fichier(blacklist) $host]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$host \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système BAV\02]\002 \02$host \002 n'est plus BAV."
    effacer:donnee $::mod::fichier(blacklist) $host
}
 
bind pub o|o ".bavlist" [namespace current]::pub:bavlist
proc pub:bavlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(blacklist) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Blacklistés\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc m "+blacklist" [namespace current]::+blacklist
proc +blacklist {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .+blacklist <host>"
        putdcc $idx "\002Exemple :\002 .+blacklist toto*!*@*.ru"
        return
    }
    if {[verify:b $::mod::fichier(blacklist) $host]} {
        putdcc $idx "\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putdcc $idx "\002+blacklist :\002 $host a été mis dans la liste."
    ajouter:donnee $::mod::fichier(blacklist) $host
}
 
bind dcc m "-blacklist" [namespace current]::-blacklist
proc -blacklist {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .-blacklist <host>"
        return
    }
    if {![verify:b $::mod::fichier(blacklist) $host]} {
        putdcc $idx "\002Erreur :\002 Le host $host n'est pas enregistré."
        return
    }
    putdcc $idx "\002-blacklist :\002 $host n'est plus enregistré."
    effacer:donnee $::mod::fichier(blacklist) $host
}
 
bind dcc m "blacklist" [namespace current]::dcc:blacklist
proc dcc:blacklist {hand idx arg} {
    putdcc $idx "\002 Liste des Ban à Vue\002"
    liste:donnee $idx $::mod::fichier(blacklist)
}
 
bind join - "*" [namespace current]::modblacklist
proc modblacklist { nick host handle channel } {
    set hostv $nick!$host
    set userhost [getchanhost $nick]
    set userhost "*!*[string range $userhost [string first @ $userhost] e]"
    set expire "expire le [clock format [expr 3600 + [clock second]] -format "%d/%m/%Y à %H:%M (GMT+1)"]"
    set heure "[clock format [clock seconds] -format "%Y/%m/%d %H:%M"]"
    if {[string equal -nocase $nick $::botnick]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $channel]} {
        return
    }
    if {![verify:a $::mod::fichier(blacklist) $hostv]} {
        return
    }
    putquick "KICK $channel $nick :[::msgcat::mc KickBlack] $expire"
    putquick "MODE $channel +b $nick*!*@*"
    putquick "MODE $channel +b $userhost"
    putserv "PRIVMSG $::salonm :\0034\|Mod.KickBan.Blacklist\|\003\ \0034KickBan pour: \00314$nick \0034Host: \00314$userhost \0034(Raison: \00314$::kick(blacklist) ($expire)\0034) \0034sur: \00314$channel"
}
 
bind dcc o|o "+xprotect" [namespace current]::+xprotect
proc +xprotect {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .+protect <host>"
        putdcc $idx "\002Exemple :\002 .+protect alias_angelius*!*@*"
        return
    }
    if {[verify:b $::mod::fichier(protect) $host]} {
        putdcc $idx "\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putdcc $idx "\002+protect :\002 Le host $host est maintenant protégé."
    ajouter:donnee $::mod::fichier(protect) $host
}
 
bind dcc o|o "-xprotect" [namespace current]::-xprotect
proc -xprotect {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .-protect <host>"
        return
    }
    if {![verify:b $::mod::fichier(protect) $host]} {
        putdcc $idx "\002Erreur :\002 Le host $host n'est pas enregistré."
        return
    }
    putdcc $idx "\002-protect :\002 Le host $host n'est plus protégé."
    effacer:donnee $::mod::fichier(protect) $host
}
 
bind dcc o|o "xprotect" [namespace current]::xprotect
proc xprotect {hand idx arg} {
    putdcc $idx "---\002 Liste des protégé contre la modération \002---"
    liste:donnee $idx $::mod::fichier(protect)
}
 
bind pub o|o ".+protect" [namespace current]::+protect
proc +protect {nick uhost handle chan text} {
    set host [lindex $text 0]
    if {$host eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+protect <pseudo/host>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+protect alias_angelius*!*@*"
        return
    }
    if {[verify:b $::mod::fichier(protect) $host]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Protect\02]\002 \02$host \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(protect) $host
}
 
bind pub m ".-protect" [namespace current]::-protect
proc -protect {nick uhost handle chan text} {
    set host [lindex $text 0]
    if {$host eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-protect <pseudo/host>"
        return
    }
    if {![verify:b $::mod::fichier(protect) $host]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$host \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Protect\02]\002 \02$host \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(protect) $host
}
 
bind pub o|o ".protectlist" [namespace current]::pub:protectlist
proc pub:protectlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(protect) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "NOTICE $nick :\0032Liste des Protégés\0032"
            putserv "NOTICE $nick :\0034 $fc - $data\0034"
        }
        unset data
    }
    close $fp
    putserv "NOTICE $nick :\0032Fin de liste"
}
 
proc verify:a {fichierss arg} {
    set liste [open $fichierss r]
    while {![eof $liste]} {
        gets $liste a
        regsub -all -- {\{|\}|\\{|[}{|]}} $a "" a
        if {$a ne ""} {
            if {[string match -nocase *$a* $arg]} {
                close $liste
                return 1
            }
        }
    }
    close $liste
    return 0
}
 
proc verify:b {fichierss arg} {
    set liste [open $fichierss r]
    while {![eof $liste]} {
        gets $liste a
        regsub -all -- {\{|\}|\\{|[}{|]}} $a "" a
        if {$a ne ""} {
            if {[string equal -nocase $a $arg]} {
                close $liste
                return 1
            }
        }
    }
    close $liste
    return 0
}
 
proc ajouter:donnee {fichierss arg} {
    set liste [open $fichierss a]
    puts $liste "$arg"
    close $liste
}
 
proc effacer:donnee {fichierss arg} {
    set fichier(back) "$fichierss.back"
    set load [open $fichier(back) w+]
    close $load
    set liste [open $fichierss r]
    set bcloseback [open $fichier(back) a]
    while {![eof $liste]} {
        gets $liste a
        if {$a ne ""} {
            if {[string equal -nocase [lindex $a 0] $arg]} {
                } else {
                    puts $bcloseback "[lindex $a]"
                }
        }
    }
    close $liste
    close $bcloseback
    file delete $fichierss
    file rename $fichier(back) $fichierss
}
 
proc liste:donnee {idx fichierss} {
    set liste [open $fichierss r]
    set num 0
    while {![eof $liste]} {
        gets $liste a
        if {$a ne ""} {
            incr num 1
            putdcc $idx "(\002$num\002) [lindex $a 0]"
        }
    }
    if {$num eq "0"} {
        putdcc $idx "Aucun enregistrement."
    }
    putdcc $idx "---\002 FIN DE LA LISTE \002--- Total (\002$num\002)"
    close $liste
    unset num
}
}


Si JAMAIS tu as encore une erreur dit le moi ici, et je te filerais un autre code de modération complétement différent codé d'une autre manière différente !

AAh pas vus ta réponse CC, en effet ta solution es meilleurs :)
Vous interdisez les erreurs, vous empêchez ainsi la victoire.

Ma super kikoo-page loll
  Reply
#5
(26/06/2021, 00:15)CrazyCat Wrote: Effectivement, ce script ne semble pas avoir été testé par l'auteur.
Il faut remplacer les lignes 71 à 76 par:

tcl
variable fichier
array set fichier {
  modchan "modchan.chan"
  modmot "modmot.mot"
  modspam "modspam.spam"
  modnick "modnick.nick"
  protect "protect.protect"
  blacklist "blacklist.black"
}

Merci CrazyCat de votre aide.
Désolé je savais pas pour le MP. C noté :)
  Reply
#6
(26/06/2021, 00:24)aliasangelius Wrote: Salut,

Je te file une légère modification tu me dit ce que sa donne. Pour la partie msgcat normalement c'est dans la librairie tcl8.5


tcl
####################################################################################################################
# Moderation.tcl                                                                                                  #
#                                                                                                                  #
# Script TCL de modération, fonctionnalité du code :                                                              #
# Anti-Majuscules, Anti-Répétition, Mode-Language, Mode-Spam, Anti-MassFlood, Anti-MassJoin, Mode-Nick, Blacklist. #
# Mode Vip Automatique                                                                                            #
#                                                                                                                  #
# Ce code et de base de Platine, version débug et modifié en Namespace avec des rajouts de commandes etc.          #
#                                                                                                                  #
####################################################################################################################
 
namespace eval ::mod {
    
    # Nous vérifions si ya le package requis pour le msgcat.
    package require msgcat
    # Nous mettons la langue de msgcat en français
    ::msgcat::mclocale fr
    # Les messages msgcat.
    ::msgcat::mcset fr AvertMaj "Doucement sur les majuscules !"
    ::msgcat::mcset fr KickMaj "Si tu veux crier tu vas dehors !"
    ::msgcat::mcset fr AvertRep "N'abuse pas des répétitions !"
    ::msgcat::mcset fr KickRep "Tu n'as pas besoin de te répéter autant de fois !"
    ::msgcat::mcset fr AvertLan "Fais attention à ton langage ! Si tu continues tu te feras expulser !"
    ::msgcat::mcset fr KickLan "Reviens nous voir dans 10 minutes en espérant que tu auras changer de langage !"
    ::msgcat::mcset fr AvertSpam "Si tu veux envoyé un lien c'est en Pv et pas en salon !"
    ::msgcat::mcset fr KickSpam "Va faire ta pub ailleurs !"
    ::msgcat::mcset fr KickNick "Veuillez modifier votre pseudo car celui-ci est incorrect !"
    ::msgcat::mcset fr KickBlack "\02\[\002Systeme B.A.V\02]\002 Indésirable!!"
    ::msgcat::mcset fr KickNoti "Pas de Notice Salon !"
    ::msgcat::mcset fr KickNic "Veuillez modifier votre pseudo car celui-ci est incorrect !"
    # Les limitations/Nombres
    # Expiration de la detection pour les majuscules (en seconde) ?
    set expiration(majuscule) "60"
    # Nombre de majuscule à détecter ?
    set detect(majuscule) "25"
    # Combien d'avertissement avant le kick ?
    set avert(majuscule) "1"
    # Expiration de la detection pour les repetitions (en seconde) ?
    set expiration(repetition) "60"
    # Nombre de repetition à détecter ?
    set detect(repetition) "6"
    # Combien d'avertissement avant le kick ?
    set avert(repetition) "1"
    # Expiration de la detection pour le langage (en seconde) ?
    set expiration(mot) "600"
    # Combien d'avertissement avant le kickban ?
    set avert(mot) "3"
    # Expiration de la detection pour le spam (en seconde) ?
    set expiration(spam) "600"
    # Combien d'avertissement avant le kickban ?
    set avert(spam) "1"
    # Nombre de message lors d'une détection mass/flood
    set mass(flood) "15"
    # Temp de rehash pour la remise à 0 du mass/flood (en seconde)
    set mass(rehashflood) "1"
    # Temp pour le retrait du +m (en minute)
    set mass(retraitm) "2"
    # Nombre de join lors d'une détection mass/join
    set mass(join) "10"
    # Temp de rehash pour la remise à 0 du mass/join (en seconde)
    set mass(rehashjoin) "1"
    # Temp pour le retrait du +i (en minute)
    set mass(retraiti) "2"
    # Salon de log
    set salonm "#Back-Eggdrop"
    
##########################
# création des fichiers. #
##########################
 
set fichier(modchan) "modchan.chan"
set fichier(modmot) "modmot.mot"
set fichier(modspam) "modspam.spam"
set fichier(modnick) "modnick.nick"
set fichier(protect) "protect.protect"
set fichier(blacklist) "blacklist.black"
 
set fichiers [list $::mod::fichier(modchan) $::mod::fichier(modmot) $::mod::fichier(modspam) $::mod::fichier(modnick) $::mod::fichier(protect) $::mod::fichier(blacklist)]
foreach txt $fichiers {
    if {![file exists $txt]} {
        set load [open $txt w+]
        close $load
        putlog "\2Je créer le(s) fichier(s) $fichiers\2"
    }
}
 
###################
# Les procédures. #
###################
 
bind pubm - "*" [namespace current]::moderation
proc moderation { nick host handle channel arg } {
    set arg [split $arg]
    set msg [join [lrange [split $arg] 0 end]]
    set hostv $nick!$host
    set userhost [getchanhost $nick]
    set userhost "*!*[string range $userhost [string first @ $userhost] e]"
    regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $msg "" msg
    regsub -all -- {\{|\}|\\{|[}{|]}} $msg "" msg
    if {![verify:b $::mod::fichier(modchan) $channel]} {
        return
    }
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![info exists modmajuscule($host)]} {
        set modmajuscule($host) 0
        utimer $::mod::expiration(majuscule) [list unset modmajuscule($host)]
    }
    set nombre 0
    foreach x [split $msg {}] {
        if [string match \[A-Z\] $x] {
            incr nombre
        }
    }
    if {$nombre > $::mod::detect(majuscule)} {
        incr modmajuscule($host) 1
        if {$::mod::avert(majuscule) < $modmajuscule($host)} {
            putnow "kick $channel $nick :[::msgcat::mc KickMaj]"
            set modmajuscule($host) 0
            return
        }
        putserv "NOTICE $nick :[::msgcat::mc AvertMaj]"
    }
    if {[info exists rpt($nick)]} {
        if {[lrange $rpt($nick) 2 end]  eq  "$msg"} {
            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] > $::mod::detect(repetition)} {
                if {![info exists modrepetition($host)]} {
                    set modrepetition($host) 0
                    utimer $::mod::expiration(repetition) [list unset modrepetition($host)]
                }
                incr modrepetition($host) 1
                if {$::mod::avert(repetition) < $modrepetition($host)} {
                    putnow "kick $channel $nick :[::msgcat::mc KickRep]"
                    set modrepetition($host) 0
                    return
                }
                putserv "NOTICE $nick :[::msgcat::mc AvertRep]"
                unset rpt($nick)
            }
            } else {
                set rpt($nick) "[expr [clock seconds] + 10] 1 $msg"
            }
            } else {
                set rpt($nick) "[expr [clock seconds] + 10] 1 $msg"
            }
            if {[verify:a $::mod::fichier(modmot) $msg]} {
                if {![info exists modmot($host)]} {
                    set modmot($host) 0
                    utimer $::mod::expiration(mot) [list unset modmot($host)]
                }
                incr modmot($host) 1
                if {$::mod::avert(mot) < $modmot($host)} {
                    putnow "mode $channel +b $userhost"
                    putquick "kick $channel $nick :[msgcat::mc KickLan]"
                    set modmot($host) 0
                    return
                }
                putserv "NOTICE $nick :[::msgcat::mc AvertLan]"
            }
            if {[verify:a $::mod::fichier(modspam) $msg]} {
                if {![info exists modspam($host)]} {
                    set modspam($host) 0
                    utimer $::mod::expiration(spam) [list unset modspam($host)]
                }
                incr modspam($host) 1
                if {$::avert(spam) < $modspam($host)} {
                    putnow "mode $channel +b $userhost"
                    putquick "kick $channel $nick :[::mdscat::mc KickSpam]"
                    set modspam($host) 0
                    return
                }
                putserv "NOTICE $nick :[::msgcat::mc AvertSpam]"
            }
}
 
bind pubm - "*" [namespace current]::massflood
proc massflood { nick uhost handle chan arg } {
    set hostv $nick!$uhost
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    if {![info exists massflood($chan)]} {
        set massflood($chan) 0
        utimer $::mod::mass(rehashflood) [list unset $massflood($chan)]
        incr $massflood($chan) 1
        if {$massflood($chan) eq "$::mod::mass(flood)"} {
            putserv "mode $chan +m"
            timer $::mass(retraitm) [list putserv "mode $chan -m"]
        }
    }
}
    
bind join - "*" [namespace current]::massjoin
proc massjoin {nick host hand chan} {
    set hostv $nick!$host
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    if {![info exists massjoin($chan)]} {
        set massjoin($chan) 0
        utimer $::mod::mass(rehashjoin) [list unset massjoin($chan)]
    }
    incr massjoin($chan) 1
    if {$::massjoin($chan) eq "$::massjoin($chan)"} {
        putserv "mode $chan +i"
        timer $::mass(retraitm) [list putserv "mode $chan -i"]
    }
}
 
bind notc - "*" [namespace current]::noticechan
proc noticechan {nick host handle text chan} {
    set hostv $nick!$host
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    putnow "mode $chan +b $userhost"
    putquick "kick $chan $nick :[::msgcat::mc KickNoti]"
}
 
bind dcc m "+modspam" [namespace current]::+modspam
proc +modspam {hand idx arg} {
    set spam [lindex $arg 0]
    if {$spam eq ""} {
        putdcc $idx "\002Erreur :\002 .+modspam <spam>"
        putdcc $idx "\002Exemple :\002 .+modspam *.*.com*"
        return
    }
    if {[verify:b $::mod::fichier(modspam) $spam]} {
        putdcc $idx "\002Erreur :\002 $spam est déjà enregistré."
        return
    }
    putdcc $idx "\002+modspam :\002 $spam a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modspam) $spam
}
 
bind dcc n "-modspam" [namespace current]::-modspam
proc -modspam {hand idx arg} {
    set spam [lindex $arg 0]
    if {$spam eq ""} {
        putdcc $idx "\002Erreur :\002 .-modspam <spam>"
        return
    }
    if {![verify:b $::mod::fichier(modspam) $spam]} {
        putdcc $idx "\002Erreur :\002 Le spam $spam n'est pas enregistré."
        return
    }
    putdcc $idx "\002-modspam :\002 $spam n'est plus enregistré."
    effacer:donnee $::mod::fichier(modspam) $spam
}
 
bind dcc"modspam" [namespace current]::modspam
proc modspam {hand idx arg} {
    putdcc $idx "---\002 LISTE DES SPAMS \002---"
    liste:donnee $idx $::mod::fichier(modspam)
}
 
bind pub o|o ".+spam" [namespace current]::+spam
proc +spam {nick uhost handle chan text} {
    set motspam [lindex $text 0]
    if {$motspam eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+spam <mot spam>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+spam msn.com"
        return
    }
    if {[verify:b $::mod::fichier(modspam) $motspam]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $motspam est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système AntiSpam\02]\002 \02$motspam \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modspam) $motspam
}
 
bind pub o|o ".-spam" [namespace current]::-spam
proc -spam {nick uhost handle chan text} {
    set motspam [lindex $text 0]
    if {$motspam eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-spam <motspam>"
        return
    }
    if {![verify:b $::mod::fichier(modspam) $motspam]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$motspam \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système AntiSpam\02]\002 \02$motspam \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modspam) $motspam
}
 
bind pub o|o ".spamlist" [namespace current]::pub:spamlist
proc pub:spamlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modspam) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :PRIVMSG $nick :\0032Liste des Spams\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc n "+modchan" [namespace current]::+modchan
proc +modchan {hand idx arg} {
    set chan [lindex $arg 0]
    if {$chan eq ""||[string index $chan 0] ne "#"} {
        putdcc $idx "\002Erreur :\002 .+modchan <#chan>"
        return
    }
    if {[verify:b $::mod::fichier(modchan) $chan]} {
        putdcc $idx "\002Erreur :\002 $chan est déjà modérer."
        return
    }
    putdcc $idx "\002+modchan :\002 $chan a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modchan) $chan
}
 
bind dcc n "-modchan" [namespace current]::-modchan
proc -modchan {hand idx arg} {
    set chan [lindex $arg 0]
    if {$chan eq ""||[string index $chan 0] ne "#"} {
        putdcc $idx "\002Erreur :\002 .-modchan <#chan>"
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        putdcc $idx "\002Erreur :\002 Le chan $chan n'est pas modérer."
        return
    }
    putdcc $idx "\002-modchan :\002 $chan n'est plus modéré."
    effacer:donnee $::mod::fichier(modchan) $chan
}
 
bind dcc n "modchan" [namespace current]::modchan
proc modchan {hand idx arg} {
    putdcc $idx "---\002 Liste des chans modérer \002---"
    liste:donnee $idx $::mod::fichier(modchan)
}
 
bind pub o|o ".+chan" [namespace current]::+chan
proc +chan {nick uhost handle chan text} {
    set moderechan [lindex $text 0]
    if {$moderechan eq "" ||[string index $chan 0] ne "#"} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+chan <#Salon>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+chan #Radio"
        return
    }
    if {[verify:b $::mod::fichier(modchan) $moderechan]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $moderechan est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Moderation Salon\02]\002 \02$moderechan \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modchan) $moderechan
}
 
bind pub o|o ".-chan" [namespace current]::-chan
proc -chan {nick uhost handle chan text} {
    set moderechan [lindex $text 0]
    if {$moderechan eq "" ||[string index $chan 0] ne "#"} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-chan <#Salon>"
        return
    }
    if {![verify:b $::mod::fichier(modchan) $moderechan]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$moderechan \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Moderation Salon\02]\002 \02$moderechan \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modchan) $moderechan
}
 
bind pub o|o ".listchan" [namespace current]::pub:listchan
proc pub:listchan {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modchan) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Salons\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc n "+modmot" [namespace current]::+modmot
proc +modmot {hand idx arg} {
    set mot [lindex $arg 0]
    if {$mot eq ""} {
        putdcc $idx "\002Erreur :\002 .+modmot <mot>"
        return
    }
    if {[verify:b $::mod::fichier(modmot) $mot]} {
        putdcc $idx "\002Erreur :\002 $mot est déjà enregistré."
        return
    }
    putdcc $idx "\002+modmot :\002 $mot a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modmot) $mot
}
 
bind dcc n "-modmot" [namespace current]::-modmot
proc -modmot {hand idx arg} {
    set mot [lindex $arg 0]
    if {$mot eq ""} {
        putdcc $idx "\002Erreur :\002 .-modmot <mot>"
        return
    }
    if {![verify:b $::mod::fichier(modmot) $mot]} {
        putdcc $idx "\002Erreur :\002 Le mot $mot n'est pas enregistré."
        return
    }
    putdcc $idx "\002-modmot :\002 $mot n'est plus enregistré."
    effacer:donnee $::mod::fichier(modmot) $mot
}
 
bind dcc n "modmot" [namespace current]::modmot
proc modmot {hand idx arg} {
    putdcc $idx "---\002 Liste des mots interdit \002---"
    liste:donnee $idx $::mod::fichier(modmot)
}
 
bind pub o|o ".+badmot" [namespace current]::+badmot
proc +badmot {nick uhost handle chan text} {
    set mot [lindex $text 0]
    if {$mot eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+badmot <mot>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+badmot con"
        return
    }
    if {[verify:b $::mod::fichier(modmot) $mot]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $mot est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Badmot\02]\002 \02$mot \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modmot) $mot
}
 
bind pub o|o ".-badmot" [namespace current]::-badmot
proc -badmot {nick uhost handle chan text} {
    set mot [lindex $text 0]
    if {$mot eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-badmot <mot>"
        return
    }
    if {![verify:b $::mod::fichier(modmot) $mot]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$mot \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Badmot\02]\002 \02$mot \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modmot) $mot
}
 
bind pub o|o ".badmotlist" [namespace current]::pub:badmotlist
proc pub:badmotlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modmot) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Badmot\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc n "+modnick" [namespace current]::+modnick
proc +modnick {hand idx arg} {
    set nick [lindex $arg 0]
    if {$nick eq ""} {
        putdcc $idx "\002Erreur :\002 .+modnick <nick>"
        putdcc $idx "\002Exemple :\002 .+modnick *.*.com*"
        return
    }
    if {[verify:b $::mod::fichier(modnick) $nick]} {
        putdcc $idx "\002Erreur :\002 $nick est déjà enregistré."
        return
    }
    putdcc $idx "\002+modnick :\002 $nick a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modnick) $nick
}
 
bind dcc n "-modnick" [namespace current]::-modnick
proc -modnick {hand idx arg} {
    set nick [lindex $arg 0]
    if {$nick eq ""} {
        putdcc $idx "\002Erreur :\002 .-modnick <nick>"
        return
    }
    if {![verify:b $::mod::fichier(modnick) $nick]} {
        putdcc $idx "\002Erreur :\002 Le nick $nick n'est pas enregistré."
        return
    }
    putdcc $idx "\002-modnick :\002 $nick n'est plus enregistré."
    effacer:donnee $::mod::fichier(modnick) $nick
}
 
bind dcc n "modnick" [namespace current]::dcc:modnick
proc dcc:modnick {hand idx arg} {
    putdcc $idx "---\002 Liste des nicks \002---"
    liste:donnee $idx $::mod::fichier(modnick)
}
 
bind pub o|o ".+badnick" [namespace current]::+badnick
proc +badnick {nick uhost handle chan text} {
    set nick [lindex $text 0]
    if {$nick eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+badnick <pseudo>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+badnick h_pour_cam*!*@*"
        return
    }
    if {[verify:b $::mod::fichier(modnick) $nick]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $nick est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Badnick\02]\002 \02$nick \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modnick) $nick
}
 
bind pub o|o ".-badnick" [namespace current]::-badnick
proc -badnick {nick uhost handle chan text} {
    set nick [lindex $text 0]
    if {$nick eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-badnick <pseudo>"
        return
    }
    if {![verify:b $::mod::fichier(modnick) $nick]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$nick \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système badnick\02]\002 \02$nick \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modnick) $nick
}
 
bind pub o|o ".badnicklist" [namespace current]::pub:badnicklist
proc pub:badnicklist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modnick) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Badnick\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind join - "*" [namespace current]::modnick
proc modnick { nick uhost handle channel } {
    set hostv $nick!$uhost
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {[string equal -nocase $nick $::botnick]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $channel]} {
        return
    }
    if {![verify:a $::mod::fichier(modnick) $nick]} {
        return
    }
    putnow "MODE $channel +b $nick*!*"
    putquick "KICK $channel $nick :[::msgcat::mc KickNic]"
}
 
bind nick - "*" [namespace current]::modnicksuite
proc modnicksuite { nick uhost handle chan newnick } {
    set hostv $nick!$uhost
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {[string equal -nocase $nick $::botnick]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    if {![verify:a $::mod::fichier(modnick) $nick]} {
        return
    }
    putnow "MODE $chan +b $newnick*!*"
    putquick "KICK $channel $nick :[::msgcat::mc KickNic]"
}
 
bind pub o|o ".+bav" [namespace current]::+bav
proc +bav {nick uhost handle chan text} {
    set host [lindex $text 0]
    set pseudo [lindex $text 0]
    if {$host eq "" } {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+bav <host>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+bav *!*@0000000.com"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+bav alias_angelius*!*"
        return
    }
    if {$pseudo eq "" || ![string match **!*@* $pseudo]} {
        putserv "PRIVMSG $chan :\0034Erreur\0034 : \0031.+bav <\0034host\0034\0031> ou <\0034pseudo*!*@*\0034\0031>"
        putserv "PRIVMSG $chan :\0031Exemple : \0031\0034.+bav *!*@0000000.com\0034"
        putserv "PRIVMSG $chan : \0031Exemple : \0031\0034.+bav bOulet*!*@*\0034"
        return
    }
    if {[verify:b $::mod::fichier(protect) $host]} {
        putserv "PRIVMSG $chan :\0034Refusé : \0034\002 Tu ne peux pas Blacklisté un host ou pseudo protégé.\002"
        putserv "PRIVMSG $::salonm :\0034\|Mode.Alerte.Admin\|\003\ \0034ATTENTION: \00314$nick \0034Host: \00314$uhost \0034a tenté de Blacklister \00314$pseudo \0034Host: \00314$host \0034sur: \00314$chan"
        return 1
    }
    if {[verify:b $::mod::fichier(blacklist) $host]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\002\[\002Système BAV\002]\002 \002$host \002à été mis dans la liste.\002"
    ajouter:donnee $::mod::fichier(blacklist) $host
}
 
bind pub o|o ".-bav" [namespace current]::-bav
proc -bav {nick uhost handle chan text} {
    set host [lindex $text 0]
    if {$host eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-bav <host>"
        return
    }
    if {![verify:b $::mod::fichier(blacklist) $host]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$host \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système BAV\02]\002 \02$host \002 n'est plus BAV."
    effacer:donnee $::mod::fichier(blacklist) $host
}
 
bind pub o|o ".bavlist" [namespace current]::pub:bavlist
proc pub:bavlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(blacklist) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Blacklistés\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc m "+blacklist" [namespace current]::+blacklist
proc +blacklist {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .+blacklist <host>"
        putdcc $idx "\002Exemple :\002 .+blacklist toto*!*@*.ru"
        return
    }
    if {[verify:b $::mod::fichier(blacklist) $host]} {
        putdcc $idx "\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putdcc $idx "\002+blacklist :\002 $host a été mis dans la liste."
    ajouter:donnee $::mod::fichier(blacklist) $host
}
 
bind dcc m "-blacklist" [namespace current]::-blacklist
proc -blacklist {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .-blacklist <host>"
        return
    }
    if {![verify:b $::mod::fichier(blacklist) $host]} {
        putdcc $idx "\002Erreur :\002 Le host $host n'est pas enregistré."
        return
    }
    putdcc $idx "\002-blacklist :\002 $host n'est plus enregistré."
    effacer:donnee $::mod::fichier(blacklist) $host
}
 
bind dcc m "blacklist" [namespace current]::dcc:blacklist
proc dcc:blacklist {hand idx arg} {
    putdcc $idx "\002 Liste des Ban à Vue\002"
    liste:donnee $idx $::mod::fichier(blacklist)
}
 
bind join - "*" [namespace current]::modblacklist
proc modblacklist { nick host handle channel } {
    set hostv $nick!$host
    set userhost [getchanhost $nick]
    set userhost "*!*[string range $userhost [string first @ $userhost] e]"
    set expire "expire le [clock format [expr 3600 + [clock second]] -format "%d/%m/%Y à %H:%M (GMT+1)"]"
    set heure "[clock format [clock seconds] -format "%Y/%m/%d %H:%M"]"
    if {[string equal -nocase $nick $::botnick]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $channel]} {
        return
    }
    if {![verify:a $::mod::fichier(blacklist) $hostv]} {
        return
    }
    putquick "KICK $channel $nick :[::msgcat::mc KickBlack] $expire"
    putquick "MODE $channel +b $nick*!*@*"
    putquick "MODE $channel +b $userhost"
    putserv "PRIVMSG $::salonm :\0034\|Mod.KickBan.Blacklist\|\003\ \0034KickBan pour: \00314$nick \0034Host: \00314$userhost \0034(Raison: \00314$::kick(blacklist) ($expire)\0034) \0034sur: \00314$channel"
}
 
bind dcc o|o "+xprotect" [namespace current]::+xprotect
proc +xprotect {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .+protect <host>"
        putdcc $idx "\002Exemple :\002 .+protect alias_angelius*!*@*"
        return
    }
    if {[verify:b $::mod::fichier(protect) $host]} {
        putdcc $idx "\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putdcc $idx "\002+protect :\002 Le host $host est maintenant protégé."
    ajouter:donnee $::mod::fichier(protect) $host
}
 
bind dcc o|o "-xprotect" [namespace current]::-xprotect
proc -xprotect {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .-protect <host>"
        return
    }
    if {![verify:b $::mod::fichier(protect) $host]} {
        putdcc $idx "\002Erreur :\002 Le host $host n'est pas enregistré."
        return
    }
    putdcc $idx "\002-protect :\002 Le host $host n'est plus protégé."
    effacer:donnee $::mod::fichier(protect) $host
}
 
bind dcc o|o "xprotect" [namespace current]::xprotect
proc xprotect {hand idx arg} {
    putdcc $idx "---\002 Liste des protégé contre la modération \002---"
    liste:donnee $idx $::mod::fichier(protect)
}
 
bind pub o|o ".+protect" [namespace current]::+protect
proc +protect {nick uhost handle chan text} {
    set host [lindex $text 0]
    if {$host eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+protect <pseudo/host>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+protect alias_angelius*!*@*"
        return
    }
    if {[verify:b $::mod::fichier(protect) $host]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Protect\02]\002 \02$host \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(protect) $host
}
 
bind pub m ".-protect" [namespace current]::-protect
proc -protect {nick uhost handle chan text} {
    set host [lindex $text 0]
    if {$host eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-protect <pseudo/host>"
        return
    }
    if {![verify:b $::mod::fichier(protect) $host]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$host \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Protect\02]\002 \02$host \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(protect) $host
}
 
bind pub o|o ".protectlist" [namespace current]::pub:protectlist
proc pub:protectlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(protect) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "NOTICE $nick :\0032Liste des Protégés\0032"
            putserv "NOTICE $nick :\0034 $fc - $data\0034"
        }
        unset data
    }
    close $fp
    putserv "NOTICE $nick :\0032Fin de liste"
}
 
proc verify:a {fichierss arg} {
    set liste [open $fichierss r]
    while {![eof $liste]} {
        gets $liste a
        regsub -all -- {\{|\}|\\{|[}{|]}} $a "" a
        if {$a ne ""} {
            if {[string match -nocase *$a* $arg]} {
                close $liste
                return 1
            }
        }
    }
    close $liste
    return 0
}
 
proc verify:b {fichierss arg} {
    set liste [open $fichierss r]
    while {![eof $liste]} {
        gets $liste a
        regsub -all -- {\{|\}|\\{|[}{|]}} $a "" a
        if {$a ne ""} {
            if {[string equal -nocase $a $arg]} {
                close $liste
                return 1
            }
        }
    }
    close $liste
    return 0
}
 
proc ajouter:donnee {fichierss arg} {
    set liste [open $fichierss a]
    puts $liste "$arg"
    close $liste
}
 
proc effacer:donnee {fichierss arg} {
    set fichier(back) "$fichierss.back"
    set load [open $fichier(back) w+]
    close $load
    set liste [open $fichierss r]
    set bcloseback [open $fichier(back) a]
    while {![eof $liste]} {
        gets $liste a
        if {$a ne ""} {
            if {[string equal -nocase [lindex $a 0] $arg]} {
                } else {
                    puts $bcloseback "[lindex $a]"
                }
        }
    }
    close $liste
    close $bcloseback
    file delete $fichierss
    file rename $fichier(back) $fichierss
}
 
proc liste:donnee {idx fichierss} {
    set liste [open $fichierss r]
    set num 0
    while {![eof $liste]} {
        gets $liste a
        if {$a ne ""} {
            incr num 1
            putdcc $idx "(\002$num\002) [lindex $a 0]"
        }
    }
    if {$num eq "0"} {
        putdcc $idx "Aucun enregistrement."
    }
    putdcc $idx "---\002 FIN DE LA LISTE \002--- Total (\002$num\002)"
    close $liste
    unset num
}
}


Si JAMAIS tu as encore une erreur dit le moi ici, et je te filerais un autre code de modération complétement différent codé d'une autre manière différente !

AAh pas vus ta réponse CC, en effet ta solution es meilleurs :)

Merci alias_angelius.
J ai essayé mais au bout d'un moment, j ai eut ceci en PL:

[10:53:10] Tcl error in script for 'timer111':
[10:53:10] can't unset "0": no such variable
[10:53:12] Tcl error in script for 'timer108':
[10:53:12] can't unset "modmajuscule(Luffy@Pirate.King.One.Piece)": no such variable
[10:53:17] Tcl error in script for 'timer113':
[10:53:17] can't unset "0": no such variable
[10:53:19] Tcl error in script for 'timer117':
[10:53:19] can't unset "0": no such variable
[10:53:19] Tcl error in script for 'timer115':
[10:53:19] can't unset "0": no such variable
[10:53:22] Tcl error in script for 'timer119':
[10:53:22] can't unset "0": no such variable
[10:53:30] Tcl error in script for 'timer121':
[10:53:30] can't unset "0": no such variable
  Reply
#7
Salut,

test ce code TCL :


tcl
namespace eval moderation {
variable moderation
 
#Salon logs
set ::chanbotlog "#back-eggdrop"
 
#Rasion du kickban BAV
set ::raisonbav "\037\0031Blackliste - Indesirable !!\037\0031"
 
#Rasion du kickban Spam
set ::raisonspam "\037\0031Spam/Pub Interdit sur le Salon\0037\0031"
 
#Rasion du kickban Badword
set ::raisonbadword "\037\0031BadWord Détecté - Exclus pour mauvais langage !\0037\0031"
 
#Raison du kickban Badnick
set ::raisonbadnick "\037\0031BadNick Détecté - Veuillez changer votre pseudo que vous avez mis !\0037\0031"
 
#Raison du kickban BadHost
set ::raisonbadhost "\037\0031BadHost Détecté - Votre Host est Blacklisté ...\0037\0031"
 
#Raison du kickban BadRealName
set ::raisonbadname "\037\0031BadName Détecté - Votre RealName est Blacklisté ...\0037\0031"
 
##############
# Protection #
##############
 
bind dcc A +xprotect moderation::+xprotect
proc +xprotect {nick idx arg} {
 variable moderation
  set temp [lindex $arg 0]
 
  if {$temp=="" || ![string match *@* $temp]} {
    putdcc $idx "\2Utilisation:\2 .+xprotect <pseudo*!*@*> ou <*!*@host>"
    putdcc $idx "\0034Exemple:\2 .+xprotect toto*!*@* ou *!*@000000.fr"
    return 0
  }
  set x 0
  foreach data $moderation(data) {
    if {[lindex $data 0]=="PROTECT" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
      set x 1
    }
  }
  if !$x {
    lappend moderation(data) [list PROTECT $temp]
    putdcc $idx "\002$temp est ajouté à la liste des protégés"
  } else {
    putdcc $idx "\002Erreur:\002 $temp est déja dans la liste des protégés"
  }
}
 
 
bind dcc A -xprotect moderation::-xprotect
 proc -xprotect {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putdcc $idx "\2Utilisation:\2 .-xprotect <pseudo*!*@*> ou <*!*@host>"
 putdcc $idx "\0034Exemple:\2 .-xprotect toto*!*@* ou ou *!*@000000.fr"
 return 0
 }
 
 set x 0
 set y 0
  foreach data $moderation(data) {
 
 if {[lindex $data 0]=="PROTECT" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 set y 1
 }
 incr x
 }
 if $y {
 putdcc $idx "\002$temp est supprimé de la liste des protégés"
 } else {
 putdcc $idx "\002$temp n'est pas dans la liste des protégés"
 }
}
 
# ici
bind pub A .+protect moderation::.+protect
proc .+protect {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putquick "NOTICE $nick :\2Utilisation:\2 .+protect <pseudo*!*@*> ou <*!*@host>"
 putquick "NOTICE $nick :\0034Exemple:\2 .+protect toto*!*@* ou *!*@000000.fr"
 return 0
 }
 
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="PROTECT" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 set x 1
 }
 }
 
 if !$x {
 lappend moderation(data) "PROTECT [join $temp]"
 putquick "NOTICE $nick :\002$temp est ajouté à la liste des protégés"
 } else {
 putquick "NOTICE $nick :\002 $temp est déja dans la liste des protégés"
 }
}
 
 
bind pub A .-protect moderation::.-protect
 proc .-protect {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putquick "NOTICE $nick :\2Utilisation:\2 .-protect <pseudo*!*@*> ou <*!*@host>"
 putquick "NOTICE $nick :\0034Exemple:\2 .-protect toto*!*@* ou *!*@000000.fr"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 
 if {[lindex $data 0]=="PROTECT" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 set y 1
 }
 incr x
 }
 
 if $y {
 putquick "NOTICE $nick :\002$temp est supprimé de la liste des protégés"
 } else {
 putquick "NOTICE $nick :\002$temp n'est pas dans la liste des protégés"
 }
}
 
 
bind pub A .protectlist moderation::protectlist
proc protectlist {nick host hand chan arg} {
 variable moderation
  set x 0
  set d ""
  foreach data $moderation(data) {
    if {[lindex $data 0]!="PROTECT"} continue
    set x 1
    lappend d [lindex $data 1]
    if {[llength $d]==10} {
      putquick "NOTICE $nick :[join $d]"
      set d ""
    }
  }
  if {[llength $d]>0} {
    putquick "NOTICE $nick :[join $d]" 
    set d ""
  }
  if !$x {putquick "NOTICE $nick : Liste Protect vide."}
}
 
 
###########
# Badword #
###########
 
bind dcc A +xbadword moderation::+xbadword
proc +xbadword {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putdcc $idx "\2Utilisation:\2 .+xbadword <mot>"
 putdcc $idx "\0034Exemple:\2 .+xbadword connard"
 return 0
 }
 
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADWORD" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 }
 }
 
 if !$x {
 lappend moderation(data) [list BADWORD $temp]
 putdcc $idx "\002$temp est ajouté à la liste des Badwords"
 } else {
 putdcc $idx "\002Erreur:\002 $temp est déja dans la liste des Badwords"
 }
}
 
 
bind dcc A -xbadword moderation::-xbadword
 proc -xbadword {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putdcc $idx "\2Utilisation:\2 .-xbadword <mot>"
 putdcc $idx "\0034Exemple:\2 .-xbadword connard"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADWORD" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 
 set y 1
 }
 incr x
 }
 if $y {
 putdcc $idx "\002$temp est supprimé de la liste des Badwords"
 } else {
 putdcc $idx "\002$temp n'est pas dans la liste des Badwords"
 }
}
 
 
bind pub A .+badword moderation::.+badword
proc .+badword {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putquick "NOTICE $nick :\2Utilisation:\2 .+badword <mot>"
 putquick "NOTICE $nick :\0034Exemple:\2 .+badword connard"
 return 0
 }
 
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADWORD" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 }
 }
 if !$x {
 lappend moderation(data) [list BADWORD $temp]
 putquick "NOTICE $nick :\002$temp est ajouté à la liste des Badwords"
 } else {
 putquick "NOTICE $nick :\002 $temp est déja dans la liste des Badwords"
 }
}
 
 
bind pub A .-badword moderation::.-badword
 proc .-badword {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putquick "NOTICE $nick :\2Utilisation:\2 .-badword <mot>"
 putquick "NOTICE $nick :\0034Exemple:\2 .-badword connard"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADWORD" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 
 set y 1
 }
 incr x
 }
 if $y {
 putquick "NOTICE $nick :\002$temp est supprimé de la liste des Badwords"
 } else {
 putquick "NOTICE $nick :\002$temp n'est pas dans la liste des Badwords"
 }
}
 
 
 
bind pub A .badwordlist moderation::badwordlist
proc badwordlist {nick host hand chan arg} {
 variable moderation
  set x 0
  set d ""
  foreach data $moderation(data) {
    if {[lindex $data 0]!="BADWORD"} continue
    set x 1
    lappend d [lindex $data 1]
    if {[llength $d]==10} {
      puthelp "NOTICE $nick :[join $d]"
      set d ""
    }
  }
  if {[llength $d]>0} {
    puthelp "NOTICE $nick :[join $d]" 
    set d ""
  }
  if !$x {puthelp "NOTICE $nick : Liste BadWord vide."}
}
 
###########
# Badhost #
###########
 
bind dcc A +xbadhost moderation::+xbadhost
proc +xbadhost {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putdcc $idx "\2Utilisation:\2 .+xbadhost <*!*@host>"
 putdcc $idx "\0034Exemple:\2 .+xbadhost *!*@*.biz"
 return 0
 }
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADHOST" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 }
 }
 if !$x {
 lappend moderation(data) [list BADHOST $temp]
 putdcc $idx "\002$temp est ajouté à la liste des BadHosts"
 } else {
 putdcc $idx "\002Erreur:\002 $temp est déja dans la liste des BadHosts"
 }
}
 
 
bind dcc A -xbadhost moderation::dcc:-xbadhost
 proc dcc:-xbadhost {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 if {$temp=="" || ![string match *@* $temp]} {
 putdcc $idx "\2Utilisation:\2 .-xbadhost <*!*@host>"
 putdcc $idx "\0034Exemple:\2 .-xbadhost *!*@*.biz"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADHOST" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 
 set y 1
 }
 incr x
 }
 if $y {
 putdcc $idx "\002$temp est supprimé des BadHosts"
 } else {
 putdcc $idx "\002$temp n'est pas dans la liste des BadHosts"
 }
}
 
 
bind pub A .+badhost moderation::.+badhost
proc .+badhost {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putquick "NOTICE $nick :\2Utilisation:\2 .+badhost <*!*@host>"
 putquick "NOTICE $nick :\0034Exemple:\2 .+badhost *!*@*.biz"
 return 0
 }
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADHOST" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 }
 }
 if !$x {
 lappend moderation(data) [list BADHOST $temp]
 putquick "NOTICE $nick :\002$temp ajouté aux BadHosts"
 } else {
 putquick "NOTICE $nick :\002 $temp est déja dans la liste des BadHosts"
 }
}
 
 
bind pub L .-badhost moderation::.-badhost
 proc .-badhost {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putquick "NOTICE $nick :\2Utilisation:\2 .-badhost <*!*@host>"
 putquick "NOTICE $nick :\0034Exemple:\2 .-badhost *!*@*.biz"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADHOST" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 
 set y 1
 }
 incr x
 }
 if $y {
 putquick "NOTICE $nick :\002$temp est supprimé des BadHosts"
 } else {
 putquick "NOTICE $nick :\002$temp n'est pas dans la liste des BadHosts"
 }
}
 
 
bind pub A .badhostlist moderation::badhostlist
proc badhostlist {nick host hand chan arg} {
 variable moderation
  set x 0
  set d ""
  foreach data $moderation(data) {
    if {[lindex $data 0]!="BADHOST"} continue
    set x 1
    lappend d [lindex $data 1]
    if {[llength $d]==10} {
      puthelp "NOTICE $nick :[join $d]"
      set d ""
    }
  }
  if {[llength $d]>0} {
    puthelp "NOTICE $nick :[join $d]" 
    set d ""
  }
  if !$x {puthelp "NOTICE $nick : Liste Badhost vide."}
}
 
 
 
##############
# Blackliste #
##############
 
bind dcc A +xblackliste moderation::+xblackliste
proc +xblackliste {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putdcc $idx "\2Utilisation:\2 .+xblackliste <pseudo*!*@*> ou <*!*@host>"
 putdcc $idx "\0034Exemple:\2 .+xblackliste toto*!*@* ou *!*@000000.fr"
 return 0
 }
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BLACKLISTE" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 }
 }
 if !$x {
 lappend moderation(data) [list BLACKLISTE $temp]
 putdcc $idx "\002$temp est ajouté à la Blackliste"
 } else {
 putdcc $idx "\002Erreur:\002 $temp est déja dans la Blackliste"
 }
}
 
 
bind dcc A -xblackliste moderation::-xblackliste
 proc -xblackliste {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putdcc $idx "\2Utilisation:\2 .-xblackliste <pseudo*!*@*> ou <*!*@host>"
 putdcc $idx "\0034Exemple:\2 .-xblackliste toto*!*@* ou *!*@000000.fr"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BLACKLISTE" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 
 set y 1
 }
 incr x
 }
 if $y {
 putdcc $idx "\002$temp est supprimé de la Blackliste"
 } else {
 putdcc $idx "\002$temp n'est pas dans la Blackliste"
 }
}
 
bind pub A .bavlist moderation::bav
proc bav {nick host hand chan arg} {
 variable moderation
  set x 0
  set d ""
  foreach data $moderation(data) {
    if {[lindex $data 0]!="BLACKLISTE"} continue
    set x 1
    lappend d [lindex $data 1]
    if {[llength $d]==10} {
      puthelp "NOTICE $nick :[join $d]"
      set d ""
    }
  }
  if {[llength $d]>0} {
    puthelp "NOTICE $nick :[join $d]" 
    set d ""
  }
  if !$x {puthelp "NOTICE $nick :bavlist vide."}
}
 
 
bind pub A .+bav moderation::.+bav
proc .+bav {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putquick "NOTICE $nick :\2Utilisation:\2 .+bav <pseudo*!*@*> ou <*!*@host>"
 putquick "NOTICE $nick :\0034Exemple:\2 .+bav toto*!*@* ou *!*@000000.fr"
 return 0
 }
 
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BLACKLISTE" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 
 }
 }
 
 if !$x {
 lappend moderation(data) "BLACKLISTE [join $temp]"
 putquick "NOTICE $nick :\002$temp est ajouté à la Blackliste"
 } else {
 putquick "NOTICE $nick :\002 $temp déja dans la Blackliste"
 }
 }
 
 
bind pub A .-bav moderation::.-bav
 proc .-bav {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putquick "NOTICE $nick :\2Utilisation:\2 .-bav <pseudo*!*@*> ou <*!*@host>"
 putquick "NOTICE $nick :\0034Exemple:\2 .-bav toto*!*@* ou *!*@000000.fr"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BLACKLISTE" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 set y 1
 }
 incr x
 }
 
 if $y {
 putquick "NOTICE $nick :\002$temp supprimé de la Blackliste"
 } else {
 putquick "NOTICE $nick :\002$temp n'est pas dans la Blackliste"
 }
}
 
 
 
########
# Spam #
########
 
bind dcc A +xspam moderation::+xspam
proc +xspam {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putdcc $idx "\2Utilisation:\2 .+xspam <mot>"
 putdcc $idx "\0034Exemple:\2 .+xspam www.*"
 return 0
 }
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="SPAM" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 }
 }
 if !$x {
 lappend moderation(data) [list SPAM $temp]
 putdcc $idx "\002$temp est ajouté à la liste des Spams"
 } else {
 putdcc $idx "\002Erreur:\002 $temp est déja dans la liste des Spams"
 }
}
 
 
bind dcc A -xspam moderation::-xspam
 proc -xspam {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putdcc $idx "\2Utilisation:\2 .-xspam <mot>"
 putdcc $idx "\0034Exemple:\2 .-xspam www.*"
 return 0
 }
 
 set x 0
 set y 0
  foreach data $moderation(data) {
 
 if {[lindex $data 0]=="SPAM" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 set y 1
 }
 incr x
 }
 if $y {
 putdcc $idx "\002$temp est supprimé de la liste des Spams"
 } else {
 putdcc $idx "\002$temp n'est pas dans la liste des Spams"
 }
}
 
 
bind pub A .+spam moderation::.+spam
proc .+spam {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putquick "NOTICE $nick :\2Utilisation:\2 .+spam <mot>"
 putquick "NOTICE $nick :\0034Exemple:\2 .+spam www.*"
 return 0
 }
 
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="SPAM" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
  set x 1
 }
 }
 
 if !$x {
 lappend moderation(data) [list SPAM $temp]
 putquick "NOTICE $nick :\002$temp est ajouté à la liste des Spams"
 } else {
 putquick "NOTICE $nick :\002 $temp est déja dans la liste des Spams"
 }
}
 
 
bind pub A .-spam moderation::.-spam
 proc .-spam {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putquick "NOTICE $nick :\2Utilisation:\2 .-spam <mot>"
 putquick "NOTICE $nick :\0034Exemple:\2 .-spam *www*"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 
 if {[lindex $data 0]=="SPAM" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 set y 1
 }
 incr x
 }
 
 if $y {
 putquick "NOTICE $nick :\002$temp est supprimé de la liste des Spams"
 } else {
 putquick "NOTICE $nick :\002$temp n'est pas dans la liste des Spams"
 }
}
 
 
bind pub A .spamlist moderation::spamlist
proc spamlist {nick host hand chan arg} {
 variable moderation
  set x 0
  set d ""
  foreach data $moderation(data) {
    if {[lindex $data 0]!="SPAM"} continue
    set x 1
    lappend d [lindex $data 1]
    if {[llength $d]==10} {
      putquick "NOTICE $nick :[join $d]"
      set d ""
    }
  }
  if {[llength $d]>0} {
    putquick "NOTICE $nick :[join $d]" 
    set d ""
  }
  if !$x {putquick "NOTICE $nick : Liste Spam/Pub vide."}
}
 
 
 
###########
# BADNICK #
###########
 
bind dcc A +xbadnick moderation::+xbadnick
proc +xbadnick {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putdcc $idx "\2Utilisation:\2 .+xbadnick <pseudo>"
 putdcc $idx "\0034Exemple:\2 .+xbadnick h-ch-f"
 return 0
 }
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADNICK" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 }
 }
 if !$x {
 lappend moderation(data) [list BADNICK $temp]
 putdcc $idx "\002$temp est ajouté en badnick"
 } else {
 putdcc $idx "\002Erreur:\002 $temp est déja en Badnick"
 }
}
 
 
bind dcc A -xbadnick moderation::-xbadnick
 proc -xbadnick {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putdcc $idx "\2Utilisation:\2 .-xbadnick <pseudo>"
 putdcc $idx "\0034Exemple:\2 .-xbadnick h-ch-f"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADNICK" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 
 set y 1
 }
 incr x
 }
 if $y {
 putdcc $idx "\002$temp est supprimé des Badnicks"
 } else {
 putdcc $idx "\002$temp n'est pas dans les Badnicks"
 }
}
 
bind dcc A .xbadnicklist moderation::xbadnicklist
proc xbadnicklist {nick host hand chan arg} {
 variable moderation
  set x 0
  set d ""
  foreach data $moderation(data) {
    if {[lindex $data 0]!="BADNICK"} continue
    set x 1
    lappend d [lindex $data 1]
    if {[llength $d]==10} {
      putdcc $idx "[join $d]"
      set d ""
    }
  }
  if {[llength $d]>0} {
    putdcc $idx "[join $d]" 
    set d ""
  }
  if !$x {putdcc $idx "BadnickListe vide."}
}
 
 
bind pub A .+badnick moderation::.+badnick
proc .+badnick {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putquick "NOTICE $nick :\2Utilisation:\2 .+badnick <pseudo>"
 putquick "NOTICE $nick :\0034Exemple:\2 .+badnick h-ch-f"
 return 0
 }
 
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADNICK" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 }
 }
 
 if !$x {
 lappend moderation(data) "BADNICK [join $temp]"
 putquick "NOTICE $nick :\002$temp est ajouté en Badnick"
 } else {
 putquick "NOTICE $nick :\002 $temp est déja en Badnick"
 }
}
 
 
bind pub A .-badnick moderation::.-badnick
 proc .-badnick {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putquick "NOTICE $nick :\2Utilisation:\2 .-badnick <pseudo>"
 putquick "NOTICE $nick :\0034Exemple:\2 .-badnick h-ch-f"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADNICK" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 set y 1
 }
 incr x
 }
 
 if $y {
 putquick "NOTICE $nick :\002$temp est supprimé des Badnicks"
 } else {
 putquick "NOTICE $nick :\002$temp n'est pas dans les Badnicks"
 }
}
 
 
bind pub A .badnicklist moderation::badnicklist
proc badnicklist {nick host hand chan arg} {
 variable moderation
  set x 0
  set d ""
  foreach data $moderation(data) {
    if {[lindex $data 0]!="BADNICK"} continue
    set x 1
    lappend d [lindex $data 1]
    if {[llength $d]==10} {
      putquick "NOTICE $nick :[join $d]"
      set d ""
    }
  }
  if {[llength $d]>0} {
    putquick "NOTICE $nick :[join $d]" 
    set d ""
  }
  if !$x {putquick "NOTICE $nick : Liste Badnick vide."}
}
 
 
 
#############
# EXTENSION #
#############
 
bind pub A .addanim moderation::.addanim
proc .addanim {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putquick "NOTICE $nick :\2Utilisation:\2 .addanim <pseudo*!*@*>"
 putquick "NOTICE $nick :\0034Exemple:\2 .addanim toto*!*@*"
 return 0
 }
 
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="EXTENSION" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 set x 1
 }
 }
 
 if !$x {
 lappend moderation(data) "EXTENSION [join $temp]"
 putquick "NOTICE $nick :\002$temp est ajouté à la liste"
 } else {
 putquick "NOTICE $nick :\002 $temp est déja dans la liste"
 }
}
 
 
bind pub A .delanim moderation::.delanim
 proc .delanim {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp=="" || ![string match *@* $temp]} {
 putquick "NOTICE $nick :\2Utilisation:\2 .delanim <pseudo*!*@*>"
 putquick "NOTICE $nick :\0034Exemple:\2 .delanim toto*!*@*"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 
 if {[lindex $data 0]=="EXTENSION" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 set y 1
 }
 incr x
 }
 
 if $y {
 putquick "NOTICE $nick :\002$temp est supprimé de la liste"
 } else {
 putquick "NOTICE $nick :\002$temp n'est pas dans la liste"
 }
}
 
 
bind pub A .extensionlist moderation::extensionlist
proc extensionlist {nick host hand chan arg} {
 variable moderation
  set x 0
  set d ""
  foreach data $moderation(data) {
    if {[lindex $data 0]!="EXTENSION"} continue
    set x 1
    lappend d [lindex $data 1]
    if {[llength $d]==10} {
      putquick "NOTICE $nick :[join $d]"
      set d ""
    }
  }
  if {[llength $d]>0} {
    putquick "NOTICE $nick :[join $d]" 
    set d ""
  }
  if !$x {putquick "NOTICE $nick : Liste Extension vide."}
}
 
 
 
 
###############
# BADREALNAME #
###############
 
bind dcc A +xbadname moderation::+xbadname
proc +xbadname {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putdcc $idx "\2Utilisation:\2 .+xbadname <realname>"
 return 0
 }
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADNAME" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 }
 }
 if !$x {
 lappend moderation(data) [list BADNAME $temp]
 putdcc $idx "\002$temp est ajouté en BadRealName"
 } else {
 putdcc $idx "\002Erreur:\002 $temp est déja en BadRealName"
 }
}
 
 
bind dcc A -xbadname moderation::-xbadname
 proc -xbadname {nick idx arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putdcc $idx "\2Utilisation:\2 .-xbadname <realname>"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADNAME" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 
 set y 1
 }
 incr x
 }
 if $y {
 putdcc $idx "\002$temp est supprimé des BadRealNames"
 } else {
 putdcc $idx "\002$temp n'est pas dans les BadRealNames"
 }
}
 
bind pub A .+badname moderation::.+badname
proc .+badname {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putquick "NOTICE $nick :\2Utilisation:\2 .+badname <realname>"
 return 0
 }
 
 set x 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADNAME" && [string tolower [lindex $data 1]]==[string tolower [lindex $arg 0]]} {
 
 set x 1
 }
 }
 
 if !$x {
 lappend moderation(data) "BADNAME [join $temp]"
 putquick "NOTICE $nick :\002$temp est ajouté en BadRealName"
 } else {
 putquick "NOTICE $nick :\002 $temp est déja en BadRealName"
 }
}
 
 
bind pub A .-badname moderation::.-badname
 proc .-badname {nick hand host chan arg} {
 variable moderation
 set temp [lindex $arg 0]
 
 if {$temp==""} {
 putquick "NOTICE $nick :\2Utilisation:\2 .-badname <realname>"
 return 0
 }
 
 set x 0
 set y 0
 foreach data $moderation(data) {
 if {[lindex $data 0]=="BADNAME" && [string tolower [lindex $data 1]]==[string tolower $temp]} {
 set moderation(data) [lreplace $moderation(data) $x $x]
 set y 1
 }
 incr x
 }
 
 if $y {
 putquick "NOTICE $nick :\002$temp est supprimé des BadRealNames"
 } else {
 putquick "NOTICE $nick :\002$temp n'est pas dans les BadRealNames"
 }
}
 
bind pub A .badnamelist moderation::badnamelist
proc badnamelist {nick host hand chan arg} {
 variable moderation
  set x 0
  set d ""
  foreach data $moderation(data) {
    if {[lindex $data 0]!="BADNAME"} continue
    set x 1
    lappend d [lindex $data 1]
    if {[llength $d]==10} {
      putquick "NOTICE $nick :[join $d]"
      set d ""
    }
  }
  if {[llength $d]>0} {
    putquick "NOTICE $nick :[join $d]" 
    set d ""
  }
  if !$x {putquick "NOTICE $nick : Liste RealName vide."}
}
 
 
#ici
 
set moderation(file) [file join scripts moderation.db]
if ![file exists $moderation(file)] {
  catch {open $moderation(file) w+} p
  catch {close $p}
}
bind evnt - save moderation::moderation_save_file
proc moderation_save_file {type} {
 variable moderation
  if {$moderation(data)==""} return
  catch {open $moderation(file) w+} p
  foreach data $moderation(data) {
     if {$data!=""} {puts $p $data}
  }
  catch {close $p}
  putlog "sauvegarde de moderation.db"
}
set moderation(data) ""
catch {open $moderation(file) r} p
while {![eof $p]} {
  lappend moderation(data) [gets $p]
}
catch {close $p}
 
proc mirc:strip {text} {
  regsub -all -- "\003(\[0-9\]\[0-9\]?(,\[0-9\]\[0-9\]?)?)?" $text "" text
  set text [string map -nocase [list \002 "" \017 "" \026 "" \037 ""] $text]
  return $text
} 
 
proc hostcomp {host1 host2} {
  string match -nocase [string map {"\[" "." "\]" ","} [join $host1]] [string map {"\[" "." "\]" ","} [join $host2]]
}
 
proc getdata {type arg} {
 variable moderation
  set arg [split $arg]
  foreach data $moderation(data) {
    switch $type {
      BADNICK {
        if {[lindex $data 0]=="BADNICK" && [string match -nocase *[lindex $data 1]* $arg]} {return 1}
      }
      BADWORD {
        foreach a $arg {
          if {[lindex $data 0]=="BADWORD" && [string match -nocase [lindex $data 1] $a]} {return 1}
        }
      }
      BADIDENT {
        if {[lindex $data 0]=="BADIDENT" && [string match -nocase *[lindex $data 1]* $arg]} {return 1}
      }
      BADHOST {
        if {[lindex $data 0]=="BADHOST" && [hostcomp [lindex $data 1] $arg]} {return 1}
      }
      BADNAME {
        if {[lindex $data 0]=="BADNAME" && [string match -nocase *[lindex $data 1]* $arg]} {return 1}
      }
      BLACKLISTE {
        if {[lindex $data 0]=="BLACKLISTE" && [hostcomp [lindex $data 1] $arg]} {return 1}
      }
      PROTECT {
        if {[lindex $data 0]=="PROTECT" && [hostcomp [lindex $data 1] $arg]} {return 1}
      }
      EXTENSION {
         if {[lindex $data 0]=="EXTENSION" && [hostcomp [lindex $data 1] $arg]} {return 1}
      }
	  SPAM {
        foreach a $arg {
          if {[lindex $data 0]=="SPAM" && [string match -nocase [lindex $data 1] $a]} {return 1}
        }
      }
    }
  }
  return 0
}
 
bind join - * moderation::joinchan
 
proc joinchan {nick host hand chan} {
  variable iswho 
  variable raison
  set host [getchanhost $nick]
  set host "*!*[string range $host [string first @ $host] e]"  
  if [getdata PROTECT $nick!$host] return
  if [getdata EXTENSION $nick!$host] return
  if [getdata BLACKLISTE $nick!$host] {putquick "MODE $chan +b $host"; putquick "KICK $chan $nick : $::raisonbav \0034$nick\0034"; #putquick "notice Robot :Oui \0034B.A.V. Detect:\2 \03pour $nick!$host sur $chan\03"} 
  if [getdata BADNICK $nick] {putquick "MODE $chan +b $host"; putquick "KICK $chan $nick : $::raisonbadnick \0034$nick\0034"; #putquick "notice Robot :Oui \0034Badnick Detect:\2 \03pour $nick sur $chan\03 ---> \0034Pseudo Bani:\2 $nick"}
  if [getdata BADHOST $nick!$host] {putquick "MODE $chan +b $host"; putquick "KICK $chan $nick : $::raisonbadhost \0034host\0034"; #putquick "notice Robot :Oui \0034Badhost Detect:\2 \03pour $nick sur $chan\03 ---> \0034Host Bani:\2 $host"}  
     set iswho $chan
     putserv "who $nick"
  }
 
bind raw - 352 moderation::who
 proc who {f k a} {
  variable iswho
  variable raison
  if {$iswho!=""} {
    set nick [lindex $a 5]
    set host *![lindex $a 2]@[lindex $a 3]
    set chan $iswho
  set host [getchanhost $nick $chan]
  set host "*!*[string range $host [string first @ $host] e]"  
  if [getdata PROTECT $nick!$host] return
  if [getdata BADNAME [lrange [lindex [split $a :] 1] 1 end]] {putquick "MODE $chan +b $host"; putquick "KICK $chan $nick : $::raisonbadname \0034$host\0034"; #putquick "notice Robot :Oui \0034Badname Detect:\2 \03pour $nick sur $chan\03 ---> \0034Realname Bani:\2 [lrange [lindex [split $a :] 1] 1 end]"}
    set iswho ""
   }
 }
 
 
 
 
 
 
bind pubm - * moderation::badspam
 
proc badspam { nick host hand chan arg } {
  set arg [mirc:strip $arg]
  set arg [stripcodes bcruag $arg]
  set host [getchanhost $nick $chan]
  set host "*!*[string range $host [string first @ $host] e]"  
  if [getdata PROTECT $nick!$host] return
  if [getdata SPAM $arg] {putquick "MODE $chan +b $host"; putquick "KICK $chan $nick : $::raisonspam \0034Interdit sur $chan\0034"; #putquick "notice Robot :Oui \0034Spam/Pub Detect:\2 \03pour $nick sur $chan\03 ---> \0034Spam/Pub Bani:\2 $arg"}    
  if [getdata BADWORD $arg] {putquick "MODE $chan +b $host"; putquick "KICK $chan $nick : $::raisonbadword \0034$arg\0034"; #putquick "notice Robot :Oui \0034Badword Detect:\2 \03pour $nick sur $chan\03 ---> \0034Mot Bani:\2 $arg"}
}
 
bind nick - * moderation::newnick
 
proc newnick {nick host hand arg newnick} {
   if [getdata PROTECT $nick!$host] return
   if [getdata EXTENSION $nick!$host] return
   foreach chan [channels] {
   if {[onchan $newnick $chan] && [getdata BADNICK $newnick]} {
   set host [getchanhost $nick]
   set host "*!*[string range $host [string first @ $host] e]"  
   putquick "MODE $chan +b $host"; putquick "KICK $chan $newnick : $::raisonbadnick \0034$newnick\0034"; #putquick "notice Robot :Oui \0034On-AiR Detect:\2 \03pour $nick sur $chan\03"}  
  }
}
 
}
 
putlog "\0031\[\0034Moderation.tcl\0031\] Loaded"


NB regarde le code entier pour connaître les commandes, si le code fonctionne correctement, je vais le mettre en téléchargement sur le site avec un système d'aide et explicatifs des commandes au TCL

Fait un retour du code dès que tu peut merci !
Vous interdisez les erreurs, vous empêchez ainsi la victoire.

Ma super kikoo-page loll
  Reply
#8
Hum, c'est moi ou ce n'est pas du tout le même script ?
A priori, ce n'est pas un souci avec mes yeux.
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
  Reply
#9
(26/06/2021, 19:16)Luffy Wrote:
(26/06/2021, 00:24)aliasangelius Wrote: Salut,

Je te file une légère modification tu me dit ce que sa donne. Pour la partie msgcat normalement c'est dans la librairie tcl8.5


tcl
####################################################################################################################
# Moderation.tcl                                                                                                  #
#                                                                                                                  #
# Script TCL de modération, fonctionnalité du code :                                                              #
# Anti-Majuscules, Anti-Répétition, Mode-Language, Mode-Spam, Anti-MassFlood, Anti-MassJoin, Mode-Nick, Blacklist. #
# Mode Vip Automatique                                                                                            #
#                                                                                                                  #
# Ce code et de base de Platine, version débug et modifié en Namespace avec des rajouts de commandes etc.          #
#                                                                                                                  #
####################################################################################################################
 
namespace eval ::mod {
    
    # Nous vérifions si ya le package requis pour le msgcat.
    package require msgcat
    # Nous mettons la langue de msgcat en français
    ::msgcat::mclocale fr
    # Les messages msgcat.
    ::msgcat::mcset fr AvertMaj "Doucement sur les majuscules !"
    ::msgcat::mcset fr KickMaj "Si tu veux crier tu vas dehors !"
    ::msgcat::mcset fr AvertRep "N'abuse pas des répétitions !"
    ::msgcat::mcset fr KickRep "Tu n'as pas besoin de te répéter autant de fois !"
    ::msgcat::mcset fr AvertLan "Fais attention à ton langage ! Si tu continues tu te feras expulser !"
    ::msgcat::mcset fr KickLan "Reviens nous voir dans 10 minutes en espérant que tu auras changer de langage !"
    ::msgcat::mcset fr AvertSpam "Si tu veux envoyé un lien c'est en Pv et pas en salon !"
    ::msgcat::mcset fr KickSpam "Va faire ta pub ailleurs !"
    ::msgcat::mcset fr KickNick "Veuillez modifier votre pseudo car celui-ci est incorrect !"
    ::msgcat::mcset fr KickBlack "\02\[\002Systeme B.A.V\02]\002 Indésirable!!"
    ::msgcat::mcset fr KickNoti "Pas de Notice Salon !"
    ::msgcat::mcset fr KickNic "Veuillez modifier votre pseudo car celui-ci est incorrect !"
    # Les limitations/Nombres
    # Expiration de la detection pour les majuscules (en seconde) ?
    set expiration(majuscule) "60"
    # Nombre de majuscule à détecter ?
    set detect(majuscule) "25"
    # Combien d'avertissement avant le kick ?
    set avert(majuscule) "1"
    # Expiration de la detection pour les repetitions (en seconde) ?
    set expiration(repetition) "60"
    # Nombre de repetition à détecter ?
    set detect(repetition) "6"
    # Combien d'avertissement avant le kick ?
    set avert(repetition) "1"
    # Expiration de la detection pour le langage (en seconde) ?
    set expiration(mot) "600"
    # Combien d'avertissement avant le kickban ?
    set avert(mot) "3"
    # Expiration de la detection pour le spam (en seconde) ?
    set expiration(spam) "600"
    # Combien d'avertissement avant le kickban ?
    set avert(spam) "1"
    # Nombre de message lors d'une détection mass/flood
    set mass(flood) "15"
    # Temp de rehash pour la remise à 0 du mass/flood (en seconde)
    set mass(rehashflood) "1"
    # Temp pour le retrait du +m (en minute)
    set mass(retraitm) "2"
    # Nombre de join lors d'une détection mass/join
    set mass(join) "10"
    # Temp de rehash pour la remise à 0 du mass/join (en seconde)
    set mass(rehashjoin) "1"
    # Temp pour le retrait du +i (en minute)
    set mass(retraiti) "2"
    # Salon de log
    set salonm "#Back-Eggdrop"
    
##########################
# création des fichiers. #
##########################
 
set fichier(modchan) "modchan.chan"
set fichier(modmot) "modmot.mot"
set fichier(modspam) "modspam.spam"
set fichier(modnick) "modnick.nick"
set fichier(protect) "protect.protect"
set fichier(blacklist) "blacklist.black"
 
set fichiers [list $::mod::fichier(modchan) $::mod::fichier(modmot) $::mod::fichier(modspam) $::mod::fichier(modnick) $::mod::fichier(protect) $::mod::fichier(blacklist)]
foreach txt $fichiers {
    if {![file exists $txt]} {
        set load [open $txt w+]
        close $load
        putlog "\2Je créer le(s) fichier(s) $fichiers\2"
    }
}
 
###################
# Les procédures. #
###################
 
bind pubm - "*" [namespace current]::moderation
proc moderation { nick host handle channel arg } {
    set arg [split $arg]
    set msg [join [lrange [split $arg] 0 end]]
    set hostv $nick!$host
    set userhost [getchanhost $nick]
    set userhost "*!*[string range $userhost [string first @ $userhost] e]"
    regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $msg "" msg
    regsub -all -- {\{|\}|\\{|[}{|]}} $msg "" msg
    if {![verify:b $::mod::fichier(modchan) $channel]} {
        return
    }
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![info exists modmajuscule($host)]} {
        set modmajuscule($host) 0
        utimer $::mod::expiration(majuscule) [list unset modmajuscule($host)]
    }
    set nombre 0
    foreach x [split $msg {}] {
        if [string match \[A-Z\] $x] {
            incr nombre
        }
    }
    if {$nombre > $::mod::detect(majuscule)} {
        incr modmajuscule($host) 1
        if {$::mod::avert(majuscule) < $modmajuscule($host)} {
            putnow "kick $channel $nick :[::msgcat::mc KickMaj]"
            set modmajuscule($host) 0
            return
        }
        putserv "NOTICE $nick :[::msgcat::mc AvertMaj]"
    }
    if {[info exists rpt($nick)]} {
        if {[lrange $rpt($nick) 2 end]  eq  "$msg"} {
            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] > $::mod::detect(repetition)} {
                if {![info exists modrepetition($host)]} {
                    set modrepetition($host) 0
                    utimer $::mod::expiration(repetition) [list unset modrepetition($host)]
                }
                incr modrepetition($host) 1
                if {$::mod::avert(repetition) < $modrepetition($host)} {
                    putnow "kick $channel $nick :[::msgcat::mc KickRep]"
                    set modrepetition($host) 0
                    return
                }
                putserv "NOTICE $nick :[::msgcat::mc AvertRep]"
                unset rpt($nick)
            }
            } else {
                set rpt($nick) "[expr [clock seconds] + 10] 1 $msg"
            }
            } else {
                set rpt($nick) "[expr [clock seconds] + 10] 1 $msg"
            }
            if {[verify:a $::mod::fichier(modmot) $msg]} {
                if {![info exists modmot($host)]} {
                    set modmot($host) 0
                    utimer $::mod::expiration(mot) [list unset modmot($host)]
                }
                incr modmot($host) 1
                if {$::mod::avert(mot) < $modmot($host)} {
                    putnow "mode $channel +b $userhost"
                    putquick "kick $channel $nick :[msgcat::mc KickLan]"
                    set modmot($host) 0
                    return
                }
                putserv "NOTICE $nick :[::msgcat::mc AvertLan]"
            }
            if {[verify:a $::mod::fichier(modspam) $msg]} {
                if {![info exists modspam($host)]} {
                    set modspam($host) 0
                    utimer $::mod::expiration(spam) [list unset modspam($host)]
                }
                incr modspam($host) 1
                if {$::avert(spam) < $modspam($host)} {
                    putnow "mode $channel +b $userhost"
                    putquick "kick $channel $nick :[::mdscat::mc KickSpam]"
                    set modspam($host) 0
                    return
                }
                putserv "NOTICE $nick :[::msgcat::mc AvertSpam]"
            }
}
 
bind pubm - "*" [namespace current]::massflood
proc massflood { nick uhost handle chan arg } {
    set hostv $nick!$uhost
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    if {![info exists massflood($chan)]} {
        set massflood($chan) 0
        utimer $::mod::mass(rehashflood) [list unset $massflood($chan)]
        incr $massflood($chan) 1
        if {$massflood($chan) eq "$::mod::mass(flood)"} {
            putserv "mode $chan +m"
            timer $::mass(retraitm) [list putserv "mode $chan -m"]
        }
    }
}
    
bind join - "*" [namespace current]::massjoin
proc massjoin {nick host hand chan} {
    set hostv $nick!$host
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    if {![info exists massjoin($chan)]} {
        set massjoin($chan) 0
        utimer $::mod::mass(rehashjoin) [list unset massjoin($chan)]
    }
    incr massjoin($chan) 1
    if {$::massjoin($chan) eq "$::massjoin($chan)"} {
        putserv "mode $chan +i"
        timer $::mass(retraitm) [list putserv "mode $chan -i"]
    }
}
 
bind notc - "*" [namespace current]::noticechan
proc noticechan {nick host handle text chan} {
    set hostv $nick!$host
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    putnow "mode $chan +b $userhost"
    putquick "kick $chan $nick :[::msgcat::mc KickNoti]"
}
 
bind dcc m "+modspam" [namespace current]::+modspam
proc +modspam {hand idx arg} {
    set spam [lindex $arg 0]
    if {$spam eq ""} {
        putdcc $idx "\002Erreur :\002 .+modspam <spam>"
        putdcc $idx "\002Exemple :\002 .+modspam *.*.com*"
        return
    }
    if {[verify:b $::mod::fichier(modspam) $spam]} {
        putdcc $idx "\002Erreur :\002 $spam est déjà enregistré."
        return
    }
    putdcc $idx "\002+modspam :\002 $spam a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modspam) $spam
}
 
bind dcc n "-modspam" [namespace current]::-modspam
proc -modspam {hand idx arg} {
    set spam [lindex $arg 0]
    if {$spam eq ""} {
        putdcc $idx "\002Erreur :\002 .-modspam <spam>"
        return
    }
    if {![verify:b $::mod::fichier(modspam) $spam]} {
        putdcc $idx "\002Erreur :\002 Le spam $spam n'est pas enregistré."
        return
    }
    putdcc $idx "\002-modspam :\002 $spam n'est plus enregistré."
    effacer:donnee $::mod::fichier(modspam) $spam
}
 
bind dcc"modspam" [namespace current]::modspam
proc modspam {hand idx arg} {
    putdcc $idx "---\002 LISTE DES SPAMS \002---"
    liste:donnee $idx $::mod::fichier(modspam)
}
 
bind pub o|o ".+spam" [namespace current]::+spam
proc +spam {nick uhost handle chan text} {
    set motspam [lindex $text 0]
    if {$motspam eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+spam <mot spam>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+spam msn.com"
        return
    }
    if {[verify:b $::mod::fichier(modspam) $motspam]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $motspam est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système AntiSpam\02]\002 \02$motspam \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modspam) $motspam
}
 
bind pub o|o ".-spam" [namespace current]::-spam
proc -spam {nick uhost handle chan text} {
    set motspam [lindex $text 0]
    if {$motspam eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-spam <motspam>"
        return
    }
    if {![verify:b $::mod::fichier(modspam) $motspam]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$motspam \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système AntiSpam\02]\002 \02$motspam \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modspam) $motspam
}
 
bind pub o|o ".spamlist" [namespace current]::pub:spamlist
proc pub:spamlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modspam) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :PRIVMSG $nick :\0032Liste des Spams\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc n "+modchan" [namespace current]::+modchan
proc +modchan {hand idx arg} {
    set chan [lindex $arg 0]
    if {$chan eq ""||[string index $chan 0] ne "#"} {
        putdcc $idx "\002Erreur :\002 .+modchan <#chan>"
        return
    }
    if {[verify:b $::mod::fichier(modchan) $chan]} {
        putdcc $idx "\002Erreur :\002 $chan est déjà modérer."
        return
    }
    putdcc $idx "\002+modchan :\002 $chan a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modchan) $chan
}
 
bind dcc n "-modchan" [namespace current]::-modchan
proc -modchan {hand idx arg} {
    set chan [lindex $arg 0]
    if {$chan eq ""||[string index $chan 0] ne "#"} {
        putdcc $idx "\002Erreur :\002 .-modchan <#chan>"
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        putdcc $idx "\002Erreur :\002 Le chan $chan n'est pas modérer."
        return
    }
    putdcc $idx "\002-modchan :\002 $chan n'est plus modéré."
    effacer:donnee $::mod::fichier(modchan) $chan
}
 
bind dcc n "modchan" [namespace current]::modchan
proc modchan {hand idx arg} {
    putdcc $idx "---\002 Liste des chans modérer \002---"
    liste:donnee $idx $::mod::fichier(modchan)
}
 
bind pub o|o ".+chan" [namespace current]::+chan
proc +chan {nick uhost handle chan text} {
    set moderechan [lindex $text 0]
    if {$moderechan eq "" ||[string index $chan 0] ne "#"} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+chan <#Salon>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+chan #Radio"
        return
    }
    if {[verify:b $::mod::fichier(modchan) $moderechan]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $moderechan est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Moderation Salon\02]\002 \02$moderechan \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modchan) $moderechan
}
 
bind pub o|o ".-chan" [namespace current]::-chan
proc -chan {nick uhost handle chan text} {
    set moderechan [lindex $text 0]
    if {$moderechan eq "" ||[string index $chan 0] ne "#"} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-chan <#Salon>"
        return
    }
    if {![verify:b $::mod::fichier(modchan) $moderechan]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$moderechan \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Moderation Salon\02]\002 \02$moderechan \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modchan) $moderechan
}
 
bind pub o|o ".listchan" [namespace current]::pub:listchan
proc pub:listchan {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modchan) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Salons\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc n "+modmot" [namespace current]::+modmot
proc +modmot {hand idx arg} {
    set mot [lindex $arg 0]
    if {$mot eq ""} {
        putdcc $idx "\002Erreur :\002 .+modmot <mot>"
        return
    }
    if {[verify:b $::mod::fichier(modmot) $mot]} {
        putdcc $idx "\002Erreur :\002 $mot est déjà enregistré."
        return
    }
    putdcc $idx "\002+modmot :\002 $mot a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modmot) $mot
}
 
bind dcc n "-modmot" [namespace current]::-modmot
proc -modmot {hand idx arg} {
    set mot [lindex $arg 0]
    if {$mot eq ""} {
        putdcc $idx "\002Erreur :\002 .-modmot <mot>"
        return
    }
    if {![verify:b $::mod::fichier(modmot) $mot]} {
        putdcc $idx "\002Erreur :\002 Le mot $mot n'est pas enregistré."
        return
    }
    putdcc $idx "\002-modmot :\002 $mot n'est plus enregistré."
    effacer:donnee $::mod::fichier(modmot) $mot
}
 
bind dcc n "modmot" [namespace current]::modmot
proc modmot {hand idx arg} {
    putdcc $idx "---\002 Liste des mots interdit \002---"
    liste:donnee $idx $::mod::fichier(modmot)
}
 
bind pub o|o ".+badmot" [namespace current]::+badmot
proc +badmot {nick uhost handle chan text} {
    set mot [lindex $text 0]
    if {$mot eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+badmot <mot>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+badmot con"
        return
    }
    if {[verify:b $::mod::fichier(modmot) $mot]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $mot est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Badmot\02]\002 \02$mot \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modmot) $mot
}
 
bind pub o|o ".-badmot" [namespace current]::-badmot
proc -badmot {nick uhost handle chan text} {
    set mot [lindex $text 0]
    if {$mot eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-badmot <mot>"
        return
    }
    if {![verify:b $::mod::fichier(modmot) $mot]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$mot \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Badmot\02]\002 \02$mot \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modmot) $mot
}
 
bind pub o|o ".badmotlist" [namespace current]::pub:badmotlist
proc pub:badmotlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modmot) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Badmot\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc n "+modnick" [namespace current]::+modnick
proc +modnick {hand idx arg} {
    set nick [lindex $arg 0]
    if {$nick eq ""} {
        putdcc $idx "\002Erreur :\002 .+modnick <nick>"
        putdcc $idx "\002Exemple :\002 .+modnick *.*.com*"
        return
    }
    if {[verify:b $::mod::fichier(modnick) $nick]} {
        putdcc $idx "\002Erreur :\002 $nick est déjà enregistré."
        return
    }
    putdcc $idx "\002+modnick :\002 $nick a été mis dans la liste."
    ajouter:donnee $::mod::fichier(modnick) $nick
}
 
bind dcc n "-modnick" [namespace current]::-modnick
proc -modnick {hand idx arg} {
    set nick [lindex $arg 0]
    if {$nick eq ""} {
        putdcc $idx "\002Erreur :\002 .-modnick <nick>"
        return
    }
    if {![verify:b $::mod::fichier(modnick) $nick]} {
        putdcc $idx "\002Erreur :\002 Le nick $nick n'est pas enregistré."
        return
    }
    putdcc $idx "\002-modnick :\002 $nick n'est plus enregistré."
    effacer:donnee $::mod::fichier(modnick) $nick
}
 
bind dcc n "modnick" [namespace current]::dcc:modnick
proc dcc:modnick {hand idx arg} {
    putdcc $idx "---\002 Liste des nicks \002---"
    liste:donnee $idx $::mod::fichier(modnick)
}
 
bind pub o|o ".+badnick" [namespace current]::+badnick
proc +badnick {nick uhost handle chan text} {
    set nick [lindex $text 0]
    if {$nick eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+badnick <pseudo>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+badnick h_pour_cam*!*@*"
        return
    }
    if {[verify:b $::mod::fichier(modnick) $nick]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $nick est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système Badnick\02]\002 \02$nick \002a été ajouté à la liste."
    ajouter:donnee $::mod::fichier(modnick) $nick
}
 
bind pub o|o ".-badnick" [namespace current]::-badnick
proc -badnick {nick uhost handle chan text} {
    set nick [lindex $text 0]
    if {$nick eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-badnick <pseudo>"
        return
    }
    if {![verify:b $::mod::fichier(modnick) $nick]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$nick \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système badnick\02]\002 \02$nick \002 est supprimé de la liste."
    effacer:donnee $::mod::fichier(modnick) $nick
}
 
bind pub o|o ".badnicklist" [namespace current]::pub:badnicklist
proc pub:badnicklist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(modnick) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Badnick\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind join - "*" [namespace current]::modnick
proc modnick { nick uhost handle channel } {
    set hostv $nick!$uhost
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {[string equal -nocase $nick $::botnick]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $channel]} {
        return
    }
    if {![verify:a $::mod::fichier(modnick) $nick]} {
        return
    }
    putnow "MODE $channel +b $nick*!*"
    putquick "KICK $channel $nick :[::msgcat::mc KickNic]"
}
 
bind nick - "*" [namespace current]::modnicksuite
proc modnicksuite { nick uhost handle chan newnick } {
    set hostv $nick!$uhost
    if {[verify:a $::mod::fichier(protect) $hostv]} {
        return
    }
    if {[string equal -nocase $nick $::botnick]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $chan]} {
        return
    }
    if {![verify:a $::mod::fichier(modnick) $nick]} {
        return
    }
    putnow "MODE $chan +b $newnick*!*"
    putquick "KICK $channel $nick :[::msgcat::mc KickNic]"
}
 
bind pub o|o ".+bav" [namespace current]::+bav
proc +bav {nick uhost handle chan text} {
    set host [lindex $text 0]
    set pseudo [lindex $text 0]
    if {$host eq "" } {
        putserv "PRIVMSG $chan :\002Erreur :\002 .+bav <host>"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+bav *!*@0000000.com"
        putserv "PRIVMSG $chan :\002Exemple :\002 .+bav alias_angelius*!*"
        return
    }
    if {$pseudo eq "" || ![string match **!*@* $pseudo]} {
        putserv "PRIVMSG $chan :\0034Erreur\0034 : \0031.+bav <\0034host\0034\0031> ou <\0034pseudo*!*@*\0034\0031>"
        putserv "PRIVMSG $chan :\0031Exemple : \0031\0034.+bav *!*@0000000.com\0034"
        putserv "PRIVMSG $chan : \0031Exemple : \0031\0034.+bav bOulet*!*@*\0034"
        return
    }
    if {[verify:b $::mod::fichier(protect) $host]} {
        putserv "PRIVMSG $chan :\0034Refusé : \0034\002 Tu ne peux pas Blacklisté un host ou pseudo protégé.\002"
        putserv "PRIVMSG $::salonm :\0034\|Mode.Alerte.Admin\|\003\ \0034ATTENTION: \00314$nick \0034Host: \00314$uhost \0034a tenté de Blacklister \00314$pseudo \0034Host: \00314$host \0034sur: \00314$chan"
        return 1
    }
    if {[verify:b $::mod::fichier(blacklist) $host]} {
        putserv "PRIVMSG $chan :\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putserv "PRIVMSG $chan :\002\[\002Système BAV\002]\002 \002$host \002à été mis dans la liste.\002"
    ajouter:donnee $::mod::fichier(blacklist) $host
}
 
bind pub o|o ".-bav" [namespace current]::-bav
proc -bav {nick uhost handle chan text} {
    set host [lindex $text 0]
    if {$host eq ""} {
        putserv "PRIVMSG $chan :\002Erreur :\002 .-bav <host>"
        return
    }
    if {![verify:b $::mod::fichier(blacklist) $host]} {
        putserv "PRIVMSG $chan :\002Erreur :\02$host \002n'est pas dans la liste."
        return
    }
    putserv "PRIVMSG $chan :\02\[\002Système BAV\02]\002 \02$host \002 n'est plus BAV."
    effacer:donnee $::mod::fichier(blacklist) $host
}
 
bind pub o|o ".bavlist" [namespace current]::pub:bavlist
proc pub:bavlist {nick uhost hand chan args} {
    set fp [open $::mod::fichier(blacklist) "r"]
    set fc -1
    while {![eof $fp]} {
        set data [gets $fp]
        incr fc
        if {$data !=""} {
            putserv "PRIVMSG $nick :\0032Liste des Blacklistés\0032"
            putserv "PRIVMSG $nick :\0034 $fc - $data \0034"
        }
        unset data
    }
    close $fp
    putserv "PRIVMSG $nick :\0032Fin de liste\0032"
}
 
bind dcc m "+blacklist" [namespace current]::+blacklist
proc +blacklist {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .+blacklist <host>"
        putdcc $idx "\002Exemple :\002 .+blacklist toto*!*@*.ru"
        return
    }
    if {[verify:b $::mod::fichier(blacklist) $host]} {
        putdcc $idx "\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putdcc $idx "\002+blacklist :\002 $host a été mis dans la liste."
    ajouter:donnee $::mod::fichier(blacklist) $host
}
 
bind dcc m "-blacklist" [namespace current]::-blacklist
proc -blacklist {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .-blacklist <host>"
        return
    }
    if {![verify:b $::mod::fichier(blacklist) $host]} {
        putdcc $idx "\002Erreur :\002 Le host $host n'est pas enregistré."
        return
    }
    putdcc $idx "\002-blacklist :\002 $host n'est plus enregistré."
    effacer:donnee $::mod::fichier(blacklist) $host
}
 
bind dcc m "blacklist" [namespace current]::dcc:blacklist
proc dcc:blacklist {hand idx arg} {
    putdcc $idx "\002 Liste des Ban à Vue\002"
    liste:donnee $idx $::mod::fichier(blacklist)
}
 
bind join - "*" [namespace current]::modblacklist
proc modblacklist { nick host handle channel } {
    set hostv $nick!$host
    set userhost [getchanhost $nick]
    set userhost "*!*[string range $userhost [string first @ $userhost] e]"
    set expire "expire le [clock format [expr 3600 + [clock second]] -format "%d/%m/%Y à %H:%M (GMT+1)"]"
    set heure "[clock format [clock seconds] -format "%Y/%m/%d %H:%M"]"
    if {[string equal -nocase $nick $::botnick]} {
        return
    }
    if {![verify:b $::mod::fichier(modchan) $channel]} {
        return
    }
    if {![verify:a $::mod::fichier(blacklist) $hostv]} {
        return
    }
    putquick "KICK $channel $nick :[::msgcat::mc KickBlack] $expire"
    putquick "MODE $channel +b $nick*!*@*"
    putquick "MODE $channel +b $userhost"
    putserv "PRIVMSG $::salonm :\0034\|Mod.KickBan.Blacklist\|\003\ \0034KickBan pour: \00314$nick \0034Host: \00314$userhost \0034(Raison: \00314$::kick(blacklist) ($expire)\0034) \0034sur: \00314$channel"
}
 
bind dcc o|o "+xprotect" [namespace current]::+xprotect
proc +xprotect {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .+protect <host>"
        putdcc $idx "\002Exemple :\002 .+protect alias_angelius*!*@*"
        return
    }
    if {[verify:b $::mod::fichier(protect) $host]} {
        putdcc $idx "\002Erreur :\002 $host est déjà enregistré."
        return
    }
    putdcc $idx "\002+protect :\002 Le host $host est maintenant protégé."
    ajouter:donnee $::mod::fichier(protect) $host
}
 
bind dcc o|o "-xprotect" [namespace current]::-xprotect
proc -xprotect {hand idx arg} {
    set host [lindex $arg 0]
    if {$host eq ""} {
        putdcc $idx "\002Erreur :\002 .-protect <host>"
        return
    }
    if {![verify:b $::mod::fichier(protect) $host]} {
        putdcc $idx "\002Erreur :\002 Le host $host n'est pas enregistré."
        return
    }
    putdcc $idx "\002-protect :\002 Le host $host n'est plus protégé."
    effacer:donnee $::mod::fichier(protect) $host
}
 
bind dcc o|o "xprotect" [namespace current]::xprotect
proc xprotect {hand idx arg} {
    putdcc $idx "---\002 Liste des protégé contre la modération \002---"
    liste:donnee $idx $::mod::fichier(protect)
}
 
bind pub o|o ".+protect" [namespace current]::+protect
proc +protect {nick uhost handle chan text} {
    set host [lindex $text 0]