My Blacklist

By chadbdurham on Jul 10, 2010

My blacklist
Do "/info" to see the commands

on *:JOIN:#:.timer 1 1 bc $nick $chan
alias -l bc {
  if ($read(Blacklist.txt,w,$1)) || ($read(Blacklist.txt,w,$address($1,2))) {
    var %rd = $readn
    if (($me !isop $2) && ($me !ishop $2)) || (($me ishop $2) && ($1 isop $2)) echo -st /!\ Blacklist match! Channel: $2 Nick: $1 Address: $Address($1,2) Match: $iif($chr(64) isin $ifmatch,Address,Nick) Reason: $iif($read(BlackListReason.txt,%rd) == Null,Unspecified,$read(BlackListReason.txt,%rd)) NOTE: I cannot kick this user!
    else {
      echo -st /!\ Blacklist match! Channel: $2 Nick: $1 Address: $Address($1,2) Match: $iif($chr(64) isin $ifmatch,Address,Nick) Reason: $iif($read(BlackListReason.txt,%rd) == Null,Unspecified,$read(BlackListReason.txt,%rd)) Banning $1
      if ($me isop $2) { mode $2 -Q }
      ban -k $2 $1 2 1¤10Blacklisted1¤ (11Reason1:12 $iif($read(BlackListReason.txt,%rd) == Null,Unspecified,$read(BlackListReason.txt,%rd)) $kickc
    }
  }
}
alias bl {
  if ($2) {
    write BlackList.txt $iif($1 ison $active,$address($1,2),$1)
    write BlackListReason.txt $2-
    echo -ta [Blacklist] Successfully written $1 to blacklist. Reason: $2-
    if ($1 ison $active) {
      if (($me !isop $active) && ($me !ishop $active)) || (($me ishop $chan(%x)) && ($nick($chan(%x),%y) isop $chan(%x))) echo -st I cannot kick $1 from $active $+ !
      else {
        mode $active -Qohv+b $1 $1 $1 $address($1,2) | kick $active $1 1¤10Blacklisted1¤ (11Reason1:12 $iif($2,$2-,Unspecified) 1 $kickc
      }
    }
  }
  else {
    write BlackList.txt $iif($1 ison $active,$address($1,2),$1)
    write BlackListReason.txt Null
    echo -ta [Blacklist] Successfully written $1 to blacklist. No reason specified.
    if ($1 ison $active) {
      if (($me !isop $active) && ($me !ishop $active)) || (($me ishop $chan(%x)) && ($nick($chan(%x),%y) isop $chan(%x))) echo -st I cannot kick $1 from $active $+ !
      else {
        mode $active -Qohv+b $1 $1 $1 $address($1,2) | kick $active $1 2 1¤10Blacklisted1¤ (11Reason1:12 $iif($2,$2-,Unspecified) $kickc
      }
    }
  }
}
alias blclear {
  echo -ta [Blacklist] Cleared Blacklist.
  remove Blacklist.txt
  remove BlacklistReason.Txt
}
alias bldel {
  if (!$1) { echo -ta [Blacklist] Error: Invalid syntax. Use: /bldel <Address/Nick>. | halt }
  if ($read(Blacklist.txt,w,$address($1,2))) || ($read(Blacklist.txt,w,$1)) || ($read(Blacklist.txt,w,$($+(%Address.,$1),2))) {
    echo -ta [Blacklist] $1 was found on the blacklist on line $readn $+ . Match: $read(BlackList.txt,$readn) $+ .
    echo -ta [Blacklist] Blacklist reason: $iif($read(BlackListReason.txt,$readn) == Null,Unspecified,$read(BlackListReason.txt,$readn))
    echo -ta [Blacklist] To delete: /yes. To stop: /no.
    set %B $readn
  }
  else echo -ta [Blacklist] Sorry: $1 was not found on the blacklist.
}
alias yes {
  if (%B) {
    set -u600 %r $read(BlackList.txt,%B)
    set -u600 %rr $read(BlackListReason.txt,%B)
    echo -ta [Blacklist] Deleting: $read(BlackList.txt,%B) With reason: $iif($read(BlackListReason.txt,%B) == Null,Unspecified,$read(BlackListReason.txt,%B)) from the blacklist.
    write -dl [ $+ [ %B ] ] BlackList.txt
    write -dl [ $+ [ %B ] ] BlackListReason.txt
    unset %B
    GlobalUnban $iif($chr(64) !isin $read(BlackList.txt,%B),$address($v2,2),$v2)
  }
  else echo -ta [Blacklist] Error: No blacklist set to delete. Try /bldel <Address/Nick>.
}
alias no {
  if (%B) {
    echo -ta [Blacklist] Cancelled: $read(BlackList.txt,%B) Will not be deleted from the blacklist.
    unset %B
  }
  else echo -ta [Blacklist] Error: No blacklist set to delete. Try /bldel <Address/Nick>.
}
alias rebl {
  if (%r) {
    write BlackList.txt %r
    write BlackListReason.txt %rr
    echo -ta [Blacklist] Successfully re-written %rbl to blacklist. Reason: $iif(%rblr == Null,Unspecified,%rblr) $+ .
    unset %r %rr
  }
  else echo -ta [Blacklist] Error: No user was recently un-blacklisted.
}
alias bllist {
  if ($lines(BlackList.txt) >= 30) $iif($?!="30+ Blacklists found. Continue? $crlf $+ Doing so will echo $lines(BlackList.txt) lines into $active $+ .",,halt)
  echo -ta [Blacklist] Blacklisted user list $+([,,$lines(BlackList.txt),/,$lines(BlackListReason.txt),]:) (Latest first)
  if ($lines(BlackList.txt) == 0) echo -ta [Blacklist] None.
  else {
    var %la = $lines(BlackList.txt)
    var %lc = $lines(BlackList.txt)
    while (%lc >= 1) {
      echo -ta $+([,$calc((%la - %lc) + 1),]) User: $read(BlackList.txt,%lc) Reason: $iif($read(BlackListReason.txt,%lc) == Null,Unspecified,$read(BlackListReason.txt,%lc))
      dec %lc
    }
  }
}
alias BlCheck {
  var %x = 1, %z = 0, %w = 0
  while (%x <= $chan(0)) {
    var %y = 1
    while (%y <= $nick($chan(%x),0)) {
      if ($read(Blacklist.txt,w,$nick($chan(%x),%y))) || ($read(Blacklist.txt,w,$address($nick($chan(%x),%y),2))) {
        var %q = $readn
        inc %z
        echo -s /!\ Blacklist match: Channel: $chan(%x) Nick: $nick($chan(%x),%y) Match: $ifmatch
        if ($me !isop $chan(%x)) && ($me !ishop $chan(%x)) || (*Q* iswmcs $chan($chan(%x)).mode) || (($me ishop $chan(%x)) && ($nick($chan(%x),%y) isop $chan(%x))) echo -s I cannot kick $nick($chan(%x),%y) from $chan(%x) $+ !
        else ban -ku300 $chan(%x) $nick($chan(%x),%y) 2 1¤10Blacklisted1¤ (11Reason1:12 $iif($read(BlackListReason.txt,%q) == Null,Unspecified,$read(BlackListReason.txt,%q)) $kickc
      }
      inc %w
      inc %y
    }
    inc %x
  }
  echo -s Finished checking %w users on $chan(0) $+ $iif($chan(0) == 1,channel,channels) $+ , blacklists found: %z
}
alias GlobalUnban {
  if (!$1) halt
  var %x = 1, %z = 0
  while (%x <= $chan(0)) {
    if ($me isop $chan(%x)) || ($me ishop $chan(%x)) mode $chan(%x) -b $1
    inc %x
  }
  echo -s Globally unbanned $1
}
alias info {
  echo -ta [Blacklist] Blacklists found: $+([,,$lines(BlackList.txt),/,$lines(BlackListReason.txt),].)
  echo -ta [Blacklist] Commands: /Bl <Address/Nick>, /Bldel <Address/Nick>, /Yes, /No, /Rebl, /Bllist.
}
alias kickc { inc %kickcounter | return » $bytes(%kickcounter,db) « }

Comments

Sign in to comment.
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.