Anti-Spambot

By PowerScripters on Jan 09, 2010

FIXED A SMALL BUG

This little Script gives you a full configurable Badword-List, User Access, and something more.

Syntax:
!botset [trigger/bantime] - You can choose the !Trigger, you can even make LOL a Trigger.
!badword [add/del/list] - The Scripts checks the Database before write the badword in.
!user [add/del] - You can add or delete a User for Admin-Mode.

Includes

KickCounter for each User.
Own KickMessages [must be stored in kickmsg.lst]
Installation Script

on ^*:TEXT:*:#:{
  if ($1 == %antispam.trigger $+ badword) { 
    if ($2 == list) {
      var %c 1
      var %x $lines(badwords.lst)
      while (%x) {
        notice $nick %c $+ : $read(badwords.lst,%c)
        inc %c
        if (%c == %x) { halt }
      }
    }
  } 
  if (badword isin $1) { halt }

  else {
    var %i 1
    while (%i <= $lines(badwords.lst)) {
      if ($read(badwords.lst,%i) isin $1-) { set %tmp.word $read(badwords.lst,%i) | goto badword }
      inc %i
    }
    halt
    ;@no-badword-detected
    :badword
    inc %kickcount. [ $+ [ $nick ] ]
    mode $chan +bbb $adress($nick,2) $address($nick,3) $address($nick,1) | kick $chan $nick (%antispam.bantime Seconds Ban) (badword %tmp.word $+ ) $read(kickmsg.lst) Kickcount: %kickcount. [ $+ [ $nick ] ]
    .timer  1 %antispam.bantime mode $chan -bbb $adress($nick,2) $address($nick,3) $address($nick,1)
  }
}
on 5:TEXT:*:#:{
  if (%antispam.trigger isin $1) {
    var %query $remove($1,%antispam.trigger)
    if (%query == botset) {
      if ($2 == trigger) {
        if (!$3) { msg $chan Syntax: %antispam.trigger $+ botset trigger <new_trigger> | halt }
        else { msg $chan New Trigger: $3 $chr(124) Old Trigger: %antispam.trigger | set %antispam.trigger $3 }
      }
      elseif ($2 == bantime) {
        if (!$3) { msg $chan Syntax: %antispam.trigger $+ botset bantime <seconds> | halt }
        else { set %antispam.bantime $3 | msg $chan New Bantime: %antispam.bantime Seconds. }
      }
      else { msg $chan Syntax: %antispam.trigger $+ botset <trigger|bantime> [value] | halt }
    }
    elseif (%query == user) {
      if (!$2) { msg $chan Syntax: %antispam.trigger $+ user <add|del> [value] | halt }
      elseif ($2 == add) { 
        if (!$3) { msg $chan Syntax: %antispam.trigger $+ user add <username> | halt }
        msg $chan Check Database for Slot..
        var %i 1
        while (%i <= $lines(users.lst)) {
          if ($read(users.lst,%i) == $3) { msg $chan User already exists.. ;) | halt }
          inc %i
        }
        write users.lst $3
        msg $chan Added User: $3 - Access $iif($4 == $null,5,$4) in Database.
        .auser $iif($4 == $null,5,$4) $3
      }
      elseif ($2 == del) {
        write -c users.lst.bak
        if (!$3) { msg $chan Syntax: %antispam.trigger $+ user del <username> | halt }
        var %i 1
        while (%i <= $lines(users.lst)) {
          write users.lst.bak $iif($read(users.lst,%i) == $3,'',$3)
          inc %i
        }
        .remove users.lst
        .ruser $3
        .copy users.lst.bak users.lst
      }
    }
    elseif (%query == badword) {
      if ($2 == add) { 
        if (!$3) { msg $chan Syntax: %antispam.trigger $+ badword add <word> | halt }
        var %i 1
        while (%i <= $lines(badwords.lst)) {
          if ($read(badwords.lst,%i) == $3) { msg $chan Word: $3 is already in my Database | halt }
          inc %i
        }
        msg $chan Added Badword: $3 - So stay tuned.
        write badwords.lst $3
      }
      elseif ($2 == list) {
        var %c 1
        var %x $lines(badwords.lst)
        while (%x) {
          notice $nick %c $+ : $read(badwords.lst,%c)
          inc %c
          if (%c == %x) { halt }
        }
      }
      elseif ($2 == del) {
        if (!$3) { msg $chan Syntax: %antispam.trigger $+ badword del <word> | halt }
        var %i 1
        write -c badwords.lst.bak
        while (%i <= $lines(badwords.lst)) {
          write badwords.lst.bak $remove($read(badwords.lst,%i),$3)
          inc %i
        }
        .remove badwords.lst
        .copy badwords.lst.bak badwords.lst
        msg $chan Deleted $3 - Database cleaned up.
      }
      else { msg $chan Syntax: %antispam.trigger $+ badword <del|add|list> [word] | halt }
    }
  }
}

