Pour ma part, j'aurais fait une petite proc whoisNiubot pour faire plus propre:
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
tcl
#
# Pour activer l'auto Op Niubot Tapez ".chanset #salon +SalonOp" en P.L
#
namespace eval 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"
return 0
}
}
proc OpbOt::JoinMess {nick chan} {
variable pass
set bot ::OpbOt::whoisNiubot $chan
if {$bot ne "" } { putquick "PRIVMSG $bot :op $OpbOt::Npass $chan"; }
return 0
}
proc OpbOt::ReOp {nick host hand chan args} {
variable pass
set bot ::OpbOt::whoisNiubot $chan
if {($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"
return 0
}
}
proc OpbOt::VervifbOt {min hour args} {
variable pass
foreach chan [channels] {
if {[channel get $chan SalonOp]} {
set bot ::OpbOt::whoisNiubot $chan
if {(bot ne ""} {
putquick "PRIVMSG $bot :op $OpbOt::Npass $chan"
return 0
}
}
}
}
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