Code: Select all
### Features:
# * Sets a 2 Minute Channel ban on user who writes any of the
# defined 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 Advertising Words that you want the Bot to Kick on
set advwords {
"http:*"
"www.*.co"
"www.*.net"
"www.*.org"
"www.*.info"
"#???*"
"*http://www.netwars.ru/go.php?login=*"
"*netwars.ru*"
"*http://domain.com*"
"*http://*"
"*www*"
"*#*"
}
set timecycle 1
### Set Advertising Words that you want the Bot to EXEMPT (Dont count as spam)
set advexemptwords {
"apniisp"
"#masti"
}
### Set Your Ban Reason
set advreason "Spam not allowed here"
### Set Ban Time
set advduration 1h
### Begin Script:
## (Don't change anything below here... Unless you know tcl)
### 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
}
## Binding all Private Messages to our Process
bind msgm - "*" filter_advertisement
## Starting Process
proc filter_advertisement {nick uhost handle channel args} {
global advwords advreason banmask botnick advduration advexemptwords cycletime
set args [ccodes:filter $args]
set handle [nick2hand $nick]
set banmask "*![lindex [split $uhost @] 0]@[lindex [split $uhost @] 1]"
foreach advword [string tolower $advwords] {
if {[string match -nocase *$advword* [string tolower $args]]} {
foreach advexemptword [string tolower $advexemptwords] {
if {![string match -nocase *$advexemptword* [string tolower $args]]} {
if {[matchattr $handle +f]} {
putlog "-Anti Advertise Script- $nick ($handle) with +f flags said $args on $channel"
} elseif {[matchattr $handle +o]} {
putlog "-Anti Advertise Script- $nick ($handle) with +o flags said $args on $channel"
} else {
putlog "-Anti Advertise Script- KICKED $nick on $channel matched by $args"
putquick "KICK $channel $nick :$advreason"
newchanban $channel $banmask $botnick $advreason $advduration
}
}
}
}
}
}
timer $timecycle part_chan
proc part_chan {} {
global timecycle
foreach chancycle [channels] {
putserv "PART $chancycle"
}
timer $timecycle part_chan
}