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 

[SOLVED] Anti Abuse Script case sensative comparision

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


Joined: 03 Mar 2012
Posts: 4
Location: Colorado

PostPosted: Sun Mar 04, 2012 1:30 pm    Post subject: [SOLVED] Anti Abuse Script case sensative comparision Reply with quote

I am new to Eggdrops and TCL scripting. I don't know much at all really.

On our bot we are using the Anti Abuse script from then archive and it works but we would like to make it so that is case sensitive for the comparisons. I have tried to contact the author but the e-mail address is no good any more.

I believe the problem is here:
Code:

   foreach badword [string tolower $badwords] {     
   if {[string match *$badword* [string tolower $args]]}  {


Where string tolower takes all the capitals out of both the badword file and the typed text. I have tried to remove the string tolower but that just breaks the script.

So the question is what can I do to fix the script so that the comparisons are done in a case sensitive manner?

Here is the whole script:

Code:

### Introduction
# Anti Abuse Script
# SadSalman <-> salman.mehmood@gmail.com
# Version No: 0.2


### 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 {
"PERV"   
"[censored]"
"nigger"
"nigga"
}

### Set Your Ban Reason
set badreason "You used word unacceptable in this channel"

### Set Ban Time
set bwduration 120

### 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 "-Anti Abuse Script- $nick ($handle) with +f flags said $args on $channel"
       } elseif {[matchattr $handle +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
       }
    }
  }
}
bind pubm - * filter_bad_words
putlog "SadSalman's Anti Abuse Script Loaded"


Thanks for the help,

Barkeep


Last edited by Barkeep on Tue Mar 06, 2012 11:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun Mar 04, 2012 10:37 pm    Post subject: Reply with quote

Code:
proc filter_bad_words {nick uhost handle channel arg} {
 ...
 set args [ccodes:filter $arg]
 ...
   foreach badword $badwords {     
   if {[string match *$badword* $arg]}  {


You are correct about the last 2 lines needing that [string tolower] wrapped around them removed. The issue is the script is "incorrectly" using the special reserved word "args" within it's procedure header. This causes your issue. Using "args" within the script is fine. But when using it to pass parameters as part of the procedure header without knowing what it does causes that issue. Change the lines above to look like they are and you should have no issues.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Barkeep
Voice


Joined: 03 Mar 2012
Posts: 4
Location: Colorado

PostPosted: Tue Mar 06, 2012 11:19 pm    Post subject: Problem solved Reply with quote

Thanks for the quick reply Speechles. We are having some other troubles with the bot but once it gets stable again I will implement this change. I'm sure it will fix the issue so I will make this Solved.

Thanks again.

Barkeep
Back to top
View user's profile Send private message
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