Hello.
I'm making changes to this addon that kicks/bans a user if they use any words included in a badwords.txt file.
I would like to add a line so that some words included in a sentence are excepted. These excepted words are included in an exceptions.txt file.
For example:
-If a sentence contains dick (that is a badword) , you are kicked. But the word DICK (not allowed) is also part of DICKENS (allowed). So the word DICKENS is included in the exceptions. But a user could write "YOU_ARE_A_DICKHEAD_GUY", so I inluded *DICK*. Any word that include DICK/DICKS but not vulgar, are included in the exceptions (for example DICKENS, MOBY_DICK, etc...)
-Or if someone spam with "http" or "https", must be kicked/banned, so I add *HTTP* to the badwords, but in the exceptions I add for example *http://www.miositoweb*, or *https://www.mioforum* (I'm not spamming, those links are fake)
on *:text:*:#CHANNEL:{
if ($nick !isop #) && ($nick !ishop #) && ($nick !isvoice #) {
$bad($1-)
}
}
alias bad {
var %o 1
while (%o <= $lines(badwords\badwords.txt)) {
;============ WHAT I ADDED =======
if ($read(badwords\eccezioni.txt, %o) iswm $1- ) && (%bad [ $+ [ $nick ] ] == $nick) { halt }
;===============================
if ($read(badwords\badwords.txt, %o) iswm $1- ) && (%bad [ $+ [ $nick ] ] == $nick) {
ban -u3600 #CHANNEL $address($nick,2) | write $mircdir $+ banemule.txt *Badwords* $date $time $nick ---> $address
kick #CHANNEL $nick BAN REASON
unset %bad [ $+ [ $nick ] ]
}
elseif ($read(badwords\badwords.txt, %o) iswm $1- ) {
kick #CHANNEL $nick WRITING $read(badwords\badwords.txt, %o) NOT ALLOWED. NEXT IS BAN
set %bad [ $+ [ $nick ] ] $nick
.timer 1 300 unset %bad [ $+ [ $nick ] ]
}
inc %o
}
}
The addon works, except that it doesn't consider exceptions and also kick/bans words included in exceptions.txt.
Where is my mistake?
Thanks for help