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.

Anti Racism

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
i
irate
Voice
Posts: 8
Joined: Mon Jun 18, 2007 9:36 am

Anti Racism

Post by irate »

Code: Select all

set advwords { 
"offensive word"
}  

### Set Advertising Words that you want the Bot to EXEMPT (Dont count as spam)
set advexemptwords { 
"night"
}

### Borrowed from awyeahs tcl scripts (www.awyeah.org) ###
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
}

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

## Starting Process
proc filter_advertisement {nick uhost handle channel args} {
  global advwords advreason banmask botnick advduration advexemptwords
  set args [ccodes:filter $args]
  set handle [nick2hand $nick]
  foreach advword [string tolower $advwords] {
    if {[string match *$advword* [string tolower $args]]}  {
      foreach advexemptword [string tolower $advexemptwords] {     
        if {![string match *$advexemptword* [string tolower $args]]}  {
          if {[matchattr $handle Kooky15]} {
            } elseif {[matchattr $handle +o]} {
            putserv "PRIVMSG #iratest :The admin $nick used a racist word ($args)."
            } else {
            putquick "KICK $channel $nick :noob"
          }
        }
      }
    }
  }
}
It halts after the second if, if someone could help me fix it, it would be great. Thanks!
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

It would be easier to check if the word is protected/excempt before.

Try:

Code: Select all

proc filter_advertisement {nick uhost handle channel text} {
  global advwords advreason banmask botnick advduration advexemptwords
  set text [ccodes:filter $text]
  set racist 0
  foreach word [split $text " "] {
    if {![string match -nocase "*$word*" "$advexemptwords"]} {
      if {[string match -nocase "*$word*" "$advwords"]} {
        set racist 1
        break
      }
    }
  }
  if {[matchattr $handle o|o $channel] && $racist} {
    putserv "PRIVMSG #iratest :An admin $nick used a racist word ($text)."
  } elseif {$racist} {
    putserv "KICK $channel $nick :noob"
  }
}
Last edited by r0t3n on Fri Jun 22, 2007 10:41 am, edited 1 time in total.
r0t3n @ #r0t3n @ Quakenet
i
irate
Voice
Posts: 8
Joined: Mon Jun 18, 2007 9:36 am

Post by irate »

There's an error still
Tcl error [filter_racism]: wrong # args: no expression after "if" argument
Thank you.
i
irate
Voice
Posts: 8
Joined: Mon Jun 18, 2007 9:36 am

Post by irate »

Does anyone know what's causing that error?
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

irate wrote:Does anyone know what's causing that error?
The conditional statement is incorrect.

Have a closer look.

This might help also: if manual page
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

I made a typo error (-nocaase) in the second if statement of the forward loop, i've updated the code in the post above. It should work now.
r0t3n @ #r0t3n @ Quakenet
i
irate
Voice
Posts: 8
Joined: Mon Jun 18, 2007 9:36 am

Post by irate »

Yeah, I fixed that, and then it showed me that error.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

You probably used some editor which added a \n after 'if' or something like that causing it to become erroneous. Use a proper editor (such as notepad on windows) while pasting/editing code.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Actually you can use stripcodes in eggdrop v1.6.17 or higher, and remove that strip codes proc.

Code: Select all

set args [stripcodes bcruag $args]
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Post Reply