on *:start:{
if !$hget(BadWords) { .hmake BadWords 10 }
if $exists(BadWords.hsh) { .hload BadWords BadWords.hsh }
}
on *:exit:{
.hsave -o BadWords BadWords.hsh
}
on *:disconnect:{
.hsave -o BadWords BadWords.hsh
}
menu menubar {
-
Private Offensive Message
.Turn $iif($hget(BadWords,0),Off,On) : .hadd -m BadWords 0 $iif($hget(BadWords,0),$false,$true
.-
.Add a word : .hadd -m BadWords $$?="Bad Word to be added" $true
.-
.Remove a word : .hdel BadWords $$?="Bad Word to be removed"
.-
.List Spam Words : bad_words_list
.-
}
alias -l bad_words_list {
var %a = 1, %b = $hget(BadWords,0).item
unset %badwords
while %a <= %b {
set %badwords $addtok(%badwords,$hget(BadWords,%a).item,32)
if $numtok(%badwords,32) + $len(%badwords) > 900 {
echo -a $replace(%badwords,$chr(32),$+($chr(44),$chr(32)))
unset %badwords
}
inc %a
}
if %badwords {
echo -a $replace(%badwords,$chr(32),$+($chr(44),$chr(32)))
unset %badwords
}
}
on *:open:?:{
if $ulevel != op && $hget(BadWords,0) {
var %cnt = 1
while (%cnt <= $hget(BadWords,0).item) {
if $hget(BadWords,%cnt).item isin $1- {
close -m $nick
spamdetect $nick
}
else { inc %cnt }
}
}
}
on ^*:notice:*:?: {
if (!$istok(ChanServ NickServ MemoServ,$nick,32)) && $hget(BadWords,0) {
var %cnt = 1
while (%cnt <= $hget(BadWords,0).item) {
if $hget(BadWords,%cnt).item isin $1- {
spamdetect $nick
haltdef
}
else { inc %cnt }
}
}
}
alias spamdetect {
var %a = 1
while $comchan($1,%a).op {
ban -ku3600 $v1 $1 2 14Private Offensive Language
}
inc %a
}