Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

Anti-spam: slightly-more-advanced-script

Recommended Posts

  • Administrators
Thought I'd release another of my scripts; this time it is an anti-spam script.

Fairly simple to use, make sure you stick all of it in a new section in your remotes (ctrl+n is remotes).

 

Read below script for how to use it.

 

>on *:TEXT:*:#:{   if ($regex($1,/^[@\.`!]spam$/Si)) {     if ($nick !isop $chan) { notice $nick This command is an OP-ONLY script. | halt }     if (($me !isop $chan) && ($me !ishop $chan)) { notice $nick I must be halfop+ for the spam control to work (I need to be able to ban) | halt }     if ($2 != on) && ($2 != off) { notice $nick Wtf $nick $+ , you want this on or off? Then specify it ;@ | halt }     if ($2 == on) {       hadd -sm SpamOn $chan on      hadd -sm SpamPunish $chan timeban      notice $nick Spam control for $chan is now on. The punishment is auto-set to timeban for 3 minutes. To change, !punishment timeban/devoice.     }     elseif ($2 == off) {       hdel -s SpamOn $chan      hdel -s SpamPunish $chan      notice $nick You have unset the spam control for $chan to off.    }   }   if ($regex($1,/^[@\.`!]punishment$/Si)) {     if ($nick !isop $chan) { notice $nick This command is an OP-ONLY script. | halt }     if (($me !isop $chan) && ($me !ishop $chan)) { notice $nick I must be halfop+ for the spam control to work (I need to be able to ban) | halt }     if ($2 != timeban) && ($2 != devoice) && ($2 != ignore) { notice $nick Wtf $nick $+ , what punishment do you want to give spammers? Specify devoice or timeban. | halt }     if ($2 == devoice) {       hadd -s SpamPunish $chan devoice      notice $nick You have selected devoice as your punishment for spammers. I recommend you set mode +m so this punishment does something that'll make them feel bad.      }     elseif ($2 == timeban) {       hadd -s SpamPunish $chan timeban      notice $nick You have selected timeban as your punishment for spammers. Spammers will be banned for 3 minutes.     }   }  if (!$hget(Spams,$nick)) && ($hget(SpamOn,$chan) == on) {     hadd -sm Spams $nick 1     .timer 1 5 hdel -s Spams $nick  }   elseif ($hget(SpamOn,$chan) == on) && ($hget(Spams,$nick) = 4) {     $punishspam($hget(SpamPunish,$chan),$chan,$nick)  }} alias -l punishspam {  if ($1 == timeban) { return /ban -ku180 $2 $3 2 3 minute ban for spamming $2 $+ . }  elseif ($1 == devoice) { return /mode $2 -v $3 }}

 

!spam on/off :turn spam on or off

!punish(ment) devoice/timeban :set spam punishment to devoice or timed kick-ban.

 

You can change how much you can spam in certain times by editting the timer and the

 

>($($+(%,spam.,$nick),2) >= 4)

 

part.

 

I recommend if you set it to devoice, you set +m in your channel so it does something.

You can also change how long it bans for, in the punishspam alias @ part

 

>/ban -ku180

 

Have fun, this was my first ever script that used regex quite a bit. The one I have in my scripts is slightly different; I've added a script that bans a nick if they part when being devoice punished if they have auto-voice.

 

UPDATE: Thanks to Chessnut- it now use hashtables so it runs faster and doesn't clog up your variables!

 

>$replace($gettok(i.am.cool,1-2,46),.,$chr(32)) $remove($deltok(g.a.n.g.s.t.e.r.y,3-8,46),.)

Link to comment
Share on other sites



×
×
  • Create New...