mIRC Home    About    Download    Register    News    Help

Print Thread
#273448 03/06/25 12:13 PM
Joined: May 2022
Posts: 136
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 136
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)

Code
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

Joined: May 2022
Posts: 136
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 136
This is how I tried to edit, but still same problem...List of allowed words is not considered and user is banned altought the word is in the list:

Code
on *:text:*:#MYCHANNEL:{
  if ($nick !isop #) && ($nick !ishop #) && ($nick !isvoice #) { 
    $bad($1-) 
  } 
} 

alias bad { 
  var %i 1
  while (%i <= $lines(badwords\eccezioni.txt)) {    /* File with list of allowed words*/
         if ($read(badwords\eccezioni.txt, %i) iswm $1- ) { halt }   /* Check if used words are allowed in eccezioni.txt file */
    inc %i
  }
  var %o 1 
  while (%o <= $lines(badwords\badwords.txt)) {
    if ($read(badwords\badwords.txt, %o) iswm $1- ) { 
      ban -u3600 #MYCHANNEL $address($nick,2) | write $mircdir $+ banlog.txt *Badwords* $date $time $nick ---> $address  /* BAN after been WARNED and write log in a eccezioni.txt
      kick #eMule-Italian $nick /* KICK after been WARNED */
      unset %bad [ $+ [ $nick ] ] 
    } 
    elseif ($read(badwords\badwords.txt, %o) iswm  $1- ) { 
      kick #eMule-Italian $nick TO WRITE $read(badwords\badwords.txt, %o)  /*WARNING WITH NOT ALLOWED WORD HERE */
      set %bad [ $+ [ $nick ] ] $nick 
      .timer 1 300 unset %bad [ $+ [ $nick ] ] 
    } 
    inc %o 
  } 
} 

List of allowed words is in a eccezioni.txt file
Any help please?
Thanks


Link Copied to Clipboard