Releases: devoxin/Flight
Flight 1.6.0
Added
- New parser: LongParser
addCustomParser<T>(parser: Parser<T>)- This allows usage such as:
addCustomParser<Long>(longParser). Additionally, the type can be inferred from the parser itself.
- This allows usage such as:
- More docs for methods in the Context class.
Context.sendAsync(attachment: Attachment)
Changes
Context.sendmethods no longer returnCompletableFuture<Message>.- The reason for this change is because users could abstract operations away within the CompletableFuture which meant that if any exceptions were thrown, they would not be dealt with unless the user added custom exception handling. As a result, users must now use
sendAsync. This offers a much better UX, and makes good use of Kotlin'ssuspendfeature. One use-case forsuspendis when waiting for I/O, which means other tasks can still be performed while requests are made. Lastly, this change re-introduces the ability to use the elvis operator on nullable objects, for example:getRandomCat() ?: return ctx.send("Couldn't get a random cat image.").
- The reason for this change is because users could abstract operations away within the CompletableFuture which meant that if any exceptions were thrown, they would not be dealt with unless the user added custom exception handling. As a result, users must now use
Context.embedAsyncwas renamed toContext.sendAsyncfor consistency.Context.dmwas renamed toContext.sendPrivate. This offers a little more readability, and clarity as to what the function does on first glance.Context.waitForno longer returns a nullableT.Context.typingAsynchas been changed to require invocation from a suspend context.- Due to the way it now works, exceptions thrown from the
suspend blockshould no longer get suppressed.
- Due to the way it now works, exceptions thrown from the
- Internal changes to default parsers.
Optional.ofNullableis now used rather than a combination ofOptional.ofandOptional.empty
Flight 1.5.1
Fixed
- ArgParser correctly throws BadArgument when a user provides an invalid argument for a parameter with a default value.
Flight 1.5.0
Added
CommandClient#waitFor<T: Event>(predicate, timeout)- This makes use of the reified keyword so you can do things like
client.waitFor<MessageReceivedEvent>({ true }, 3000)
- This makes use of the reified keyword so you can do things like
FlightInfo.GIT_REVISION- This allows you to pinpoint which specific commit of Flight you're working with.
Removed
AwaitTimeoutException- Figured this didn't have any specific purpose when a TimeoutException already existed.
Changes
- CommandClient now uses
EventListenerinstead of extendingListenerAdapter.- This means that Flight will only process events it needs to, which should offer slightly better performance.
- This also has the added benefit of allowing internal hooks such as
onMessageReceivedto be private. Nothing exciting but should yield a less cluttered auto-complete list for anyone that works with the CommandClient.
BadArgumentis thrown once again when an argument couldn't be resolved for a parameter that already had a default.- This should offer a better end-user experience when parsing fails but argument execution still proceeded. Users shall be confused no more!
- Trivia: This was added in 1.4.4 but was never actually published as a release because it was such a small change
- looks at Flight 1.4.3
- The CompletableFuture returned by
waitFornow has a non-null result type.- This was left over from an earlier Flight version that completed with
nullon timeout, but now we just throw an exception instead.
- This was left over from an earlier Flight version that completed with
FlightInfo.VERSIONandFlightInfo.GIT_REVISIONare now updated at build-time.
Flight 1.4.3
Fixed
- Added space after mention trigger for help command.
Flight 1.4.2
Added
CommandRegistry.unload. AcceptsCommandWrapper,CogorJar.
Changed
CommandRegistry.removeByCogis nowCommandRegistry.unload.
Fixed
- Jar classloaders are no longer prematurely closed upon loading cogs from an external jar.
- Dependencies belonging to the external jar should now work as expected.
- Mention regex should now properly match in the help command.
Flight 1.4.1
Changes
-
Parameters can now have defaults specified.
- Example:
fun ban(ctx: Context, target: Member, reason: String = "None specified")
- Example:
-
Context.cleanContentnow replacesewith a russiane.- Both characters look identical, however this change has the benefit of keeping character counts the same. This change should also ensure that your bot will remain unaffected by RTL unicode character exploits that aim to circumvent checks that would otherwise prevent the bot from pinging
@everyoneand@here.
- Both characters look identical, however this change has the benefit of keeping character counts the same. This change should also ensure that your bot will remain unaffected by RTL unicode character exploits that aim to circumvent checks that would otherwise prevent the bot from pinging
Flight 1.4.0
Another breaking change (although this one was definitely needed!)
Added
Context.cleanContent.- Quick-start guide in README.md.
Changed
-
Reflection operations on command discovery have been refactored to use Kotlin classes. This allows Flight to detect whether a command is async based on the presence of the
suspendkeyword. This also allows checking forOptionalparameters based on whether they're nullable (as denoted by the presence of the?character following the parameter type.).- As a result,
@Asyncand@Optionalannotations have been removed. - BREAKING CHANGE
- As a result,
-
Cleaned up methods in
Context.- Renamed
embedanduploadtosendfor consistency - All
sendmethods now returnCompletableFuture<Message>. - BREAKING CHANGE
- Renamed
Flight 1.3.0
Changes
• onBadArgument now accepts a Command parameter.
• onParseError now accepts a Command parameter.
• onCommandError now accepts a Command parameter, and the error parameter's type was changed to Throwable as a wrapper was deemed unnecessary. This was also done for consistency. This also applies to cog-local onCommandError.
Flight 1.2.2
Additions
• Added DoubleParser.
• Added FloatParser.
Fixes
• BooleanParser, DoubleParser, FloatParser and IntParser are now aliased to their java.lang counterparts after discovering Kotlin uses these internally when the type is boxed.
Changes
• Actually registered the BooleanParser. Forgot to do this in 1.2.1.
Flight 1.2.1
• Added a Boolean parser. Apparently one didn't exist.