Skip to content

A powerful command handler and parser for all your needs. Includes checks, custom arguments, middlewares and more.

Notifications You must be signed in to change notification settings

TheAlan404/string-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

string-commands

A powerful command handler and parser for all your needs. Includes checks, custom arguments, middlewares and more.

Features

  • Easy to use
  • Recursive folder importing
  • Compatability with older commands
  • Configurable messages (no defaults)
  • Command checks (requirements)
  • Middlewares
  • Argument handling with custom argument support

Examples

For the best example please see consoleExample.js

Usage

Installing

You can install this package using

npm i string-commands

And then import using

import { CommandHandler } from "string-commands";

Documentation

See these for docs:

TODO

  • Complete typings
  • Middleware
  • Subcommands
  • Database Middlewares
  • Permissions Middleware

Changelog

v1.1.0:

  • ⚠️ BREAKING: In ExecutorContext (ctx in failedChecksMessage(ctx)/now on("failedChecks", (ctx)=>{})), the checks property is now CommandCheckResult[] instead of string[]. This allows Command Checks to supply additional information about the failed checks, such as

    • Codes for custom error messages
    • Additional context information (for example, you could supply the user's score or something so your failed checks handler doesnt have to fetch it from a database again, or maybe supply the needed threshold etc)
  • ⚠️ The invalidUsageMessage and failedChecksMessage functions have been removed. Please use the invalidUsage and failedChecks events instead.

  • Default prefix is now "" (empty string)

  • Added Middlewares

  • Added index.d.ts declarations file that's needlessly complex (and also incomplete)

  • Added more documentation

v1.0.0:

  • Created project
  • Added documentation

About

A powerful command handler and parser for all your needs. Includes checks, custom arguments, middlewares and more.

Topics

Resources

Stars

Watchers

Forks