egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to exempt ops and voiced users

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
sutkida
Voice


Joined: 19 Nov 2008
Posts: 12

PostPosted: Fri Nov 21, 2008 1:40 pm    Post subject: How to exempt ops and voiced users Reply with quote

Code:
proc filter_bad_words {nick uhost handle channel args} {
 global badwords badreason banmask botnick bwduration
 set args [ccodes:filter $args]
  set handle [nick2hand $nick]
   set banmask "*![lindex [split $uhost @] 0]@[lindex [split $uhost @] 1]"
   foreach badword [string tolower $badwords] {     
   if {[string match *$badword* [string tolower $args]]}  {
       if {[matchattr $nick +f]} {
           putlog "-Anti Abuse Script- $nick ($handle) with +f flags said $args on $channel"
       } elseif {[matchattr $nick +o]} {
           putlog "-Anti Abuse Script- $nick ($handle) with +o flags said $args on $channel"
       } else {
           putlog "-Anti Abuse Script- KICKED $nick on $channel matched by $args"
           putquick "KICK $channel $nick :$badreason"
           newchanban $channel $banmask $botnick $badreason $bwduration
       }
    }
  }
}

What to change so that chan ops and voiced are exempted when they speak badwords? In the code only the users that are added to the bot are exempted. A little help please. TYIA.
Back to top
View user's profile Send private message Yahoo Messenger
Getodacul
Voice


Joined: 07 Jun 2007
Posts: 20

PostPosted: Fri Nov 21, 2008 5:09 pm    Post subject: Reply with quote

Something like that:
Code:
# Protect ops (1=on 0=off)
set protops 1 

# Protect voices (1=on 0=off)
set protvoices 1

# Protect flags (1=on 0=off)
set protflags 1
set pflags "of|of"


proc filter_bad_words {nick uhost handle channel args} {
 global badwords badreason banmask botnick bwduration protops protvoices protflags pflags
 set args [ccodes:filter $args]
  set handle [nick2hand $nick]
   set banmask "*![lindex [split $uhost @] 0]@[lindex [split $uhost @] 1]"
   foreach badword [string tolower $badwords] {     
   if {[string match *$badword* [string tolower $args]]}  {
   if {(($protops == 1) && ([isop $nick $chan])) || (($protvoices == 1) && ([isvoice $nick $chan])) || (($protflags == 1) && ([matchattr $hand $pflags $chan]))} {
   putlog "-Anti Abuse Script- $nick ($handle) said $args on $channel"
   return 0
        } else {
           putlog "-Anti Abuse Script- KICKED $nick on $channel matched by $args"
           putquick "KICK $channel $nick :$badreason"
           newchanban $channel $banmask $botnick $badreason $bwduration
       }
    }
  }
}

It's not tested.
Back to top
View user's profile Send private message
sutkida
Voice


Joined: 19 Nov 2008
Posts: 12

PostPosted: Fri Nov 21, 2008 8:01 pm    Post subject: Reply with quote

tried the code but didn't worked.but it's ok now..found an alternative to that.here's the full code btw.
Code:
### Features:
# * Sets a 2 Minute Channel ban on user who writes any of the
#   defined bad words
# * Doesn't ban users with +o OR +f flags
# * Logs ALL user/op messages containing the defined words
# * Strips Character Codes from Messages

### Set Bad Words that you want the Bot to Kick on
set badwords {
blah.blah
}

### Set Your Ban Reason
set badreason "Badword Detected"

### Set Ban Time
set bwduration 24h

### Begin Script:
## (Don't change anything below here... Unless you know tcl)


## Binding all Public Messages to our Process
bind pubm - * filter_bad_words

### Borrowed from awyeahs tcl scripts (www.awyeah.org) ###
## awyeah said: Thanks to user and ppslim for this control code removing filter
proc ccodes:filter {str} {
  regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
  return $str
}

## Starting Process
proc filter_bad_words {nick uhost handle channel args} {
 global badwords badreason banmask botnick bwduration
 set args [ccodes:filter $args]
  set handle [nick2hand $nick]
   set banmask "*!*[lindex [split $uhost @] 0]@[lindex [split $uhost @] 1]"
   foreach badword [string tolower $badwords] {     
   if {[string match *$badword* [string tolower $args]]}  {
       if {[matchattr $handle +f]} {
           putlog " $nick ($handle) with +f flags said $args on $channel"
       } elseif {[matchattr $handle +o]} {
           putlog " $nick ($handle) with +o flags said $args on $channel"
       } else {
           putlog "KICKED $nick on $channel matched by $args"
           putquick "KICK $channel $nick :$badreason"
           newchanban $channel $banmask $botnick $badreason $bwduration
       }
    }
  }
}
# bind pubm - * filter_bad_words
putlog "Anti Badwords Script Loaded"

Now how to change the hours into minutes.The script base its bans on the bot's ban-time settings.I don't want to change the bot's ban-time settings.I just want the script to base its ban time within it.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber