je souhaiterais savoir si il est possible que vous m'aidiez à optimisé mon code.
le code fonctionne mais je sais pas pourquoi j'ai quelque doute sur la manière que je l'ai codé,est m'en remet a vous pour l'amélioré svp.
tcl
namespaceeval OpbOt {variable version 3.0variable Nom DnS
variable pass "PASS"variable chekbOt 10}proc OpbOt::Join{nick host hand chan args}{if{[channel get $chan SalonOp]}{
putlog "\002\00303\[Ok\]\002\00314 Je me Op sur $chan"
utimer $OpbOt::chekbOt[list OpbOt::JoinMess$nick$chan]}else{if{![channel get $chan SalonOp]}{
putlog "\002\00304\[Refuser\]\002\00314 Je ne suis pas activé sur $chan"return0}}}
12/05/2011, 13:37 (Modification du message : 12/05/2011, 13:41 par MenzAgitat.)
Tu t'es compliqué la vie au niveau de la condition dans la proc Join et ton indentation est un peu aléatoire. De plus, si le return 0 a une quelconque utilité pour vérifier le résultat d'exécution de la proc Join, peut-être un return 1 serait-il utile aussi.
tcl
namespaceeval OpbOt {variable version 3.0variable Nom "DnS"variable pass "PASS"variable chekbOt 10}proc OpbOt::Join{nick host hand chan args}{if{[channel get $chan SalonOp]}{
putlog "\002\00303\[Ok\]\002\00314 Je me Op sur $chan"
utimer $OpbOt::chekbOt[list OpbOt::JoinMess$nick$chan]return1}else{
putlog "\002\00304\[Refuser\]\002\00314 Je ne suis pas activé sur $chan"return0}}
Ha d'accord :-) merci MenzAgitat pour cette explication.
j'aurais une autre réponse,en fait je refait une autre version de auto op Niubot est je voudrais savoir ce qui est le plus rapide pour la détection du bot "Niubot' j'avais pensé au départ a une regex:
voici mon code qui je pense est terminé.donc si vous avais des conseils et améliorations a me faire je suis preneur. merci de votre aide.
tcl
## Pour Activer l'auto Op Niubot Tapez ".chanset #salon +SalonOp" en P.L#namespaceeval OpbOt {variable version 3.0variable auteur DnS
#Ici Mettre le Mot de passe variable Npass "MDP"variable chekbOt 10}proc OpbOt::Join{nick host hand chan args}{if{[channel get $chan SalonOp]}{
putlog "\002\00303\[Ok\]\002\00314 Je me Op sur $chan"
utimer $OpbOt::chekbOt[list OpbOt::JoinMess$nick$chan]}else{
putlog "\002\00304\[Refuser\]\002\00314 Je ne suis pas activé sur $chan"return0}}proc OpbOt::JoinMess{nick chan}{variable pass
set nicks [chanlist $chan]set bot [string tolower [lsearch -nocase -inline $nicks Niubot*]]
putquick "PRIVMSG $bot :op $OpbOt::Npass $chan"return0}proc OpbOt::ReOp{nick host hand chan args}{variable pass
set nicks [chanlist $chan]set bot [string tolower [lsearch -nocase -inline $nicks Niubot*]]if{[channel get $chan SalonOp]}{
putlog "\002\00303\[Ok\]\002\00314 Je me ReOp sur $chan"
putquick "PRIVMSG $bot :op $OpbOt::Npass $chan"}else{
putlog "\002\00304\[Refuser\]\002\00314 Je ne suis pas activé sur $chan"return0}}proc OpbOt::VervifbOt{min hour args}{variable pass
foreach chan [channels]{set nicks [chanlist $chan]set bot [string tolower [lsearch -nocase -inline $nicks Niubot*]]if{[channel get $chan SalonOp]}{
putquick "PRIVMSG $bot :op $OpbOt::Npass $chan"return0}}}
bind join - * OpbOt::Join
bind mode - *-o* OpbOt::ReOp
bind time -|- {*****} OpbOt::VervifbOt
setudef flag SalonOp
putlog "\002$OpbOt::version by $OpbOt::auteur Chargé.\002"
12/05/2011, 15:34 (Modification du message : 12/05/2011, 15:38 par CrazyCat.)
Pour ma part, j'aurais fait une petite proc whoisNiubot pour faire plus propre:
tcl
## Pour activer l'auto Op Niubot Tapez ".chanset #salon +SalonOp" en P.L#namespaceeval OpbOt {variable version "3.0"variable auteur "DnS" #Ici Mettre le Mot de passe variable Npass "MDP"variable chekbOt 10}proc OpbOt::Join{nick host hand chan args}{if{[channel get $chan SalonOp]}{
putlog "\002\00303\[Ok\]\002\00314 Je me Op sur $chan"
utimer $OpbOt::chekbOt[list OpbOt::JoinMess$nick$chan]}else{
putlog "\002\00304\[Refuser\]\002\00314 Je ne suis pas activé sur $chan"return0}}proc OpbOt::JoinMess{nick chan}{variable pass
set bot ::OpbOt::whoisNiubot$chanif{$bot ne ""}{ putquick "PRIVMSG $bot :op $OpbOt::Npass $chan";}return0}proc OpbOt::ReOp{nick host hand chan args}{variable pass
set bot ::OpbOt::whoisNiubot$chanif{($bot ne "")&&[channel get $chan SalonOp]}{
putlog "\002\00303\[Ok\]\002\00314 Je me ReOp sur $chan"
putquick "PRIVMSG $bot :op $OpbOt::Npass $chan"}else{
putlog "\002\00304\[Refuser\]\002\00314 Je ne suis pas activé sur $chan"return0}}proc OpbOt::VervifbOt{min hour args}{variable pass
foreach chan [channels]{if{[channel get $chan SalonOp]}{set bot ::OpbOt::whoisNiubot$chanif{(bot ne ""}{
putquick "PRIVMSG $bot :op $OpbOt::Npass $chan"return0}}}}proc OpbOt:whoisNiubot {chan}{set nicks [chanlist $chan]return[string tolower [lsearch -nocase -inline $nicks Niubot*]]}
bind join - * OpbOt::Join
bind mode - *-o* OpbOt::ReOp
bind time -|- {*****} OpbOt::VervifbOt
setudef flag SalonOp
putlog "\002$OpbOt::version by $OpbOt::auteur Chargé.\002"
En plus, j'ai un peu modifié OpbOt::VervifbOt pour ne pas faire appeler OpbOt:whoisNiubot si le canal n'a pas le flag SalonOp