Well first off, users don't stay on the same channels. Secondly, you would have to employ a significant delay before sending the network /whois to enable the user to join ALL their channels. In addition you would really have to manage users parting/quitting/splitting if you wish to maintain an array containing users/channels. Thirdly, if many users join as in a flood then you are back to multiple network /whois requests and the risk of an akill. So, overall, I'm afraid it's an unreasonable request.
nml375 is correct in pointing out that it is feasible if you limit the script to bot channels. That would involve simple Eggdrop Tcl commands rather than a network /whois per each user.
Code: Select all
# requires in the partyline .chanset #channelname +scanchan
# syntax !scanchan
setudef flag scanchan
bind PUB - !scanchan pScanchanCommand
proc pScanchanCommand {nick uhost hand channel txt} {
if {[channel get $channel scanchan]} {
if {[llength [split [string trim $txt]]] == 0} {
if {[llength [channels]] > 1} {
foreach usr [chanlist $channel] {
foreach chn [channels] {
if {(![string equal -nocase $chn $channel]) && (![isbotnick $usr])} {
if {[lsearch -exact [chanlist $chn] $usr] != -1} {
if {[info exists users($chn)]} {incr users($chn)} else {set users($chn) 1}
}
}
}
}
if {[array size users] != 0} {
set total 0
foreach {name value} [array get users] {
incr total $value
set percent [format %.2f [expr {(double($value) / ([llength [chanlist $channel]] - 1)) * 100.0}]]
lappend output \00312$name\003 $value (\00314$percent\%\003),
}
putserv "PRIVMSG $channel :[join $output] \002TOTAL\002 hits $total"
} else {putserv "PRIVMSG $channel :\00304error\003 (\00314$nick\003) - none of the users in this channel were found in my other channels"}
} else {putserv "PRIVMSG $channel :\00304error\003 (\00314$nick\003) - this is the only channel I am monitoring"}
} else {putserv "PRIVMSG $channel :\00304error\003 (\00314$nick\003) - correct syntax is !scanchan without additional arguments"}
}
return 0
}
The math excludes the bot itself, since it is almost certain to be on channels it has a channel record for. The individual percentage values are obviously not additive.
The example above indicates that one user in #eggTCL (the command channel) besides the bot itself (osmosis) is also in #Gigglers, and similarly three users in #Atlantis.
Do not use the command too quickly after the bot joins the command source channel, since it has to receive the network /who list for all its channels first.