3.1.0 • Published 5 years ago

patron.js v3.1.0

Weekly downloads
5
License
AGPL-3.0-only
Repository
github
Last release
5 years ago

About

Patron.js is an efficient, stable and reliable command framework for discord.js and eris, that aims for true flexibility. This framework does not have it's own client, it does not manage the message event for you, it does not clutter the library's classes with extensions and it most certainly does not send messages on your behalf.

Official example

Patron.js has an official example filled with useful comments, allowing you to build your code on a solid base while learning at the same time. This example will be maintained and updated to ensure it will always be a useful reference for beginners. The example may be viewed here.

Command Results

Every single command execution returns a result object. This result object will always have the success property. If the command execution was unsuccessful, this property will be set to false. If this is the case, the result will also have the commandError property, allowing you to handle the error and respond (or not) accordingly. These are the current command errors:

  • BotPermission
  • Command
  • Cooldown
  • Exception
  • InvalidArgCount
  • InvalidContext
  • MemberPermission
  • Precondition
  • TypeReader
  • UnknownCmd

Depending on which error occurred, the result object will have different properties. This is an example (discord.js/eris) of how these errors may be handled.

Arguments

Patron.js's arguments allow for contextual default values. For example, if you have a user argument in your command, you can set the default of this argument to ArgumentDefault.Author. This enum allows you to set defaults of arguments based on the context in which the command was used.

Furthermore, this framework has featured, efficient and reliable type readers. For example, the user type reader can parse a user object based off of an id, mention, username, or nickname (if they are in a guild). If there are multiple matches found, it will return an unsuccessful TypeReaderResult with the matches in question in the error reason. If there are too many matches to list, it will simply ask the user to be more specific. All available type readers are here.

This is an example (discord.js/eris) of how to make use of this argument system. As you can see, all examples are argument specific, which is the best approach for maintainability. Most command frameworks will allow you to provide an example string for each command, however, these examples are often forgetten and not updated while the arguments themselves change, leaving inconsistencies throughout the commands. Not to mention this system allows you to create a single commonly used argument object, such as a user, and share this accross all files, to prevent redudancy and code repetition, while still allowing for the command usage example to always be up to date.

Preconditions

There are currently two types of preconditions: Preconditions and Argument Preconditions. Normal preconditions can be added on any on Command or Group, while argument preconditions may only be added to arguments. All preconditions must return a PreconditionResult. If the result in question is unsuccessful, it will be the returned result in the command handler.

Support

The best place to get support for patron.js is in our official support server. We try to keep things spicy, so you can joke around while getting good, pretty slamming combo. Keep in mind this framework is not meant for new coders, it is meant for people that want a genuinely reliable command framework and more maintainable code overall.

3.1.0

5 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.5.5

7 years ago

2.5.4

7 years ago

2.5.3

7 years ago

2.5.2

7 years ago

2.5.1

7 years ago

2.5.0

7 years ago

2.4.1

7 years ago

2.4.0

7 years ago

2.3.0

7 years ago

2.2.9

7 years ago

2.2.8

7 years ago

2.2.6

7 years ago

2.2.5

7 years ago

2.2.4

7 years ago

2.2.3

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.2.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago