| View previous topic :: View next topic |
| Author |
Message |
AK49BWL Voice
Joined: 02 Sep 2010 Posts: 7
|
Posted: Mon Sep 13, 2010 9:19 pm Post subject: {SOLVED} Getting user modes for chan owners and admins |
|
|
Here's what I'm trying to do.. I'm attempting to show owners and admins on my livestats channel pages for my website, rather than them showing up as just OP users (which is how the livestats script was originally written). On my channel currently, there are 6 users:
~AK49BWL, +qo
&GOD, +ao
&The_Wolf, +ao
@badSol, +o
@roadlet_411, +o
Player5
when I use !usermodes to activate, I get this on the output:
q=1 a=0 o=4 h=0 v=0 n=1 total=6
So the admins are seemingly being ignored by the script, or I did something wrong... I'm quite new to scripting so the latter is probably the case. But the owner is being detected, so I did something correct there.
The script works in the sense that it runs and throws no errors, but it doesn't work like I had hoped. My script as it sits currently:
| Code: | #test.tcl - BWL's always-on TCL script testing
bind pub - !usermodes pum
proc pum {nick uhost hand channel arg} {
set users [llength [chanlist $channel]]
set user_total $users
set user_q 0
set user_a 0
set user_o 0
set user_h 0
set user_v 0
set user_n 0
foreach user [chanlist $channel] {
if { [matchattr $user q $channel] } {
incr user_q
} elseif { [matchattr $user a $channel] } {
incr user_a
} elseif { [isop $user $channel] } {
incr user_o
} elseif { [ishalfop $user $channel] } {
incr user_h
} elseif { [isvoice $user $channel] } {
incr user_v
} else {
incr user_n
}
}
putserv "PRIVMSG $channel :q=$user_q a=$user_a o=$user_o h=$user_h v=$user_v n=$user_n total=$user_total"
}
putlog "BWL's Testing TCL Script loaded."
|
EDIT:::
Well I did some further messing around but eventually put the script back the way it is up there... But I also did this: I made user AK49BWL just a regular user and tried !usermodes again, and it gave me the exact same result of q=1 a=0 o=4 h=0 v=0 n=1 total=6..... When there is no +qo! So I really don't know what's going on here.
Last edited by AK49BWL on Fri Sep 24, 2010 5:27 pm; edited 1 time in total |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Fri Sep 24, 2010 8:10 am Post subject: |
|
|
1) First of all, it isn't clear whether you want bot user modes or irc channel user modes or a mixture. At the moment you are using a mixture. For example you use matchattr for bot mode a (autovoice) but isop for irc channel op mode.
2) An if - else-if - else code block means that code stops at the first test passed. For example, if a user had BOT modes qa then user_q would be incremented because this is the first test passed, but user_a would not. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
AK49BWL Voice
Joined: 02 Sep 2010 Posts: 7
|
Posted: Fri Sep 24, 2010 8:17 am Post subject: |
|
|
The latter is what I'm going for. I'm the chanowner so I should only show on +q status, not +o as well. The bot is +ao, and as such should only show under +a. That is the intent, anyway, if any of that actually worked at all.
I guess my question is, is there anything similar to isop (ishalfop, isvoice) for chanadmins and chanowners? I thought maybe matchattr was something I could sub for that but apparently not.. I didn't realize that was a bot-only deal.
So, to answer question 1, I want IRC channel user modes, for all of them.
+q = chanowner, +a = chanadmin, +o = op.... the rest is known... |
|
| Back to top |
|
 |
thommey Halfop
Joined: 01 Apr 2008 Posts: 73
|
Posted: Fri Sep 24, 2010 10:11 am Post subject: |
|
|
| http://thommey.tclhelp.net/?page=scripts has a script (arbitrary chanmodes) that provides you with [isowner] and [isadmin] for unrealircd which is what I assume you're using. If you don't, you might need to alter the mode parsing there, what I would need to do that is the CHANMODE= and PREFIX= information that comes on connect. If you're using unrealircd it will work fine |
|
| Back to top |
|
 |
AK49BWL Voice
Joined: 02 Sep 2010 Posts: 7
|
Posted: Fri Sep 24, 2010 5:26 pm Post subject: |
|
|
| thommey wrote: | | http://thommey.tclhelp.net/?page=scripts has a script (arbitrary chanmodes) that provides you with [isowner] and [isadmin] for unrealircd which is what I assume you're using. If you don't, you might need to alter the mode parsing there, what I would need to do that is the CHANMODE= and PREFIX= information that comes on connect. If you're using unrealircd it will work fine |
You rock. No joke. Had to figure out that the user modes needed to be re-set on the channel before the script would detect everything correctly but it very well worked!! Yes, I use UnrealIRCd, and no modifications were needed. Thanks a ton! |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|