All pastes #486713 Raw Edit

Mine

public text v1 · immutable
·published 2007-05-14 01:09 UTC
rendered paste body
on @*:TEXT:*:#luckypc:{
  if ($nick isop $chan || $nick ishop $chan) {
    if ($1 = !bl) && ($2 = global) {
      if ($3 = $null || $4 = $null) { msg $chan Please type !help for the SYNTAX of the !blacklist commands. | halt }
      if (@ !isin $3) { userhost $3 }
      if (@ isin $3) { set %blacklist $3 }
      .timer 1 2 globalban $chan $3-
      halt
    }
    if ($1 = !help) {
      notice $nick 4,15!checklist14,15 - lists the blacklist for the channel. 3|4@3|
      notice $nick 4,15!bl <nickname|IP> <kick message> 14,15- places the nickname or IP specified on blacklist. PLEASE NOTE: if the user is not online, it will not be added. 3|7%4@3| 
      notice $nick 4,15!dbl <nickname|IP> 14,15- removes the nickname or IP specified. PLEASE NOTE: if the nickname is not online, it will not be removed. 3|7%4@3|
      if ($nick isop $chan) { notice $nick 4,15!blacklist global <nickname|IP> <kick message> 14,15- places the nickname on a global ban, for ALL the rooms the bot sits in, opped.3|7%4@3| } 
    }
    if ($1 = !checklist) {
      if ($read($replace($chan,^,$chr(124)) $+ blacklist.txt) != $null) { play $chan $replace($chan,^,$chr(124)) $+
      blacklist.txt }
      else { msg $chan There are no blacklist bans in $chan }
    }
    if ($1 = !dbl) && ($4 = $null) {
      if (@ !isin $3) { userhost $3 }
      if (@ isin $3) { set %blacklist $3 }
      .timer 1 2 removelist $chan $3
      halt
    }
    if ($1 = !bl) && ($3 = $null) { msg $chan Please supply a kick message | halt }
    if ($1 = !bl) && ($3 != $null) && ($3 != $me) {
      if (@ !isin $2) { userhost $2 }
      if (@ isin $2) { set %blacklist $2 }
      .timer 1 2 blacklist $chan $2-
    }
  }
}
alias bl.checkban {
  set %bl.kick $nick($1,0)
  while (%bl.kick) {
    if ($gettok(%blacklist,1,32) iswm $address($nick($1,%bl.kick),5)) {
      kick $1 $nick($1,%bl.kick) $3-
      mode $1 +b $gettok(%blacklist,1,32)
    }
    dec %bl.kick
    if (%bl.kick = 0) { unset %bl.kick }
  }
}
alias globalban {
  if (%blacklist = *!*@) { msg $1 $2 is not currently online. Please make sure they are online, before performing this action again. | halt }
  else {
    set %bl.chan 1
    while (%bl.chan <= $chan(0)) {
      if ($me isop $chan(%bl.chan)) {
        if ($read($remove($chan(%bl.chan),^,$chr(124)) $+ blacklist.txt,s,%blacklist) = $null) { write
        $remove($chan(%bl.chan),^,$chr(124)) $+ blacklist.txt %blacklist $2- }
        if ($read($remove($chan(%ibl.chan),^,$chr(124)) $+ blacklist.txt,s,%blacklist) != $null) {
          write -ds $+ %blacklist $remove($chan(%bl.chan),^,$chr(124)) $+ blacklist.txt
          write $remove($chan(%bl.chan),^,$chr(124)) $+ blacklist.txt %blacklist $2-
      } }
      inc %bl.chan
    }
    msg $1 $2 added to blacklist: $gettok(%blacklist,1,32) with kick message: $3-
    set %bl.chan 1
    while (%bl.chan <= $chan(0)) {
      bl.checkban $1-
      inc %bl.chan
} } }
alias removelist {
  if (%blacklist = *!*@) { msg $1 $2 is not currently online. Please make sure they are online, before performing thisaction again. | halt }
  else {
    if ($read($remove($1,^,$chr(124)) $+ blacklist.txt,s,%blacklist) = $null) { msg $1 $2 is not currently on my blacklist. | halt }
    if ($read($remove($1,^,$chr(124)) $+ blacklist.txt,s,%blacklist) != $null) {
      msg $1 $2 removed from blacklist.
      mode $1 -b %blacklist
      write -ds $+ %blacklist $remove($1,^,$chr(124)) $+ blacklist.txt
    }
  }
}
alias blacklist {
  if (%blacklist = *!*@) {
    msg $1 $2 is not currently online. Please make sure they are online, before performing this action again.
  }
  else {
    if ($read($remove($1,^,$chr(124)) $+ blacklist.txt,s,%blacklist) != $null) { 
      write -ds $+ %blacklist $remove($1,^,$chr(124)) $+ blacklist.txt
      write $remove($1,^,$chr(124)) $+ blacklist.txt %blacklist $2-
      msg $1 $2 appended to blacklist: $gettok(%blacklist,1,32) with kick message: $3-
    }
    if ($read($remove($1,^,$chr(124)) $+ blacklist.txt,s,%blacklist) = $null) {
      write $remove($1,^,$chr(124)) $+ blacklist.txt %blacklist $2-
      msg $1 $2 added to blacklist: $gettok(%blacklist,1,32) with kick message: $3-
      bl.checkban $1-
    }
  }
}
on @*:JOIN:#:{
  set %blist.check $nick(#,0)
  while (%blist.check) {
    if ($gettok($read($remove($chan,^,$chr(124)) $+ blacklist.txt,%blist.check),1,32) iswm $address($nick,5)) {
      kick # $nick $gettok($read($remove($chan,^,$chr(124)) $+ blacklist.txt,%blist.check),3-,32)
      mode # +b $gettok($read($remove($chan,^,$chr(124)) $+ blacklist.txt,%blist.check),1,32)
      halt
    }
    dec %blist.check
    if (%blist.check = 0) { unset %blist.check }
  }
}