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.

Alert all chanops based on conditions

Help for those learning Tcl or writing their own scripts.
Post Reply
L
LoKii
Voice
Posts: 34
Joined: Wed Oct 21, 2009 3:59 am

Alert all chanops based on conditions

Post by LoKii »

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: Select all

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]
d
dirty
Halfop
Posts: 40
Joined: Fri Feb 08, 2013 2:33 pm
Location: Romania
Contact:

Post by dirty »

Your error is that you stop the script that notices ops after he finds the first one..

Code: Select all

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: Select all

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
L
LoKii
Voice
Posts: 34
Joined: Wed Oct 21, 2009 3:59 am

Post by LoKii »

Thank you very much dirty.

This indeed solved my issue (and darn, how could i not see this) :roll:


Cheers, now I can go on with the rest :)
Post Reply