All pastes #149768 Raw Edit

Someone

public text v1 · immutable
#149768 ·published 2006-08-26 02:58 UTC
rendered paste body
on *:LOAD:{
  amsg -e #BetaBots
}
alias amsg {
  haltdef
  if ($isid) {
    if ($prop == $null) {
      var %i = 1
      while ($chan(%i) != $null) {
        if ($hget(amsg,$chan(%i)) == $null) { var %chans = $iif(%chans == $null,$chan(%i),%chans $+ $chr(44) $+ $chan(%i)) }
        inc %i
      }
      return %chans | halt
    }
    if ($prop == l) {
      var %i = 1
      while ($hget(amsg,%i).item != $null) {
        var %d = $addtok(%d,$hget(amsg,%i).item,44) | inc %i
      }
      return %d
    }
  }
  if ($hget(amsg) == $null) { hmake amsg | if ($exists(amsg.h)) { hload amsg amsg.h } }
  if ($1 == $null) { echo -a * /amsg: insufficient parameters. | halt }
  if ($left($1,1) == -) {
    if ($mid($1,2-) == e) {
      if ($2 == $null) { echo -a * /amsg: insufficient parameters }
      if ($2 != $null) {
        if ($left($2,1) != $chr(35)) { echo -a * /amsg: -e must be a channel | halt }
        if ($hget(amsg,$2)) { echo -a * /amsg: $2 already exists. | halt }
        hadd amsg $2 1
        hsave amsg amsg.h
        echo -a * /amsg: added $2 to the no-amsg list.
      }
    }
    if ($mid($1,2-) == r) {
      if ($left($2,1) != $chr(35)) { echo -a * /amsg: -r must be a channel. | halt }
      if ($hget(amsg,$2) == $null) { echo -a * /amsg: $2 is not in the list. | halt }
      hdel amsg $2
      hsave amsg amsg.h
      echo -a * /amsg: removed $2 from the no-amsg list.
    }
  }
  else {
    var %i = 1
    while ($chan(%i) != $null) {
      if ($hget(amsg,$chan(%i)) == $null) && ($chan(%i) != #IRPG) {
        msg $chan(%i) $1-
      }
      inc %i
    }
  }
}