URL Kicking/Ban System (GUESTS)

By Bielie on Aug 07, 2012

I made this script for a friend of mine. Its used to keep guests from spamming or posting links.

on *:TEXT:*:#:{
  if ($nick isreg $chan)  && ($chanaccess($chan,$me) == 2) {
    if ($isurl($1-)) { inc -u3600 %count [ $+ [ $address($nick,2) ] ] 1
      if (%bannedlink [ $+ [ $address($nick,2) ] ]) { set -u3600 %count [ $+ [ $address($nick,2) ] ] 1 | unset %bannedlink [ $+ [ $address($nick,2) ] ] | notice $nick $logo(WARNING) $c1(You shouldnt post links on this channel if your not voiced!) 3:: $c1(Warning) 031 $+ $c1(/) $+ 043 $c1(before being kicked) 3:: $c1(Warning) 031 $+ $c1(/) $+ 044 $c1(before being banned.) | halt }
      if (%count [ $+ [ $address($nick,2) ] ] == 1) { notice $nick $logo(WARNING) $c1(You shouldnt post links on this channel if your not voiced!) 3:: $c1(Warning) 031 $+ $c1(/) $+ 043 $c1(before being kicked) 3:: $c1(Warning) 031 $+ $c1(/) $+ 044 $c1(before being banned.) | halt }
      if (%count [ $+ [ $address($nick,2) ] ] == 2) { notice $nick $logo(WARNING) $c1(You shouldnt post links on this channel if your not voiced!) 3:: $c1(Warning) 072 $+ $c1(/) $+ 043 $c1(before being kicked) 3:: $c1(Warning) 032 $+ $c1(/) $+ 044 $c1(before being banned.) | halt }
      if (%count [ $+ [ $address($nick,2) ] ] == 3) { notice $nick $logo(WARNING) $c1(You shouldnt post links on this channel if your not voiced!) 3:: $c1(Warning) 043 $+ $c1(/) $+ 043 $c1(before being kicked) 3:: $c1(Warning) 073 $+ $c1(/) $+ 044 $c1(before being banned.) | .timer 1 1 /cs kick $chan $nick You cant post links as a guest in here! | halt }
      if (%count [ $+ [ $address($nick,2) ] ] == 4) { notice $nick $logo(WARNING) $c1(You shouldnt post links on this channel if your not voiced!) 3:: $c1(Warning) 043 $+ $c1(/) $+ 043 $c1(before being kicked) 3:: $c1(Warning) 044 $+ $c1(/) $+ 044 $c1(before being banned.) | set %bannedlink [ $+ [ $address($nick,2) ] ] $true | .timer 1 1 ban $+(-,ku,3600) $chan $nick You cant post links as a guest in here! | halt }
      if (%count [ $+ [ $address($nick,2) ] ] > 4) { set %bannedlink [ $+ [ $address($nick,2) ] ] $true | .timer 1 1 ban $+(-,ku,3600) $chan $nick You cant post links as a guest in here! | halt }
      halt
    }
  }
}

on *:JOIN:#:{
  if (%count [ $+ [ $address($nick,2) ] ] == 3) { notice $nick $logo(WARNING) $c1(Remember that if you post a link in this hour you will be banned for one hour!) | halt }
}

alias isurl return $iif($regex($1-,/\b(?:(?:htt|ft)ps?://(?:www|ftp\.)?|www|ftp\.).*(?:\.[a-z]{2,4})(?::\d+)?(?:/\w+(?:/\w*/*)*|(?:\.[a-z]{2,4})|\?\S*)*\b/gi),$iif($prop,$regml($v1),$true))
alias logo { return $+($chr(03),14,***,$chr(03),10,$chr(91),$chr(03),06,$upper( $+ $1- $+ ),$chr(03),10,$chr(93),$chr(03),10,$chr(32),->,$chr(03)) }
alias c1 return $+($chr(3),14)
alias chanaccess {
  if ($1 ischan) {
    if ($2 ison $1) {
      var %pre = $remove($nick($1,$2).pnick,$2)
      if ($prop == pre) return %pre
      if ($prop == p) return $left(%pre,1)
      if ($iif($readini(modeq.ini,n,$2,$1),$true,$false) == $true) { return 5 }
      elseif ($iif($readini(modea.ini,n,$2,$1),$true,$false) == $true) { return 4 }
      elseif (@ isin %pre) || ($1 isop $2) { return 3  }
      elseif (% isin %pre) || ($1 ishop $2) { return 2  }
      elseif (+ isin %pre) || ($1 isvo $2) { return 1 }
      else { return 0 }
    }
  }
}

Comments

Sign in to comment.
MoshMage   -  Aug 07, 2012

neat.

 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.