| View previous topic :: View next topic |
| Author |
Message |
LoKii Voice
Joined: 21 Oct 2009 Posts: 34
|
Posted: Mon Feb 25, 2013 5:20 am Post subject: Alert all chanops based on conditions |
|
|
Hello everyone, I'm trying to learn some basics in TCL, and I'm trying a simple code for an onjoin property but the results are not exactly what i hoped for.
What i want is, if a user with certain flags (in this case with flags +qd or |+qd $channel) joins the room, the bot should alert all channel operators (and maybe even halfops) that the user who entered is blacklisted and my not gain OPs or Voice.
The code I have here is:
| Code: |
bind join - * proc_blacklist
proc proc_blacklist {nick host handle channel} {
if {[matchattr $nick +qd]} {
foreach u [chanlist $channel] {
if {[isop $u $channel]} {
putserv "NOTICE $u :Warning. $nick is on my Global Blacklist and may \002NOT\002 gain OPs or VOICE on any channel that I am on!"
return 1
}
}
}
if {[matchattr $nick |+qd $channel]} {
foreach u [chanlist $channel] {
if {[isop $u $channel]} {
putserv "NOTICE $u :Warning. $nick is on my Blacklist and may \002NOT\002 gain OPs or VOICE on channel $channel!"
return 1
}
}
} else {
return 1
}
}
|
If the bot is an OP on the channel, he will ONLY notice himself, however If i deop the bot (i am also OP on the chan), then the bot will notice me succesfully. However, if both of us (me and the bot) are opped, I never get the notice.
Any hints would be appreciated.
Cheers [/code] |
|
| Back to top |
|
 |
dirty Halfop
Joined: 08 Feb 2013 Posts: 40 Location: Romania
|
Posted: Mon Feb 25, 2013 6:53 am Post subject: |
|
|
Your error is that you stop the script that notices ops after he finds the first one..
| Code: |
if {[matchattr $nick |+qd $channel]} {
foreach u [chanlist $channel] {
if {[isop $u $channel]} {
putserv "NOTICE $u :Warning. $nick is on my Blacklist and may \002NOT\002 gain OPs or VOICE on channel $channel!"
return 1
}
}
} else {
return 1
}
|
so the right thing to do is
| Code: |
if {[matchattr $nick |+qd $channel]} {
foreach u [chanlist $channel] {
if {[isop $u $channel]} {
putserv "NOTICE $u :Warning. $nick is on my Blacklist and may \002NOT\002 gain OPs or VOICE on channel $channel!"
}
}
}
|
also i removed the else statement because it has no use _________________ come to the dark side.. I have cookies!
WwW.BotZone.TK |
|
| Back to top |
|
 |
LoKii Voice
Joined: 21 Oct 2009 Posts: 34
|
Posted: Mon Feb 25, 2013 8:11 am Post subject: |
|
|
Thank you very much dirty.
This indeed solved my issue (and darn, how could i not see this)
Cheers, now I can go on with the rest  |
|
| Back to top |
|
 |
|