Is there a way to make a bot join a channel, then report the op/voice/regular user statistics back to the channel that the command was executed in, then have it part the channel after it reports back?
i.e.:
<user> .chanstats #blah
<bot> Joining channel #blah..
<bot> There are 10 users total; 2 ops, 2 voiced and 6 regular users
Relaying them is easy...just privmsg the target chan
Use 'chanlist #chan' to list the nicks on the channel (this list is not complete before you recieve the "end of /who") and loop through that list checking who 'isop', 'isvoice' and not. (incrementing your counters or whatever) The 'llength' of the chanlist is the total number of users.
bind dcc n chanstats chanstats:dcc
proc chanstats:dcc {h i a} {
if {[validchan $a]} {
putdcc $i "check .channel $a"
} else {
set a [string tolower $a]
channel add $a
bind raw - 315 [list chanstats:raw $i $a]
putdcc $i "Joining $a..."
}
}
proc chanstats:raw {i c f k a} {
scan $a %*s%s a;# extract the channel name from the "end of /WHO" message
if {[string eq -noc $c $a]} {# it was the one we were looking for...
unbind raw - 315 [list chanstats:raw $i $c]
set t [llength [chanlist $c]]
if {$t>1} {
set o 0; set v 0; set r 0
foreach n [chanlist $c] {
if {[isop $n $c]} {incr o} elseif {[isvoice $n $c]} {incr v} {incr r}
}
putdcc $i "Total: $t, +o: $o, +v: $v, rest: $r"
} else {
putdcc $i "I'm the only one there."
}
channel remove $c
}
}
syk wrote:ok well I fixed it, and it works, but I want it as a channel command, not dcc
Was that a question? Why did you pretend you'd only need a few clues to figure this whole thing out?
Feel free to ask questions about parts of the code that you don't understand. If you don't understand any of it, your initial post should have been "I need a tcl that does ..... Can someone code it for me?" (or you should be reading manuals)