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 

Anti Racism

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
irate
Voice


Joined: 18 Jun 2007
Posts: 8

PostPosted: Thu Jun 21, 2007 11:56 am    Post subject: Anti Racism Reply with quote

Code:
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!
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Thu Jun 21, 2007 2:04 pm    Post subject: Reply with quote

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

Try:

Code:
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"
  }
}

_________________
r0t3n @ #r0t3n @ Quakenet


Last edited by r0t3n on Fri Jun 22, 2007 10:41 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
irate
Voice


Joined: 18 Jun 2007
Posts: 8

PostPosted: Thu Jun 21, 2007 5:11 pm    Post subject: Reply with quote

There's an error still

Quote:
Tcl error [filter_racism]: wrong # args: no expression after "if" argument


Thank you.
Back to top
View user's profile Send private message
irate
Voice


Joined: 18 Jun 2007
Posts: 8

PostPosted: Fri Jun 22, 2007 1:19 am    Post subject: Reply with quote

Does anyone know what's causing that error?
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Fri Jun 22, 2007 4:07 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Fri Jun 22, 2007 10:41 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message MSN Messenger
irate
Voice


Joined: 18 Jun 2007
Posts: 8

PostPosted: Fri Jun 22, 2007 11:27 am    Post subject: Reply with quote

Yeah, I fixed that, and then it showed me that error.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Jun 22, 2007 6:38 pm    Post subject: Reply with quote

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.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Sun Jun 24, 2007 7:19 am    Post subject: Reply with quote

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

Code:

set args [stripcodes bcruag $args]

_________________
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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