This is from boredom one day, thanks to Typo for helping with majority of it!
Triggers:
/badon (turns badword filter on.)
/badoff (turns badword filter off.)
/addw (adds badword to list)
/badwchan (adds a channel to the badword protection list)
on *:text:*:#: {
if ($chan == $eval($+(%,badwchan,.,$chan),2)) {
if (%badw == on) {
var %nbw $lines(badw.txt)
while (%nbw) {
if ($read(badw.txt, %nbw) isin $1-) {
inc $+(%,badwnick,.,$nick) 1
if ($($+(%,badwnick,.,$nick),2) == 1) { .notice $nick First warning, do not say that badword again. }
if ($($+(%,badwnick,.,$nick),2) == 2) {
cs kick $chan $nick
.notice $nick Warned you the first time, this is your last. Next time will be a kickban/akick.
}
if ($($+(%,badwnick,.,$nick),2) >= 3) {
ban -k $chan $nick
.notice $nick That was your last warning.
}
}
dec %nbw
}
}
}
}
alias badon {
if (%badw == on) {
echo -a Badword filter is already on!
}
else {
set %badw on
echo -a Badword filter is now on!
}
}
alias badoff {
if (%badw == off) {
echo -a Badword filter is already off!
}
else {
set %badw off
echo -a Badword filter is now off!
}
}
alias addw {
if ($1 == $read(badw.txt,w,$1)) {
echo -a That word is already on the badword list!
}
else {
write badw.txt $1
echo -a Badword has been added to the badword list!
}
}
alias remban {
unset $+(%,badwnick,.,$1)
}
alias badwchan {
if ($1 == $read(badwchan.txt,w,$1)) {
echo -a That channel is already on the list!
}
else {
set $+(%,badwchan,.,$1)
write badwchan.txt $1
echo -a Channel: $1 is now on channel protection list!
}
}
on ur ban line how about setting a banmask to it cuz they can just change nicks so maybe
for ircd
ban -k $chan $nick 2
for Chatspace
ban -k $chan $nick 4
i dont see why you add a var for the channel and then write it to a txt file.. just add the channel to a var then use tokens to check the channel maybe like this
alias badwchan {
if (!$istok(%badwchan,$1,44)) {
echo -a Channel: $1 is now on channel protection list!
set %badwchan $addtok(%badwchan,$1,44)
}
else { echo -a That channel is already on the list! }
}
and then use this line to check for the channel on ur on text
if ($istok(%badwchan,$chan,44) && %badw == on) {
another thing is that it warns/kick/ban\'s for wildcard matches like say i add hell for a bad word it triggered on hello =/
[12:20 am] hello
[12:20 am] -sick0- First warning, do not say that badword again.
[12:20 am] hello
[12:20 am] -sick0- Warned you the first time, this is your last. Next time will be a kickban/akick.
=/