Releases: 21Joakim/Jockie-Utils
Jockie Utils 1.42 [JDA v4 only]
-
Changes
- Options now use primitive default values (for primitive data types) when the value is null (just like arguments)
- Provided options are now stored by the name (main trigger) of the option instead of the alias used, this means you can no longer know which alias was used but it is more convenient as you do not have to check all of the aliases to find out if the option was provided.
-
Bug fixes
- Fixed a bug which caused the automatic creation of options with aliases to error
- Fixed a bug which caused the command parser to error if
--
was provided at the end of the command
Jockie Utils 1.41 [JDA v4 only]
-
Features
- Added the ability to add and remove option prefixes with
CommandParserImpl#addOptionPrefix
and#removeOptionPrefix
, an option is what an option name is prefixed with for it to be considered an option, this is by default--
- Reworked the parser system to facilitate option parsers without having duplicate code
- Changes
- IArgumentParser (Replaced by IParser)
- IGenericArgumentParser (Replaced by IGenericParser)
- IArgumentBeforeParser (Replaced by IBeforeParser)
- IArgumentAfterParser (Replaced by IAfterParser)
- ParsedArgument (Replaced by ParsedResult)
- Added
- Made all the default parsers in to separate classes, these can be found in
com.jockie.bot.core.parser.impl
- Made all the default parsers in to separate classes, these can be found in
- Changes
- Added
IOptionFactory
, this is mostly the exactly same asIArgumentFactory
only difference being the#createOption
instead of#createArgument
.OptionFactory#getDefault
to get the default factory - Added
OptionParsingFailurePolicy
andICommand#getOptionParsingFailurePolicy
which will be used to determine what to do when an option fails to parse correctly, the possible values areFAIL
andIGNORE
(default) - Added the ability to have multiple sub-commands with the same name (this was only an issue for the automatic generation, you could always add a sub-command with the same name through the
addSubCommand
method), it would previously just pick one of the available commands without any indication that it did so, making it seem like a bug
- Added the ability to add and remove option prefixes with
-
Changes
- Removed
ArgumentFactoryImpl#setUseShardManager(boolean)
, this has now been moved toGuildParser
andUserParser
,registerDiscordParsers
now also accepts a booleanuseShardManager
- Renamed
AbstractCommand#setInvalidOptionPolicy
to#setUnknownOptionPolicy
andArgument#invalidOptionPolicy
to#unknownOptionPolicy
. The classUnknownOptionPolicy
was renamed before but for some reason these were not included in the change - Removed
IArgumentParser#getPriority
this has now been moved to theCommandTriggerComparator
class (seeCommandTriggerComparator#getInstance
) and can be set with#setPriority(Class, int)
. This means that priority is no longer based on the parser and is now based on the type of the argument
- Removed
-
Bug fixes
DuplicateOptionPolicy
would not take effect for unknown options
Jockie Utils 1.40 [JDA v4 only]
-
Features
- Added
CommandListener#setCaseSensitivePrefixes
and#isCaseSensitivePrefixes
, this is used to set whether or not prefixes should be case sensitive or not (by default this istrue
) StringUtility#asMap
now accepts a collection of the quotes to handle, which meansArgumentParsingType#NAMED
will now support allCommandParserImpl#getQuoteCharacters
quote characters
- Added
-
Changes
- The
dummyCommands
field forMethodCommandImpl
has been changed fromprivate
toprotected
in-case you ever need it for some custom thing. This was the only property which was stillprivate
in the whole command implementation chain so I figured I might as well make itprotected
too - The
type
parameter forIArgumentParser#getParser
and#getGenericParser
is now@Nullable
- Removed the default
!
prefix, there are now no prefixes for theCommandListener
by default
- The
-
Bug fixes
- Fixed
IGenericArgumentParser
not handling before and after parsers - Fixed
null
values (for instance, by usingnullDefault
) for primitive arguments not being converted to their Java default value (for instance,false
and0
), causing an exception - Fixed
CommandListener#getMessageParseFailureFunction
returning the help function instead of the message parse function
- Fixed
Jockie Utils 1.39 [JDA v4 only]
-
Features
- Added
IErrorManager#unregisterResponse
- Added
-
Changes
ConfigureBuilderFunction
now has a generic type for the argument type, not having the argument type caused issue like not being able to usesetDefaultValue
without casting the builder- Changed all remove methods in
IArgumentFactory
to use a generic wildcard for both the class and parser to prevent unnecessary complexity for the user
-
Bug fixes
- Fixed a bug which caused endless arguments to not use the generic builders, this in turn caused enums to not work automatically for endless arguments
- Fixed a bug which caused endless arguments to not care about the
Optional
class, if you, for instance, didOptional<String[]>
it would not become optional
Jockie Utils 1.38 [JDA v4 only]
-
Features
- Added more documentation to a lot of methods, documentation includes both
@Nonnull
and@Nullable
- Added
DuplicateOptionPolicy
toICommand
, this option is used to determine what happens when an option is given more than one time, by default, this is set toUSE_LAST
to be consistent with the previous implementation- If you use
COMBINE
it will return aList
of all the provided values, but only if more than one was provided which means this can currently only be used throughCommandEvent#getOption
- If you use
FAIL
aDuplicateOptionException
will be thrown during parsing
- If you use
- Added
addParserBefore
,addParserAfter
andaddGenericBeforeParser
toIArgumentFactory
, these are used to modify the content of the argument, the before parser is used to modify the input before it gets to the parser and the after parser is used to modify the output of the parser before it gets to the command - Added
IArgumentFactory#registerGenericParser
, this can be used to, for instance, handle enums without having to make a new parser for every enum (this is a default parser) - Added a new interface
IPropertyContainer
which has the methodgetProperty
, this is extended byIArgument
,ICommand
andCommandEvent
and allows for custom properties (the set methods are exposed through the implementation, IArgument.Builder, AbstractCommand and CommandEvent respectively) - You can now get context for the current command class again, for instance,
@Context MyCommandClass command
- You can now use the
IContextManager#setEnforcedContext
method (it would previously throw anUnsupportedOperationException
) - Method name to command name conversion will now also handle camel case (
helloThere
would becomehello there
) previously it only handled underscores (this only takes effect if the command name is not specified through the@Command
annotation) - Separated error handling and help handling, error handling is handled through
CommandListener#setMessageParseFailureFunction
and help is handled throughCommandListener#setHelpFunction
, previous both were handled through the help function (note that the help function is called through the message parse failure function) - Added
ICommandEventFactory
, which can be set with theCommandListener#setCommandEventFactory
method, the factory will be used to create theCommandEvent
for a command. Note to use a customCommandEvent
class as a parameter you will have to register it as a context withIContextManager#registerContext
as well asIContextManager#setEnforcedContext
(the second part is optional but without it, you are going to have to use the@Context
annotation)
- Added more documentation to a lot of methods, documentation includes both
-
Changes
- Renamed
UnknownOptionException#getOptionString
togetOptionKey
- Renamed
ICommand#verify
toisAccessible
, a slightly more fitting name - Renamed
CommandListener#parse
tohandle
- Changed
IOption#getAliases
to returnList<String>
insteadString[]
to be more consistent with other classes - Changed to proper logging instead of using
System.out
andSystem.err
- Better handling of async commands with ordering keys, it will no longer create a new thread for every command that is going to be executed, it will instead queue them and only create a single thread per ordering key
- Renamed
Jockie Utils 1.37
-
Features
- Added a new property to the
@Initialize
annotation calledrecursive
which istrue
by default and only works whensubCommands
istrue
as well, this is used to specify whether sub-commands should recursively be initialized or just the top layer
- Added a new property to the
-
Changes
- Changed the
allowedArgumentParsingTypes
to only havePOSITIONAL
by default - When
subCommand
istrue
in the@Initialize
annotation it will now recursively get all commands, to disable this behaviour you can setrecursive
tofalse
- Changed the
-
Bug fixes
- Fixed a bug which caused an exception to be thrown if the command had
NAMED
as an allowed argument parsing type and you specified an argument without a value liketest=
- Fixed a bug where if you used the
@SubCommand
annotation to specify nested sub-commands it would not work at all
- Fixed a bug which caused an exception to be thrown if the command had
Jockie Utils 1.36
-
Features
-
Added an
@Ignore
annotation which can be used to skip commands or modules when loading commands -
Added
Initialize#subCommands
, which will determine whether to include sub-commands in the initialization or not, this is false by default -
Added the ability to add commands and modules by their class to the
CommandStore
, likecommandStore.addCommands(ModuleFun.class)
-
Added
IArgument#getErrorConsumer
,@Error
annotation andIErrorManager
which can be used to set a custom error messages for when an argument is parsed incorrectly, for instance@Argument("user") @Error("Invalid user") User user
orcommandListener.getErrorManager().registerResponse(User.class, "Invalid user")
-
Added
CommandListener#addDevelopers(String...)
and#removeDevelopers(String...)
-
Added
CommandEvent#isFromGuild
and#isFromType(ChannelType)
-
Added support for options with values, these can be specified like
@Option("option") String option
and are used likeoption=value
, only theString
type is supported for values (Booleans can also be specified like option=true but that is not required) -
Added better error handling for
CommandStore#loadFrom
and#loadModule
-
Added default values for when having nullDefault on a primitive argument, the default values can be found at https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html under
Default Values
-
Improved the result returned when the user incorrectly tries to execute a command
-
Improved performance for
ReturnManagerImpl
andContextManagerImpl
-
Fixed documentation for JavaDocs
-
-
Changes
-
Added a
getType
method toIArgument
-
Added
getArgument
andgetComponentType
toIEndlessArgument
-
Added a generic type to
IOption
as well as agetType
method -
Removed
CommandListener#addDeveloper(ISnowflake)
,#addDeveloper(long)
,#removeDeveloper(ISnowflake)
and#removeSnowflake(long)
-
Removed
CommandEvent#getOptionsPresent
, added#getOptions
,#getOption(String, Class)
andgetOption(String)
-
Removed the
@Arguments
annotation, not entirely sure why this was added, it was somewhat useless. I think it was just added to test something new -
Renamed
CommandListener#addCommandStore
to#addCommandStores
and#removeCommandStore
to#removeCommandStores
for consistency -
Reworked the
ArgumentFactory
to be more consistent with other factories, addedIArgumentFactory
,ArgumentFactoryImpl
and changedArgumentFactory
to return and set the default factory -
Changed how you get the actual command from a
DummyCommand
, you now use thegetActualCommand
method instead ofgetParent
-
Changed most methods in
ArgumentUtiliy
to now return a list of results instead of a single entity, the argument parser will however still only accept the argument if there is only a single result -
Changed
IArgument#parse
andIArgumentParser#parse
to now takeParseContext
instead of aMessage
-
Changed some default functions in
CommandListener
- Renamed
DEFAULT_HELP_FUNCTION
todefaultHelpFunction
and made it non-static - Renamed
DEFAULT_MISSING_PERMISSION_FUNCTION
todefaultMissingPermissionsFunction
and made it non-static - Renamed
DEFAULT_MISSING_PERMISSION_EXCEPTION_FUNCTION
todefaultMissingPermissionExceptionFunction
and made it non-static - Renamed
DEFAULT_MISSING_AUTHOR_PERMISSION_FUNCTION
todefaultMissingAuthorPermissionsFunction
and made it non-static - Renamed
DEFAULT_COOLDOWN_FUNCTION
todefaultCooldownFunction
and made it non-static - Renamed
DEFAULT_NSFW_FUNCTION
todefaultNsfwFunction
and made it non-static
- Renamed
-
Changed to use
EnumSet
inCommandListener
for permission related stuff instead ofList
-
Changed the order of the parameters in
ICommandParser#parse
, thetrigger
parameter is now afterprefix
instead of aftercommand
-
Moved
TriFunction
andTriConsumer
fromcom.jockie.bot.core.utility
tocom.jockie.bot.core.utility.function
-
-
Bug fixes
- Fixed
ArgumentTrimType
and quote characters for endless arguments (closes #14) - Fixed a bug which made
CommandEvent#removeCooldown
and#applyCooldown
not function correctly if it was executed as a DummyCommand - Fixed a bug with
CommandEvent#isPrefixMention
which made it not work properly at all, it was checking for a mention without a space but the mention prefix requires a space - Fixed a bug with the alternative command implementations which made alternative commands have separate data from their main command, this meant that, for instance, a description could be null instead of the actual description. This also meant that the different implementations would have different cooldown lengths if applied. A side effect of this change is that the command now has to have the exact same data as the main command, meaning that they can't have different permissions and cooldown lengths, which may be desired for some setups
- Fixed
Jockie Utils 1.35
-
Features
- Added the ability to disable the usage of the
ShardManager
in arguments such asUser
andGuild
with theArgumentFactory#setUseShardManager(boolean)
method - Added the ability to set the command for a command with
AbstractCommand#setCommand(String)
- Added
getContext(Class)
andgetContext(Type)
toCommandEvent
which are shortcuts forIContextManager#getContext
- Added
replyFormat(String, Object...)
,replyTyping()
,react(Emote)
andreact(String)
toCommandEvent
- Added the ability to disable the usage of the
-
Changes
- Removed
ICommand#getExamples()
, I felt like this was just bloat and if the user wants it they can make their own custom command class - Moved the
Context
class fromcom.jockie.bot.core
tocom.jockie.bot.core.command
- Renamed
CommandEvent#isDeveloper
toisAuthorDeveloper
to be more clear - Switch places of
CommandEvent#getCommand()
andgetActualCommand()
and renamedgetActualCommand()
togetTriggeredCommand()
- Removed
-
Bug fixes
- Fixed inconsistency where some commands would require
CommandImpl
and some would requireAbstractCommand
- Fixed a cooldown related bug where if you used
CommandEvent#applyCooldown(long, TimeUnit)
without the command's cooldown duration,ICommand#getCooldownDuration()
, being greater than 0 it would not do anything
- Fixed inconsistency where some commands would require
Jockie Utils 1.34
-
Features
- Added a
JockieUtils
class where you can get the github link as well as the current version - Properly documented
ArgumentFactory
and addedregisterAlias
for stuff like primitive data types. AddedregisterEssentialParsers
,registerDiscordParsers
andregisterJSONParsers
as well so you can decide what you want to register, all of these are registered by default - Added
setAutomaticallyCreateEnums
andisAutomaticallyCreateEnums
toArgumentFactory
, these are used to set whether or not enum parsers should be created automatically whenArgumentFactory#builder(class)
is called if they are not already registered - Added
CommandExecutionException
and changed the way stack traces were printed - Added a check for the automatic creation of options to make sure they are booleans
- Added
getPriority
toIArgumentParser
which will be used to help get the most accurate result when finding commands - Added
setFilterStackTrace
andisFilterStackTrace
, this will be used to determine whether or not a stack trace from a command should be filtered to only show the command's stack trace, by default this is true - Added
removeQuoteCharacter
toCommandParserImpl
- Added
getUser
,retrieveUser
,getUserByIdOrTag
andgetGuildByIdOrName
toArgumentUtility
- Added support for
ShardManager
for some methods inArgumentUtility
- Added a default parser for
Guild
- Upgraded the default parser for
User
to allow for tags and names - Upgraded all default Discord entity parsers to use the
ShardManager
if available - The enum parser now allows for enums with an underscore to be defined with spaces if the argument is endless or quoted
- Added a
-
Changes
- Renamed
registerArgument
toregisterParser
inArgumentFactory
- Renamed
ArgumentImpl
toAbstractArgument
- Renamed
SimpleArgument
toArgumentImpl
- Renamed
of
tobuilder
inArgumentFactory
- Renamed
handleAll
toisHandleAll
inIArgumentParser
- Pre-execute checks will no longer ignore errors but instead act as if the command failed to execute and throw a
CommandExecutionException
- Changed
quoteCharacters
inCommandParserImpl
to be aSet
instead ofList
- Renamed
addAllowedQuoteCharacter
toaddQuoteCharacter
inCommandParserImpl
ArgumentTrimType.LINENT
will no longer trim arguments with the endless property, for this you would need to useSTRICT
- Renamed
-
Bug fixes
ThegetPriority
property added toIArgumentParser
s fixes #13
Jockie Utils 1.33
-
Features
- Added a new property
ICommand#getArgumentTrimType
andCommand#argumentTrimType
which can be eitherNONE
,LENIENT
andSTRICT
, this will determine how spaces are handled in commands - Added
setAllowedQuoteCharacters(List<Pair>)
,addAllowedQuoteCharacter(char, char)
andgetAllowedQuoteCharacters
toCommandParseImpl
. This, by default, has quote characters gotten from discord.py - Added
IComponentFactory
which has the methodscreateArguments
andcreateOptions
which are used in the creation of generated commands - Added the ability for command methods to be called
on_command
instead of justonCommand
- Added
CommandStore#loadFrom(ClassLoader, String, boolean)
, this can be useful if you are dynamically loading commands
- Added a new property
-
Changes
- Reworked the command structure,
IComamnd
is now implemented byAbstractCommand
which is extended byMethodCommandImpl
(implementingIMethodCommand
) which is extended by CommandImpl. This rework is to easier allow for custom commands, more information can be seen in the README under Command Extensions
- Reworked the command structure,