- Patron's name on NPM has changed! We were able to get the
patron
module on NPM, all future versions of patron will be released on it. - Patron is now licensed under LGPL-3.0. This is a far more lax license that should allow more freedom to patron users.
- Patron now automatically detects the Discord wrapper library used when possible. If only one wrapper library is installed, patron will detect and use that. Otherwise, you can swap between libraries at any point using the static
Registry#setLibrary()
method. - Patron supports ECMAScript modules. You can simply use
import
in any ECMAScript modules (includes named exports). Patron still maintains full support of CommonJS modules. - Patron has full TypeScript support. Although patron had typings already, they were untested and poorly written. The typings are now highly tested and have been checked over by several TypeScript developers (Thank you George, Apacheli and Skillz4Killz).
- Changed all enums to use Numbers instead of Symbols. This was done to improve TypeScript support.
- Renamed
CommandError
toResultType
:- Renamed
BotPermission
toClientPermission
. - Renamed
Command
toExecution
. - Renamed
Exception
toError
. - Renamed
InvalidArgCount
toArgumentCount
. - Renamed
InvalidContext
toContext
. - Renamed
UnknownCmd
toUnknown
.
- Renamed
- Added
ResultType.Success
, which replacesResult.success
. - Added
ResultType.ArgumentOrder
, which indicates out-of-order chained optional Arguments. - Changed several default TypeReaders:
BooleanReader
accepts more inputs, including"on"
and"off"
.ColorReader
only accepts hex colors.IntegerReader
doesn't accept unsafe integers.TimeReader
:- Doesn't accept excessively large or negative numbers.
- No longer considers centuries or decades valid units of time.
- Will parse valid unit names without any number as one of that unit.
- Removed all Channel-related readers except for
GuildChannelReader
. - Renamed
GuildChannelReader
toChannelReader
. - Removed
GuildEmojiReader
, equivalent behavior can be achieved with aPrecondition
and theEmojiReader
.
- Changed
Result
:- Removed
Result.errorReason
. - Removed
Result.commandName
. - Removed
Result.success
(seeResultType.Success
). - Renamed
Result.commandError
toResult.type
.
- Removed
- Removed
ArgumentResult
. CommandResult
now handles unknown commands, invalid argument counts, and out-of-order arguments.ExecutionResult
now handles the original functionality of theCommandResult
class.- Added
ExecutionResult.fromSuccess()
, which provides a value toPostcondition
s without revertingCooldown
s likefromFailure()
does.
- Added
- Added
CooldownResult.group
, which will betrue
if the Cooldowns were on a Group and not a Command. - Renamed
ExceptionResult
toErrorResult
. - Renamed
InvalidContextResult
toContextResult
. - Removed
description
from every structure except forCommand
andGroup
, it now defaults toundefined
. - Changed
Argument
:- Changed
name
andkey
to default to the value oftype
. - Added
typeOptions
which provides custom options to theTypeReader
. - Significantly improved the functionality of
optional
arguments.
- Changed
ArgumentPrecondition
andPrecondition
no longer requirerun()
to return aPromise
.- The
value
/input
parameters ofArgumentPrecondition.run()
/TypeReader.read()
are now first. - Added
Command.setDefaults()
andGroup.setDefaults()
methods which set default options for the structures. - Changed
Command
:arguments
acceptsArgumentOptions
as well asArgument
s.- Renamed
botPermissions
toclientPermissions
. - Changed
group
to be optional. - Removed
hasCooldown
, check ifcooldowns
is defined instead. - Changed
cooldowns
to be an array instead of a single cooldown. getExample()
andgetUsage()
have an optional prefix parameter.getExample()
returns undefined if anyArgument
examples are missing.- Renamed all cooldown methods (e.g.
useCooldown
) to have plural names.
- Changed
Group
:- Added
cooldowns
, which will be an array of Cooldowns to run on everyCommand
in the group. - Added cooldown methods which are identical to the ones
Command
s have. - Removed
commands
, useRegistry.getGroupedCommands()
instead.
- Added
- Changed
Cooldown
:- Added
aggressive
, when enabled the cooldown will be set back to the full duration every time it's used past the limit. - Changed
sorter
, now async functions can be provided and a Message object is supplied instead of user and guild IDs. - Added
failure
, which indicates that a Cooldown should be applied to failed Command executions only.
- Added
- Changed
Postcondition.run()
's second parameter from a result to a value provided by anExecutionResult
, and added aCommand
parameter at the start. - Changed
Registry
:- Added static
setLibrary()
method for simpler usage and set up automatic detection. - Stores all structures in
Map
s instead ofArray
s. - Added
get()
methods for all structures (e.g.getCommand()
). - Added
registerPrefixes()
andunregisterPrefixes()
for full prefix support. Global prefixes will apply to DMs and all guilds with no guild-specific prefixes.
- Added static
- Changed
Handler
:- Undocumented all methods except for
run()
andrunPreconditions()
, other methods have no guarantees. - Removed the
prefixLength
parameter fromrun()
(seeRegistry.registerPrefixes()
). - Added
executeCommand()
for manual execution ofCommand
s. - Added
parsePrefix()
for determining which prefix a message has.
- Undocumented all methods except for
- Changed
Mutex
to uselock()
andunlock()
instead ofsync()
. - Removed
MultiMutex
from exports, use cases were too rare and identical functionality can be achieved withMutex
. - Added
ImportAll
, which will replaceRequireAll
when the library is used in an ECMAScript module.