I hope its okay I changed the script a bit.
I added a variable, making it easier to add more matches for the anti advertise,
.chanset #channel +anti-advert (to activate it in your channel (partyline))
Operators, Voice and users added with exemptflags are ignored.
Bot is required operator status.
Change the variables after your need, if you have questions please post them, and I'll answer them as quick as possible.
- Code: Select all
setudef flag anti-advert
namespace eval advertisement {
namespace eval variable {
variable bantime 2
variable spambotbantime 120
variable exemptflags "nmf|nmf"
variable warnmessage "You are violating :channel: or Quakenet rules. Cease your abuse!"
variable spammessage "Spam messages in private chat. Banned for :spambotbantime: minuttes"
}
if {[info exists words]} {
unset words
}
set words {
"*www.*"
"*join*#*"
"*http:\/\/*"
"*idle*#*"
}
bind PUBM - "*" [namespace current]::public
bind MSGM - "*" [namespace current]::private
proc public {nickname hostname handle channel text} {
if {[channel get $channel anti-advert]} {
if {[::advertisement::allow $nickname $handle $channel]} {
set result 0
foreach word $::advertisement::words {
if {[string match $word "$text"]} {
set result 1
}
}
if {$result == 1} {
set banmask "*!*[string trim $hostname "~"]"
putserv "PRIVMSG $nickname :[string map "\":channel:\" \"$channel\"" $::advertisement::variable::warnmessage]"
putquick "MODE $channel -v+b $nickname $banmask"
timer $::advertisement::variable::bantime [list pushmode $channel -b $banmask]
}
}
}
}
proc private {nickname hostname handle text} {
set result 0
foreach word $::advertisement::words {
if {[string match $word "$text"]} {
set result 1
}
}
if {$result == 1} {
foreach channel [channels] {
if {[channel get $channel anti-advert]} {
if {[::advertisement::allow $nickname $handle $channel]} {
set banmask "*!*[string trim $hostname "~"]"
set kickmessage [string map "\":spambotbantime:\" \"$::advertisement::variable::spambotbantime\"" $::advertisement::variable::spammessage]
if {[onchan $nickname $channel]} {
putquick "KICK $channel $nickname :$kickmessage"
putquick "MODE $channel +b $banmask"
}
newchanban $channel $banmask $::botnick "$kickmessage" $::advertisement::variable::spambotbantime
}
}
}
}
}
proc allow {nickname handle channel} {
if {[botisop $channel]} {
return 1
} elseif {![isop $nickname $channel]} {
return 1
} elseif {![isvoice $nickname $channel]} {
return 1
} elseif {![matchattr $handle $::advertisement::variable::exemptflags $channel]} {
return 1
}
}
}