07/11/2016, 13:06
(Modification du message : 07/11/2016, 13:08 par aliasangelius.)
Salut, un exemple sur un code que j'avais fait à l'époque. Dedans ya le système que tu recherche :
Il te faut le flag +o en PL
à toi de voir pour certaines modifications à ta guise :)
tcl
namespace eval GB {
# Salon de log #
variable log "#LM-Staff"
# Commande Prefix Permet de choisir la commande par défault soit "." ou "!" #
set commande(choix) "!"
array set msg {
"access" "Désolé $nick mais je ne trouve pas ton accès dans ma base de données !"
"auth" "Avant d'utiliser la commande veuillez vous authentifier au préalable merci : ( /msg $::botnick auth <pseudo> <pass> )"
"level" "Vous n'avez pas le level suffisant dans $::botnick pour utiliser cette commande $nick !"
"nosalon" "Désolé $nick mais je suis absent du salon $chan !"
}
proc auth { nick host hand arg } {
set args [split $arg]
set chan [lindex $arg 0]
set pseudo [lindex $arg 0]
if {[llength $args] != 2} {
puthelp "notice $nick :\002Erreur :\002 ( /msg $::botnick auth <pseudo> <pass> )"
return 0
}
set password [lindex $args 1]
if { [nick2hand $pseudo] eq "*" } {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(access)]"
return 0
}
if {![passwdok $pseudo $password]} {
puthelp "notice $nick :\002Erreur :\002 Votre mot de pass ou/et votre pseudo est/sont incorrect(s) !"
return 0
}
if {![string match -nocase [lindex [getuser $pseudo HOSTS] 0] $nick!$host]} {
puthelp "notice $nick :\002Erreur :\002 Votre host ne correspond pas avec votre access !"
return 0
}
if {[getuser $pseudo XTRA AUTH] eq "ON"} {
puthelp "notice $nick :\002Erreur :\002 Vous êtes déjà authentifier !"
return 0
}
if {[getuser $hand XTRA SUSPEND] eq "ON"} {
puthelp "notice $nick :\002Erreur :\002 Vous êtes suspendu !"
return 0
}
puthelp "notice $nick :\0031\[AUTHENTIFICATION REUSSIE\]\0031 Vous êtes maintenant authentifié !"
putserv "privmsg $GB::log :\00314Commande \0036\[\0033Auth\0036\] \0031par : \0034$hand"
putquick "invite $nick $::GB::log"
setuser $pseudo XTRA AUTH ON;
setuser $hand XTRA SEEN [clock format [clock seconds] -format "le %d/%m/%Y à %Hh%M"]
save
return
}
proc addchan { nick host hand text } {
set chan [lindex $text 0]
set channel [lindex $text 1]
if { [nick2hand $nick] eq "*" } {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(access)]"
return 0
}
if {![isauth $hand]} {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(auth)]"
return 0
}
if {$text==""} {
puthelp "notice $nick :Addchan incorrect ! Veuillez respecter la syntaxe suivante : ( /msg $::botnick addchan <#salon> ) !"
}
if ![matchattr $hand o [lindex $text 0]] {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(level)]"
return 0
}
if ![string match -nocase $chan] {
putserv "privmsg $::GB::log :\00314Commande \0036\[\0033Add-Chan\0036\] \0031par : \0034$hand"
putserv "notice $nick :$chan Rajouter au Addchan !"
channel add $chan
savechannels
return
}
}
proc delchan { nick host hand text } {
set chan [lindex $text 0]
set channel [lindex $text 1]
if { [nick2hand $nick] eq "*" } {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(access)]"
return 0
}
if {![isauth $hand]} {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(auth)]"
return 0
}
if {$text==""} {
puthelp "notice $nick :Addchan incorrect ! Veuillez respecter la syntaxe suivante : ( /msg $::botnick delchan <#salon> ) !"
}
if ![matchattr $hand o [lindex $text 0]] {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(level)]"
return 0
}
if ![string match -nocase $chan] {
putserv "privmsg $::GB::log :\00314Commande \0036\[\0033Del-Chan\0036\] \0031par : \0034$hand"
putserv "notice $nick :$chan Retiré des Addchan !"
channel remove $chan
savechannels
return
}
}
proc listchan { nick host hand text } {
set chan [lindex $text 0]
set chans [join [lrange [split $text] 0 0]]
if { [nick2hand $nick] eq "*" } {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(access)]"
return 0
}
if {![isauth $hand]} {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(auth)]"
return 0
}
if ![matchattr $hand o| [lindex $text 0]] {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(level)]"
return 0
}
if [string match -nocase $chans $chan] {
set voir 1
putquick "privmsg $nick :\0034\[Liste Salons\]"
foreach liste [channels] {
putquick "privmsg $nick :\0037=>\0032 $voir \0037<= \0033 $liste"
incr voir 1
}
putquick "privmsg $nick :\0036\[Fin De Liste\]"
putserv "privmsg $GB::log :\00314Commande \0036\[\0033List-Chan\0036\] \0031par : \0034$hand"
return 0
}
if {[lsearch [channels] $chans $chan]==-1} {
puthelp "notice $nick :[subst -nocommands -nobackslashes $::GB::msg(nosalon)]"
return
}
}
bind msg - "auth" [namespace current]::auth
bind msg - "addchan" [namespace current]::addchan
bind msg - "delchan" [namespace current]::delchan
bind msg - "listchan" [namespace current]::listchan
}
Il te faut le flag +o en PL
à toi de voir pour certaines modifications à ta guise :)