This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Channel user stats?

Old posts that have not been replied to for several years.
s
syk
Voice
Posts: 22
Joined: Tue Jan 04, 2005 8:18 pm

Channel user stats?

Post by syk »

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
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Yes...
add the channel, wait for the "end of /who", compile and send the message and remove the channel.
Have you ever read "The Manual"?
s
syk
Voice
Posts: 22
Joined: Tue Jan 04, 2005 8:18 pm

Post by syk »

well, can you give me some sort of hint on how to do it? I know how to make it join the channel, but not too sure on how to relay the stats
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Relaying them is easy...just privmsg the target chan :twisted:
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.
Have you ever read "The Manual"?
s
syk
Voice
Posts: 22
Joined: Tue Jan 04, 2005 8:18 pm

Post by syk »

That lost me lol, maybe post some hint code(s)? I'm fairly new to this
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

"hint"

Post by user »

Code: Select all

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
	}
}
Have you ever read "The Manual"?
s
syk
Voice
Posts: 22
Joined: Tue Jan 04, 2005 8:18 pm

Post by syk »

Tcl error [chanstats:dcc]: called "chanstats:dcc" with too many arguments
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

syk wrote:Tcl error [chanstats:dcc]: called "chanstats:dcc" with too many arguments
Why did you do that? Don't change stuff without knowing what you're doing and come here complaining. You should at least say what you changed.
Have you ever read "The Manual"?
s
syk
Voice
Posts: 22
Joined: Tue Jan 04, 2005 8:18 pm

Post by syk »

user wrote:
syk wrote:Tcl error [chanstats:dcc]: called "chanstats:dcc" with too many arguments
Why did you do that? Don't change stuff without knowing what you're doing and come here complaining. You should at least say what you changed.
I didn't change anything, thats from a direct copy and paste
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

syk wrote:I didn't change anything, thats from a direct copy and paste
What did you do to get that error then? And what does '.set errorInfo' tell you?
Have you ever read "The Manual"?
s
syk
Voice
Posts: 22
Joined: Tue Jan 04, 2005 8:18 pm

Post by syk »

nevermind that, how do i execute the command?

[edit] well, i suppose its 'chanstats' but its the same error, and .set errorInfo? [/edit]
s
syk
Voice
Posts: 22
Joined: Tue Jan 04, 2005 8:18 pm

Post by syk »

ok well I fixed it, and it works, but I want it as a channel command, not dcc
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

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)
Have you ever read "The Manual"?
s
syk
Voice
Posts: 22
Joined: Tue Jan 04, 2005 8:18 pm

Post by syk »

well, I understand it, i'm just not sure how to convert it to a channel command, being that bind pub - .chanstats blah blah, doesnt work
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

syk wrote:well, I understand it, i'm just not sure how to convert it to a channel command, being that bind pub - .chanstats blah blah, doesnt work
The error message told you what was wrong. If you understand the code you should have no problem figuring out what to do.

(a proc invoked from a dcc bind is called with 3 arguments vs 5 arguments from a pub bind - check tcl-commands.doc for details)
Have you ever read "The Manual"?
Locked