Tout d'abord, il vaut mieux utiliser une liste qu'une chaine:
Ou:
Et ensuite, tu peux utiliser lsearch:
tcl
set botsalon { "#channel" "#chanel2" "..." }
set botniu {"niubot1" "niubot2" "..."}
set botpass {"pass1" "pass2" "..."}
Ou:
tcl
set botsalon [split "#channel #chanel2 ..."]
set botniu [split "niubot1 niubot2 ..."]
set botpass [split "pass1 pass2 ..."]
Et ensuite, tu peux utiliser lsearch:
tcl
bind join - "* *" autoop
proc autoop { nick uhost hand chan } {
if {$nick != $::botnick} {
return 0
}
set idt [lsearch $::botsalon [string tolower $chan]]
if { $idt eq -1 } {
# ce canal n'est pas géré
return 0
} else {
putserv "PRIVMSG [lindex $::botniu $idt] :op [lindex $::botpass $idt] $chan"
putserv "PRIVMSG [lindex $::botniu $idt] :voice [lindex $::botpass $idt] $chan"
}
}