All pastes #370855 Raw Edit

Miscellany

public text v1 · immutable
#370855 ·published 2007-02-24 22:54 UTC
rendered paste body
on *:TEXT:*:#:{
  if ($hget(binds) == $null) {
    hmake binds
    if ($exists(binds.db) == $true) {
      hload binds binds.db
    }
  }
  if (!%trigger) { var %trigger = @ }
  if ($mid($1-,1,$len(%trigger)) == %trigger) {
    tokenize 32 $mid($1-,$calc($len(%trigger) + 1) $+ -)
  }
  else { halt }
  if ($hget(binds,$1) != $null) {
    .msg $chan $v1
  }
  if ($ulevel >= 5) {
    if ($1 == bind) {
      if ($3 == $null) { notice $nick Specify [command] [text] }
      else {
        hadd binds $2-
        .notice $nick bound $2 to $3-
        hsave binds binds.db
      }
    }
  }
  if ($ulevel >= 5) {
    if ($1 == unbind) {
      if ($2 == $null) { notice $nick Specify [command] }
      else {
        if ($hget(binds,$2) == $null) { Notice $nick Command doesnt exists.. }
        else {
          hdel binds $2
          .notice $nick Successfully unbinded $2
          hsave binds binds.db
        }
      }
    }
  }
}