All pastes #760243 Raw Edit

Someone

public text v1 · immutable
·published 2007-11-03 21:13 UTC
rendered paste body
;;;;;;;;;;;;;;;;;;;;;;
;;  Peons: 100      ;;
;;  Operators: 200  ;;
;;  Masters: 300    ;;
;;  Co-Owners: 400  ;;
;;  Owners: 500     ;;
;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;
;; Events/Commands ;;
;;;;;;;;;;;;;;;;;;;;;


on *:CONNECT: {
  hload binds binds.db
}

on *:JOIN:#Topcz: {
  if (%greeting1) {
    notice $nick $v1
  }
  if (%greeting2) {
    notice $nick $v1
  }
  if ($access > 200) {
    mode $chan +o $nick
  }
  elseif ($access == 100) {
    mode $chan +v $nick
  }
}

on *:TEXT:*:?,#Topcz: {
  if ($mid($1-,1,$len($trigger)) == $trigger) {
    tokenize 32 $mid($1-,$calc($len($trigger) + 1) $+ -)
    ;; Adding Users To The Userlist ;;
    if ($1 == addowner) {
      if ($access >= 500) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,addowner) $+($2,.)
        }
        elseif ($readini(users.ini,users,$address($2,2))) {
          notice $nick Error.  $2 is already on the userlist.
        }
        else {
          writeini users.ini users $address($2,2) 500 Owner
          notice $nick Success.  $2 has been added to the userlist with 500 (Owner) access.
          msg %achannel 0,1Admin:8,1 $nick $+ 15,1( $+ $address($nick,2) $+ 15,1) Added 15,1(8,1 $+ $2 $+ 15,1) to the Userlist with 15,1(8,150015,1) Access.          
          mode $chan +o $2
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == addco) {
      if ($access >= 500) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,addco) $+($2,.)
        }
        elseif ($readini(users.ini,users,$address($2,2))) {
          notice $nick Error.  $2 is already on the userlist.
        }
        else {
          writeini users.ini users $address($2,2) 400 Co-Owner
          notice $nick Success.  $2 has been added to the userlist with 400 (Co-Owner) access.
          msg %achannel 0,1Admin:8,1 $nick $+ 15,1( $+ $address($nick,2) $+ 15,1) Added 15,1(8,1 $+ $2 $+ 15,1) to the Userlist with 15,1(8,140015,1) Access.       
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == addmaster) {
      if ($access >= 400) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,addmaster) $+($2,.)
        }
        elseif ($readini(users.ini,users,$address($2,2))) {
          notice $nick Error.  $2 is already on the userlist.
        }
        else {
          writeini users.ini users $address($2,2) 300 Master
          notice $nick Success.  $2 has been added to the userlist with 300 (Master) access.
          msg %achannel 0,1Admin:8,1 $nick $+ 15,1( $+ $address($nick,2) $+ 15,1) Added 15,1(8,1 $+ $2 $+ 15,1) to the Userlist with 15,1(8,130015,1) Access.      
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == addop) {
      if ($access >= 300) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,addop) $+($2,.)
        }
        elseif ($readini(users.ini,users,$address($2,2))) {
          notice $nick Error.  $2 is already on the userlist.
        }
        else {
          writeini users.ini users $address($2,2) 200 Operator
          notice $nick Success.  $2 has been added to the userlist with 200 (Operator) access.
          msg %achannel 0,1Admin:8,1 $nick $+ 15,1( $+ $address($nick,2) $+ 15,1) Added 15,1(8,1 $+ $2 $+ 15,1) to the Userlist with 15,1(8,120015,1) Access.
          mode $chan +o $2
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == addpeon) {
      if ($access >= 300) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,addpeon) $+($2,.)
        }
        elseif ($readini(users.ini,users,$address($2,2))) {
          notice $nick Error.  $2 is already on the userlist.
        }
        else {
          writeini users.ini users $address($2,2) 100 Peon
          notice $nick Success.  $2 has been added to the userlist with 100 (Peon) access.
          msg %achannel 0,1Admin:8,1 $nick $+ 15,1( $+ $address($nick,2) $+ 15,1) Added 15,1(8,1 $+ $2 $+ 15,1) to the Userlist with 15,1(8,110015,1) Access.
          mode $chan +v $2
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    ;; Deleting Users From The Userlist ;;
    if ($1 == delowner) {
      if ($access >= 500) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,delowner) $+($2,.)
        }
        elseif (!$readini(users.ini,users,$address($2,2))) {
          notice $nick Error.  $2 is not on the userlist.
        }
        else {
          remini users.ini users $address($2,2)
          notice $nick Success.  $2 has been removed from the userlist.
          mode $chan -o $2
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == delco) {
      if ($access >= 500) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,delco) $+($2,.)
        }
        elseif (!$readini(users.ini,users,$address($2,2))) {
          notice $nick Error.  $2 is not on the userlist.
        }
        else {
          remini users.ini users $address($2,2)
          notice $nick Success.  $2 has been removed from the userlist.
          mode $chan -o $2
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == delmaster) {
      if ($access >= 400) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,delmaster) $+($2,.)
        }
        elseif (!$readini(users.ini,users,$address($2,2))) {
          notice $nick Error.  $2 is not on the userlist.
        }
        else {
          remini users.ini users $address($2,2)
          notice $nick Success.  $2 has been removed from the userlist.
          mode $chan -o $2
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == delop) {
      if ($access >= 300) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,delop) $+($2,.)
        }
        elseif (!$readini(users.ini,users,$address($2,2))) {
          notice $nick Error.  $2 is not on the userlist.
        }
        else {
          remini users.ini users $address($2,2)
          notice $nick Success.  $2 has been removed from the userlist.
          mode $chan -o $2
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == delpeon) {
      if ($access >= 300) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,delpeon) $+($2,.)
        }
        elseif (!$readini(users.ini,users,$address($2,2))) {
          notice $nick Error.  $2 is not on the userlist.
        }
        else {
          remini users.ini users $address($2,2)
          notice $nick Success.  $2 has been removed from the userlist.
          mode $chan -v $2
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    ;; Getting The Users Access ;;
    if ($1 == access || $1 == a) {
      var %access = $gettok($readini(users.ini,users,$address($2,2)),1,32)
      var %info = $gettok($readini(users.ini,users,$address($2,2)),2,32)
      if (!$2) {
        notice $nick You have $iif($access,$v1,0) $iif($info,$+($chr(40),$info,$chr(41))) access.
      }
      else {
        notice $nick $2 has $iif(%access,$v1,0) $iif(%info,$+($chr(40),%info,$chr(41))) access.
      }
    }
    ;; Having The Bot Join A Channel ;;
    if ($1 == join) {
      if ($access >= 300) {
        if (!$2) {
          notice $nick Please specify a channel you would like me to join.
        }
        elseif ($me ison $2) {
          notice $nick I'm already in $+($2,.)
        }
        else {
          notice $nick Now joining $+($2,.)
          join $2
        }
      }
    }
    ;; Having The Bot Part A Channel ;;
    if ($1 == part) {
      if ($access >= 300) {
        if (!$2) {
          notice $nick Please specify a channel you would like me to leave.
        }
        elseif ($me !ison $2) {
          notice $nick I'm not even in $+($2,.)
        }
        else {
          notice $nick I am now leaving $+($2,.)
          part $2
        }
      }
    }
    ;; Making The Bot Say Something In The Current Or Specified Channel ;;
    if ($1 == say) {
      if ($access >= 3) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,say) [message].
        }
        elseif ($left($2,1) == $chr(35) || $me ison $2) {
          msg $2 $3-
          notice $nick Sent 14[ $+ $3- $+ ]1 to $+($2,.)
        }
        else {
          msg $chan $2-
        }
      }
    }
    ;; Making The Bot Say Something Globally ;;
    if ($1 == gmsg) {
      if ($access >= 3) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,gmsg) [message].  
        }
        else {
          amsg 9,1Global Message0 from4 $nick $+ 0: $2-
        }
      }
    }
    ;; Making The Bot Notice In The Current Or Specified Channel ;;
    if ($1 == notice) {
      if ($access >= 300) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,say) [message].
        }
        elseif ($left($2,1) == $chr(35) || $me ison $2) {
          notice $2 $3-
          notice $nick Sent 14[ $+ $3- $+ ]1 to $2 as a notice.
        }
        else {
          notice $2-
        }
      }
    }
    ;; Change The Bot's Nickname ;;
    if ($1 == nick) {
      if ($access >= 300) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,nick) [New Nickname].
        }
        else {
          nick $2
          notice $nick I have successfully changed my nick to $+($2,.)
        }
      }
    }
    ;; Showing Commands For Users ;;
    if ($1 == commands) {
      set %btvar 1
      while ($read(binds.db,%btvar)) {
        set %btovar %btovar $trigger $+ $v1
        inc %btvar 2      
      }      
      notice $nick $replace($skin,$+(%,command,%),commands,$+(%,info,%),%btovar)
      unset %btvar 
      unset %btovar     
    }
    ;; Binding And Unbinding ;;
    if ($1 == bind) {
      if ($access >= 400) {
        if (!$2-3) {
          notice $nick Invalid syntax.  Please use $+($trigger,bind) [command] [info].
        }
        elseif ($hget(binds,$2)) {
          notice $nick Command $+(',$2,') already exists.  Please use $+($trigger,set) $2 [info], to change it.
        }
        else {
          hadd -m binds $2 $3-
          hsave binds binds.db
          notice $nick Command $+(',$2,') successfully binded as: $3-
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    if ($1 == unbind) {
      if ($access >= 400) {
        if (!$2-3) {
          notice $nick Invalid syntax.  Please use $+($trigger,unbind) [command].
        }
        elseif ($hget(binds,$2)) {
          hdel binds $2
          hsave binds binds.db
          notice $nick Command $+(',$2,') successfully unbinded.
        }
        else {
          notice $nick Command $+(',$2,') doesn't exist.
        }
      }
      else {
        notice $nick $noaccess
      }
    }
    ;; Using A Binded Command ;;
    if ($hget(binds,$1)) {
      notice $nick $replace($skin,$+(%,command,%),$1,$+(%,info,%),$v1)
    }
    ;; Using The Set Commands To Change Binds/Greetings ;;
    if ($1 == set) {
      if ($access >= 400) {
        if (!$2) {
          notice $nick Invalid syntax.  Please use $+($trigger,set) [binded command] [new info], $+($trigger,set) greeting1 [info], $+($trigger,set) greeting2 [info], or $+($trigger,set) topic [text].
        }
        elseif ($hget(binds,$2)) {
          hadd -m binds $2 $3-
          hsave binds binds.db
          notice $nick Command $+(',$2,') successfully changed to: $3-
        }
        elseif ($2 == greeting1) {
          if ($3 == off) {
            unset %greeting1
            notice $nick Greeting1 turned off.
          }
          else {
            set %greeting1 $3-
            notice $nick Greeting1 set to: $3-
          }
        }
        elseif ($2 == greeting2) {
          if ($3 == off) {
            unset %greeting2
            notice $nick Greeting2 turned off.
          }
          else {
            set %greeting2 $3-
            notice $nick Greeting2 set to: $3-
          }
        }
        elseif ($2 == topic) {
          cs $chan topic $3-
        }
        elseif ($2 == skin) {
          hadd -m settings skin $3-
          hsave settings settings.db
          notice $nick Skin successfully set as: $3-
        }
      }
      else {
        notice $nick $noaccess
      }
    }
  }
}


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


alias access { return $gettok($readini(users.ini,users,$wildsite),1,32) }
alias addowner {
  writeini users.ini users $address($1,2) 500 Owner
  echo -a User $1 added to the userlist with 500 (Owner) access.
}
alias addco {
  writeini users.ini users $address($1,2) 400 Co-Owner
  echo -a User $1 added to the userlist with 400 (Co-Owner) access.
}
alias addmaster {
  writeini users.ini users $address($1,2) 300 Master
  echo -a User $1 added to the userlist with 300 (Master) access.
}
alias addop {
  writeini users.ini users $address($1,2) 200 Operator
  echo -a User $1 added to the userlist with 200 (Operator) access.
}
alias addpeon {
  writeini users.ini users $address($1,2) 100 Peon
  echo -a User $1 added to the userlist with 100 (Peon) access.
}
alias noaccess { return You do not have enough access to use this command. }
alias info { return $gettok($readini(users.ini,users,$wildsite),2,32) }
alias skin { return $hget(settings,skin) }
alias trigger { return . }