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.send
methods 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'ssuspend
feature. One use-case forsuspend
is 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.embedAsync
was renamed toContext.sendAsync
for consistency.Context.dm
was renamed toContext.sendPrivate
. This offers a little more readability, and clarity as to what the function does on first glance.Context.waitFor
no longer returns a nullableT
.Context.typingAsync
has been changed to require invocation from a suspend context.- Due to the way it now works, exceptions thrown from the
suspend block
should no longer get suppressed.
- Due to the way it now works, exceptions thrown from the
- Internal changes to default parsers.
Optional.ofNullable
is now used rather than a combination ofOptional.of
andOptional.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
EventListener
instead 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
onMessageReceived
to be private. Nothing exciting but should yield a less cluttered auto-complete list for anyone that works with the CommandClient.
BadArgument
is 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
waitFor
now has a non-null result type.- This was left over from an earlier Flight version that completed with
null
on timeout, but now we just throw an exception instead.
- This was left over from an earlier Flight version that completed with
FlightInfo.VERSION
andFlightInfo.GIT_REVISION
are 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
,Cog
orJar
.
Changed
CommandRegistry.removeByCog
is 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.cleanContent
now replacese
with 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
@everyone
and@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
suspend
keyword. This also allows checking forOptional
parameters based on whether they're nullable (as denoted by the presence of the?
character following the parameter type.).- As a result,
@Async
and@Optional
annotations have been removed. - BREAKING CHANGE
- As a result,
-
Cleaned up methods in
Context
.- Renamed
embed
andupload
tosend
for consistency - All
send
methods 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.