# set your master channel that those requesting the bot has to be in #
set masterchan "#prassel"
# set message when no matches have been announced #
set nomatch "No matches announced at this moment"
# requirements (how many ops from servicechannel in the masterchannel) #
set chanusreq 1
# message to send back when a channel does not meet the requirements to get the bot #
set nochanreq "Your channel does not meet the requirements"
# message to notice user when successfully joined #
set chanjoinmsg "Joined $reqchan"
bind msg n|m|o "requestbot" chan:check
proc chan:check {nick chan} {
set authusers 0
set reqchan [lindex $text 0]
foreach nick [chanlist $reqchan] {
if {([isop $nick $reqchan] == 1) && ([onchan $nick $masterchan] == 1)} {
incr authusers
}
}
if {$authusers < $chanusreq} {
putserv "NOTICE $nick :$nochanreq"
}
elseif {$authusers >= $chanusreq} {
channel add $reqchan
putserv "NOTICE $nick :$chanjoinmsg"
}
}
First off, the number of arguments in your proc does not match the number of arguments used when the binding triggers (see doc/tcl-commands.doc).
Secondly, the variable "text" is not defined before it is used inside the same proc.
Third, you try to use some of the variabled you've defined in globalspace (outside the proc) from within the proc, using local namespace rather than the global (either access them using the "global" command, or use absolute addressing, ie $::nochanreq instead of $nochanreq
Fourth, chanlist will only operate on channels already added to your bot, so you cannot use it in this way (there is also a slight delay from when the channel is added, until your bot has actually joined it and gathered data on who's in the channel. During this time, chanlist will return an empty list).