Skip to content

Releases: devoxin/Flight

Flight 1.6.0

07 Mar 21:19
Compare
Choose a tag to compare

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.
  • More docs for methods in the Context class.
  • Context.sendAsync(attachment: Attachment)

Changes

  • Context.send methods no longer return CompletableFuture<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's suspend feature. One use-case for suspend 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.").
  • Context.embedAsync was renamed to Context.sendAsync for consistency.
  • Context.dm was renamed to Context.sendPrivate. This offers a little more readability, and clarity as to what the function does on first glance.
  • Context.waitFor no longer returns a nullable T.
  • 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.
  • Internal changes to default parsers.
    • Optional.ofNullable is now used rather than a combination of Optional.of and Optional.empty

Flight 1.5.1

30 Dec 23:11
Compare
Choose a tag to compare

Fixed

  • ArgParser correctly throws BadArgument when a user provides an invalid argument for a parameter with a default value.

Flight 1.5.0

30 Dec 22:46
Compare
Choose a tag to compare

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)
  • 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 extending ListenerAdapter.
    • 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.
  • FlightInfo.VERSION and FlightInfo.GIT_REVISION are now updated at build-time.

Flight 1.4.3

23 Dec 16:34
Compare
Choose a tag to compare

Fixed

  • Added space after mention trigger for help command.

Flight 1.4.2

23 Dec 16:28
Compare
Choose a tag to compare

Added

  • CommandRegistry.unload. Accepts CommandWrapper, Cog or Jar.

Changed

  • CommandRegistry.removeByCog is now CommandRegistry.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

23 Dec 00:33
Compare
Choose a tag to compare

Changes

  • Parameters can now have defaults specified.

    • Example: fun ban(ctx: Context, target: Member, reason: String = "None specified")
  • Context.cleanContent now replaces e with a russian e.

    • 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.

Flight 1.4.0

22 Dec 17:37
9d75dc2
Compare
Choose a tag to compare

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 for Optional 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
  • Cleaned up methods in Context.

    • Renamed embed and upload to send for consistency
    • All send methods now return CompletableFuture<Message>.
    • BREAKING CHANGE

Flight 1.3.0

20 Dec 21:11
Compare
Choose a tag to compare

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

20 Dec 20:46
Compare
Choose a tag to compare

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

02 Dec 17:06
Compare
Choose a tag to compare

• Added a Boolean parser. Apparently one didn't exist.