All pastes #736150 Raw Edit

Someone

public text v1 · immutable
·published 2007-10-14 08:13 UTC
rendered paste body
;;;;;;;;;;;;;;
;; Commands ;;
;;;;;;;;;;;;;;

on *:JOIN:#: {
  if ($greeting1) {
    notice $nick $v1
  }
  if ($greeting2) {
    notice $nick $v1
  }
  if ($greeting3) {
    notice $nick $v1
  }
}

on *:TEXT:*:#: {
  if ($mid($1-,1,$len($trig)) == $trig) {
    var %access = $readini(bot/users.ini,$address($2,2),access)
    var %info = $readini(bot/users.ini,$address($2,2),info)
    tokenize 32 $mid($1-,$calc($len($trig) + 1) $+ -)
    ;; Start User Commands ;;
    ;; Start Adduser/Deluser/Cuser Commands ;;
    if ($1 == adduser) {
      if ($access >= 5) {
        if (!$2-3) {
          notice $nick Invalid syntax.  Please use: $+($trig,adduser) [nick] [access] <info>.
        }
        elseif ($ini(bot/users.ini,$address($2,2))) {
          notice $nick $2 is already on the userlist.
        }
        else {
          if ($4) {
            writeini bot/users.ini $address($2,2) info $4-
            writeini bot/users.ini $address($2,2) access $3
            notice $nick $2 added to the userlist.
          }
          else {
            writeini bot/users.ini $address($2,2) access $3
            notice $nick $2 added to the userlist.
          }
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == deluser) {
      if ($access >= 5) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use: $+($trig,deluser) [nick].
        }
        elseif (!$ini(bot/users.ini,$address($2,2))) {
          notice $nick $2 isn't on the userlist.
        }
        else {
          remini bot/users.ini $address($2,2)
          notice $nick $2 removed from the userlist.
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == cuser) {
      if ($access >= 5) {
        if (!$2-3) {
          notice $nick Invalid syntax.  Please use: $+($trig,clvl) [nick] [access] <info>.
        }
        elseif (!$ini(bot/users.ini,$address($2,2))) {
          notice $nick $2 isn't on the user list.
        }
        else {
          if ($4) {
            writeini bot/users.ini $address($2,2) info $4-
            writeini bot/users.ini $address($2,2) access $3
            notice $nick $2 $+ 's access changed.
          }
          else {
            remini bot/users.ini $address($2,2) info
            writeini bot/users.ini $address($2,2) access $3
            notice $nick $2 $+ 's access changed.
          }
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    ;; End Adduser/Deluser/Cuser Commands ;;
    ;; Start Bind/Unbind Commands ;;
    if ($1 == bind) {
      if ($access >= 4) {
        if (!$2-3) {
          notice $nick Invalid syntax.  Please use: $+($trig,bind) [command] [info].
        }
        elseif ($readini(bot/binds.ini,binds,$2)) {
          notice $nick Command $+(',$2,') is already binded.
        }
        else {
          writeini bot/binds.ini binds $2 $encode($3-,m)
          notice $nick Command $+(',$2,') successfully binded as: $3-
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == unbind) {
      if ($access >= 4) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use: $+($trig,unbind) [command].
        }
        elseif (!$readini(bot/binds.ini,binds,$2)) {
          notice $nick Command $+(',$2,') doesn't exist.
        }
        else {
          remini bot/binds.ini binds $2
          notice $nick Command $+(',$2,') successfully unbinded.
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    ;; End Bind/Unbind Commands ;;
    ;; Start Set Commands ;;
    if ($1 == set) {
      if ($access >= 4) {
        if (!$2-3) {
          notice $nick Invalid syntax.  Please use: $+($trig,set) [skin/trigger/greeting1/greeting2/greeting3/nick/bindmsg/(Binded Command)] [information]
        }
        elseif ($2 == skin) {
          writeini bot/settings.ini settings skin $encode($3-,m)
          notice $nick Skin set to: $3-
        }
        elseif ($2 == trigger) {
          writeini bot/settings.ini settings trigger $3
          notice $nick Skin set to: $3
        }
        elseif ($2 == greeting1) {
          writeini bot/settings.ini greetings greeting1 $encode($3-,m)
          notice $nick Greeting1 set to: $3-
        }
        elseif ($2 == greeting2) {
          writeini bot/settings.ini greetings greeting2 $encode($3-,m)
          notice $nick Greeting2 set to: $3-
        }
        elseif ($2 == greeting3) {
          writeini bot/settings.ini greetings greeting3 $encode($3-,m)
          notice $nick Greeting3 set to: $3-
        }
        elseif ($2 == nick) {
          nick $3
          notice $nick Successfully changed nick to: $3
        }
        elseif ($2 == bindmsg) {
          writeini bot/settings.ini settings bindmsg $3
          notice $nick Bindmsg set to: $3
        }
        elseif ($readini(bot/binds.ini,binds,$2)) {
          writeini bot/binds.ini binds $2 $encode($3-,m)
          notice $nick Command $+(',$2,') successfully changed to: $3-
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    ;; End Set Commands ;;
    ;; Start Join/Part Commands ;;
    if ($1 == join) {
      if ($access >= 4) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use: $+($trig,join) [channel].
        }
        elseif ($me ison $2) {
          notice $nick I'm already in $+($2,.)
        }
        else {
          join $2
          notice $nick Successfully joined $+($2,.)
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == part) {
      if ($access >= 4) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use: $+($trig,part) [channel].
        }
        elseif ($me !ison $2) {
          notice $nick I'm not in $+($2,.)
        }
        else {
          part $2
          notice $nick Successfully parted $+($2,.)
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == hop) {
      if ($access >= 4) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use: $+($trig,hop) [channel].
        }
        elseif ($me !ison $2) {
          notice $nick I'm not in $+($2,.)
        }
        else {
          hop $2
          notice $nick Successfully hopped $+($2,.)
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    ;; End Join/Part Commands ;;
    ;; End User Commands ;;
    ;; Start Public Commands ;;
    ;; Start Access Command ;;
    if ($1 == a || $1 == access) {
      if ($2) {
        notice $nick $2 currently has level $iif(%access,$v1,0) $iif(%info,$+($chr(40),$v1,$chr(41))) access to $+($me,.)
      }
      else {
        notice $nick $nick $+ , you currently have level $iif($access,$v1,0) $iif($info,$+($chr(40),$v1,$chr(41))) access to $+($me,.)
      }
    }
    ;; End Access Command ;;
    ;; Start Binded Command Output ;;
    if ($readini(bot/binds.ini,binds,$1)) {
      var %bindinfo = $readini(bot/binds.ini,binds,$1)
      if ($bindmsg == notice) {
        if ($1 == eval && $+($chr(36),ip) isin $2-) {
          notice $nick Hell no.
        }
        else {
          notice $nick [ [ $replace($skin,$+(%,command,%),$1,$+(%,info,%),$decode(%bindinfo,m)) ] ]
        }
      }
      elseif ($bindmsg == public) {
        if ($1 == eval && $+($chr(36),ip) isin $2-) {
          notice $nick Hell no.
        }
        else {
          msg $chan [ [ $replace($skin,$+(%,command,%),$1,$+(%,info,%),$decode(%bindinfo,m)) ] ]
        }
      }
    }
    ;; End Binded Command Output ;;
    ;; Start Binded Commands List ;;
    if ($1 == binds || $1 == commands) {
      var %num = 2
      while (%num <= $lines(bot/binds.ini)) {
        set %blist %blist $trig $+ $gettok($read(bot/binds.ini,%num),1,61)
        inc %num
      }
      notice $nick $iif(%blist,$replace($skin,$+(%,command,%),$1,$+(%,info,%),$v1),$replace($skin,$+(%,command,%),$1,$+(%,info,%),No binded commands.))
      unset %blist
    }
    ;; Start Binded Commands List ;;
    ;; End Public Commands ;;
  }
}



;;;;;;;;;;;;;
;; Aliases ;;
;;;;;;;;;;;;;

alias access { return $readini(bot/users.ini,$wildsite,access) }
alias bindmsg { return $readini(bot/settings.ini,settings,bindmsg) }
alias greeting1 { return $decode($readini(bot/settings.ini,settings,greeting1),m) }
alias greeting2 { return $decode($readini(bot/settings.ini,settings,greeting2),m) }
alias greeting3 { return $decode($readini(bot/settings.ini,settings,greeting3),m) }
alias info { return $readini(bot/users.ini,$wildsite,info) }
alias noaccess { return Error.  You do not have enough access to use that command. }
alias skin { return $decode($readini(bot/settings.ini,settings,skin),m) }
alias trig { return $readini(bot/settings.ini,settings,trigger) }