All pastes #414395 Raw Edit

Mine

public text v1 · immutable
#414395 ·published 2007-03-29 00:38 UTC
rendered paste body
on *:text:*:#:{
  if ($hget(binds) == $null) { hmake binds }
  if ($exists(binds.db) == $true) { hload binds binds.db }
  if ($mid($1-,1,$len(%trig)) == %trig) {
    tokenize 32 $mid($1-,$calc($len(%trig) + 1) $+ -)
  }
  else { halt }
  if ($hget(binds,$1) != $null) {
    if (%skin != *) {
      msg $chan $replace(%skin,<cmd>,$1,<info>,$hget(binds,$1))
    }
    elseif (%skin == *) {
      msg $chan $hget(binds,$1)
    }
  }
  if ($ulevel >= 4) {
    if ($1 == bind) {
      if ($3 == $null) { notice $nick Please use the correct syntax.  %trig $+ bind <command> <text> }
      else {
        hadd binds $2 $3-
        notice $nick Command $2 successfully bound to: $3-
        hsave binds binds.db
      }
    }
  }
  if ($ulevel >= 4) {
    if ($1 == unbind) {
      if ($2 == $null) { notice $nick Please use the correct syntax.  %trig $+ unbind <command>
      }
      else {
        if ($hget(binds,$2) == $null) { notice $nick Command doesnt exist. }
        else {
          hdel binds $2
          notice $nick Successfully unbound command: $2
          hsave binds binds.db
        }
      }
    }
  }
}