alias -l install {
  set %antispam.trigger !
  set %antispam.bantime 1200
  echo 2 -ag Trigger: !
  echo 2 -ag Bantime: 1200 Seconds.
  write -c badwords.lst
  write badwords.lst motherfucker
  write badwords.lst hurensohn
  write badwords.lst nigga
  write badwords.lst nigg0r
  write badwords.lst fuck
  write badwords.lst nigger
  write badwords.lst bitch
  echo 2 -ag Added Badword: motherfucker
  echo 2 -ag Added Badword: hurensohn
  echo 2 -ag Added Badword: nigga
  echo 2 -ag Added Badword: nigg0r
  echo 2 -ag Added Badword: fuck
  echo 2 -ag Added Badword: nigger
  echo 2 -ag Added Badword: bitch
  echo 2 -ag Badword Hint: You can Block (motherfucker) if you add (fucker) to the badword list.
  :start
  var %use $input(Enter the Admin Username,e,admin)
  if (%use == $null) { goto start }
  else { goto next }
  :next
  write users.lst %use
  .auser 5 %use
  echo 2 -ag Added %use with Access 5
} 
-- installscript, type /antispam-install for installation
alias antispam-install { install }

# PowerScripters for President.

Comments

Sign in to comment.
napa182   -  Jan 09, 2010

@Master-Of-Death if you are going to do a rewrite please make sure to test it before you poste it as a comment.

 Respond  
Master-Of-Death   -  Jan 09, 2010

This was as much as I could simplify and correct for efficiency.

on *:LOAD:{
install
echo -a Script installed enjoy.
}
on $*:TEXT:/ $+ %regex $+ %swear $+ ) $+ /S:#:{
if ($ulevel == add) {
if (!$1) {
msg # Type: !commands for correct syntax.
}
elseif (!$2) {
msg # Type: !commands for correct syntax.
}
elseif ($regml(2) == add) {
.auser -a add $2
msg # Added User: $2 $+ .
}
elseif ($regml(2) == commands) {
msg $nick The Command Syntax list:
msg $nick !add <nick>
msg $nick !addword <word>
msg $nick !del <nick>
msg $nick !delword <word>
msg $nick End of Syntax list.
}
elseif ($regml(2) == del) {
.ruser $2
msg # Deleted User: $2 $+ .
}
}
elseif ($regml(2) == addword) {
set %regex %regex $+ | $+ $2
msg # Added $2 $+ .
}
elseif ($regml(2) == delword) {
set %regex $remove(%regex,| $+ $2)
msg # Deleted $2 $+ .
}
elseif ($regex($1-,%swear) {
inc %kickcount. [ $+ [ $nick ] ]
ban -ku $+ %ban $nick 2 (%ban Seconds Ban) (Badword: $regml(3)) Kickcount: %kickcount. [ $+ [ $nick ] ]
}
}
alias -l install {
set %regex (!)(|add|del|delword|addword|commands)
set %swear (fuck|shit|cunt|nigg(0|3|e|a)r?|hurensohn|bitch|wh(0|o)r(3|e
auser -a add $input(Enter the Admin Username,e,admin)
var %ban $input(Enter desired ban time,e,ban)
}

Sorry about the filtered words i'm sure you can figure out what they were.

DAMN YOU HAWKEE FILTERS!!!

 Respond  
PowerScripters   -  Jan 09, 2010

PS are scripting the whole day!: )

Want to join the PS?

connect to powerirc.homeip.net:6667 channel #ps
Contact Shiny or lol538
(U can contact lol538[Off] too

Some users use the [PS] tag

If u want to join Please use the [PS] tag before your nick

 Respond  
PowerScripters   -  Jan 09, 2010

@gooshie - fix the first and the second one. later i hope i can fix the other ones.

 Respond  
gooshie   -  Jan 09, 2010
if (($nick == $me) || (badword isin $1)) { halt }

No need to check for $me as you can not trigger your own TEXT event.

timer [ $+ [ $rand(1,9999) ] ]

Why not have it number itself for two reasons, less code and no risk of timer name collisions.

mode $chan +bbb $adress($nick,2) $address($nick,3) $address($nick,1) | kick $chan $nick (%antispam.bantime Seconds Ban) (badword %tmp.word $+ ) $read(kickmsg.lst) Kickcount: %kickcount. [ $+ [ $nick ] ]
timer [ $+ [ $rand(1,9999) ] ] 1 %antispam.bantime mode $chan -bbb $adress($nick,2) $address($nick,3) $address($nick,1)

adress is mispelled also better to just ban type 2 and use /ban -ku

Your while loops could use work but more importantly if you're gonna store the words in an external file it would be better to load them into hash at start so the harddrive heads dont have to zap over to that spot and read that file for every line of text spoken.

Also, you could use an on load event to do the /install

Hint: Any snippet that uses halt command more than a couple of times probably could be scripted better.

 Respond  
GuitarMasterx7   -  Jan 09, 2010

damn you guys are on a role lolz
nice job, might use it for stupid words
such as
L
LAWL
ect. =D

 Respond  
disabledacc   -  Jan 09, 2010
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.