All pastes #720249 Raw Edit

Something

public text v1 · immutable
#720249 ·published 2007-09-30 03:34 UTC
rendered paste body
3B /Mass mode alias
; Available modes:
; /mass +o   /mass +h   /mass +v
; /mass -o   /mass -h   /mass -v

alias mass {
  if (!$chan) echo 4 -ta * Error: Alias can only be used in channels.
  elseif +o = $1 {
    if $me !isop $chan echo 4 -ta * Error: You must be an operator to perform this command.
    else {
      var %x 1, %y
      while %x <= $nick($chan,%x,a) {
        set %y %y $nick($chan,%x,a)
        if $numtok(%y,32) == $modespl mode $chan $+(+,$str(o,$modespl)) %y
        inc %x
      }
      if (%y) mode $chan $+(+,$str(o,$modespl)) %y
    }
  }
  elseif -o = $1 {
    if $me !isop $chan echo 4 -ta * Error: You must be an operator to perform this command.
    else {
      var %x 1, %y
      while %x <= $nick($chan,%x,o) {
        set %y %y $remove($nick($chan,%x,o),$me)
        if $numtok(%y,32) == $modespl mode $chan $+(-,$str(o,$modespl)) %y
        inc %x
      }
      if (%y) mode $chan $+(-,$str(o,$modespl)) %y
    }
  }
  elseif +h = $1 {
    if $me !isop $chan echo 4 -ta * Error: You must be an operator to perform this command.
    else {
      var %x 1, %y
      while %x <= $nick($chan,0,r) {
        set %y %y $nick($chan,%x,r)
        if $numtok(%y,32) == $modespl mode $chan $+(+,$str(h,$modespl)) %y
        inc %x
      }
      if (%y) mode $chan $+(+,$str(h,$modespl)) %y
    }
  }
  elseif -h = $1 {
    if $me !isop $chan echo 4 -ta * Error: You must be an operator to perform this command.
    else {
      var %x 1, %y
      while %x <= $nick($chan,0,h) {
        set %y %y $nick($chan,%x,h)
        if $numtok(%y,32) == $modespl mode $chan $+(-,$str(h,$modespl)) %y
        inc %x
      }
      if (%y) mode $chan $+(-,$str(h,$modespl))
    }
  }
  elseif +v = $1 {
    if $me !ishop $chan && $me !isop $chan echo 4 -ta * Error: You must be (half-) operator to perform this command.
    else {
      var %x 1, %y
      while %x <= $nick($chan,0,r) {
        set %y %y $nick($chan,%x,r)
        if $numtok(%y,32) == $modespl mode $chan $+(+,$str(v,$modespl)) %y
        inc %x
      }
      if (%y) mode $chan $+(+,$str(v,$modespl)) %y
    }
  }
  elseif -v = $1 {
    if $me !ishop $chan && $me !isop $chan echo 4 -ta * Error: You must be (half-) operator to perform this command.
    else {
      var %x 1, %y
      while %x <= $nick($chan,0,v) {
        set %y %y $nick($chan,%x,v)
        if $numtok(%y,32) == $modespl mode $chan $+(-,$str(v,$modespl)) %y
        inc %x
      }
      if (%y) mode $chan $+(-,$str(v,$modespl)) %y
    }
  }
  else echo 4 -ta * Erroneous command.
}