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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
irate
Voice
Posts: 8 Joined: Mon Jun 18, 2007 9:36 am
Post
by irate » Thu Jun 21, 2007 11:56 am
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!
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Thu Jun 21, 2007 2:04 pm
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
irate
Voice
Posts: 8 Joined: Mon Jun 18, 2007 9:36 am
Post
by irate » Thu Jun 21, 2007 5:11 pm
There's an error still
Tcl error [filter_racism]: wrong # args: no expression after "if" argument
Thank you.
irate
Voice
Posts: 8 Joined: Mon Jun 18, 2007 9:36 am
Post
by irate » Fri Jun 22, 2007 1:19 am
Does anyone know what's causing that error?
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Fri Jun 22, 2007 4:07 am
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
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Fri Jun 22, 2007 10:41 am
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
irate
Voice
Posts: 8 Joined: Mon Jun 18, 2007 9:36 am
Post
by irate » Fri Jun 22, 2007 11:27 am
Yeah, I fixed that, and then it showed me that error.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Fri Jun 22, 2007 6:38 pm
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.
awyeah
Revered One
Posts: 1580 Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:
Post
by awyeah » Sun Jun 24, 2007 7:19 am
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.
==================================