Releases: ShindouMihou/Nexus
v1.2.0
Changelog
Nexus 1.2.0 removes the previous innovative rendering mechanism to allow it to be maintained separately from Nexus itself. You can head to Reakt.Discord
if you want to install it for your bot.
v1.1.0
Changelog
Nexus 1.1.0 brings a new way of writing highly reactive, or highly interactive Discord bots with ease. Nexus.R brings a refreshing, new rendering mechanism that carries a Svelte+React feel, making it more native to web developers. It is currently in use and being monitored for more improvements by Flyght.
In addition, this version adds the following changes:
- Coroutine Addon: Coroutines are now more supported by using the new coroutine add-on.
- Entour Addon: Adds a set of handy and useful tools to Nexus.R.
Associated Pull Requests
- Nexus.R by @ShindouMihou in https://github.com/ShindouMihou/pull/19
v1.0.0-beta.next
Nexus 1.0 is now ready for official release with the following latest changes and breaking changes from the 1.0.0-next.
Breaking Changes
NexusCommandInterceptor
Methods to add interceptors such as middlewares and afterwares in the NexusCommandInterceptor
interface has been removed completely in favor of Nexus.interceptors
, this is to keep the API more consistent across the board.
Migration:
- NexusCommandInterceptor.addMiddleware("key") { ... }
+ Nexus.interceptors.middleware("key") { ... }
- NexusCommandInterceptor.middleware { ... }
+ Nexus.interceptors.middleware { ... }
NexusCommandInterceptorRepository
We're removing this altogether because there is no point in bringing this when it simply just does the same thing as the newer style but under a define function.
Migration:
- object SomeRepository: NexusCommandInterceptorRepository {
- val SOME_MIDDLEWARE: String = "some.middleware"
- override fun define() {
- middleware(SOME_MIDDLEWARE) { ... }
- }
- }
+ object SomeRepository {
+ val SOME_MIDDLEWARE: String = Nexus.interceptors.middleware("some.middleware") { ... }
+ }
cooldown
in NexusCommand
We've removed cooldown
field as a native field in NexusCommand
, this is, in order to keep things more consistent, as we do not offer the Ratelimiter as a Nexus-Native middleware (like OptionValidation is).
Migration:
- val cooldown = Duration.ofSeconds(5)
+ @Share val cooldown = Duration.ofSeconds(5)
NexusCommonInterceptors
We recently changed NexusCommonInterceptors
from a interface to an singleton, so this may cause some import issues for some people. Don't worry, just reimport it!
NexusLoggingAdapter
We recently changed the internal methods of Nexus to pass exceptions in the parameters of Nexus.logger
without any placeholders (not that we even use placeholders now as we use Kotlin), so you may see exceptions being passed as a parameter even though there are no placeholders.
NexusCommand
We've removed older methods that have long been marked for deprecation, the following functions were moved:
- fun addSupportFor(vararg serverIds: Long): NexusCommand
- fun removeSupportFor(vararg serverIds: Long): NexusCommand
- fun getServerId(): Long
Migration:
val command = ...
command.associate(serverIds)
command.disassociate(serverIds)
# Same behavior as the old `NexusCommand#getServerId`
command.serverIds.first()
Major Changes
Context Menus
First-class support for context menus (user and message) in Nexus is now supported. This will make it so that we don't have to use some sketchy methods to prevent your context menus from being overridden, and this makes it easier to use Nexus with context menus.
object TestUserContextMenu: NexusUserContextMenu() {
val name = "test"
override fun onEvent(event: NexusContextMenuEvent<UserContextMenuCommandEvent, UserContextMenuInteraction>) {
event.respondNowEphemerallyWith("Hello")
}
}
object TestMessageContextMenu: NexusMessageContextMenu() {
val name = "test"
override fun onEvent(event: NexusContextMenuEvent<MessageContextMenuCommandEvent, MessageContextMenuInteraction>) {
event.respondNowEphemerallyWith("Hello")
}
}
Nexus.contextMenus(TestUserContextMenu, TestMessageContextMenu)
Failed Dispatch Afterwares
Afterwares can now listen to failed dispatch events which will significantly help with logging and analytical afterwares. Previously, afterwares weren't able to execute after a command failed to dispatch (e.g. a middleware rejecting dispatch), but now, we can listen to these events and even know which middleware caused the problem by using NexusCommandEvent.get(NexusAfterware.BLOCKING_MIDDLEWARE_KEY)
.
A prime example of this mechanism is the new NexusCommonInterceptors.LOG
middleware:
object SomeAfterware: NexusAfterware {
override fun onAfterCommandExecution(event: NexusCommandEvent) {}
override fun onFailedDispatch(event: NexusCommandEvent) {} // optional
}
log
common afterware
We now have our first common afterware, and it's the NexusCommonInterceptors.LOG
afterware which helps you log commands easily. This uses the Nexus.logger
to log.
Minor Changes
- Some behavioral changes have been done to
NexusConsoleLoggingAdapter
.- We now log to
stderr
instead ofstdout
for errors. - Exceptions are now handled through the logging adapter.
- We now log to
- Added more utilities to
NexusMessage
(Kotlin-only).EmbedBuilder.toNexusMessage()
String.toNexusMessage()
- Added support for inheritance parents with superclass fields, this will make it so parent inheritance can extend upon superclasses (e.g. abstract classes) and still copy the fields from there.
- Added support for superclasses in commands (e.g extending abstract classes).
- Nexus will now automatically use
NexusConsoleLoggingAdapter
when there is no SLF4J logger (as the default logger caused issues wherein exceptions would be ignored as there was no adapter to handle them a.k.a NOP) - A new reflection engine has replaced the previous, making things significantantly easier to add and also making things easier to maintain.
- Added some incomplete support for
nsfw
field for both context and slash commands.- Due to Javacord issues, we cannot update the application command's nsfw field using the
SlashCommandUpdater
because it's missing on the current stable version of Javacord. This does not affectNexus.synchronizer.synchronize()
andNexus.synchronizer.batchUpdate(server)
as those methods usesbulkOverwrite
which overwrites the entire commands altogether, allowing updates for those.
- Due to Javacord issues, we cannot update the application command's nsfw field using the
- You can now include additional
ApplicationCommandBuilder
toNexus.synchronizer
throughNexus.synchronize.include(server, commands)
. This is intended when you want to add your own little other stuff e.g. custom context menus that doesn't use Nexus. - Added
NexusCommandEvent.get(key)
that returns anObject
(orAny
for Kotlin) as there are cases where our little type-casting doesn't really work, so we'd prefer doing it on our own. - Fixed wiki links on documentations.
- A warning is now sent when you try to add
@Inherits
to an inheritance parent (as that isn't really supported),@Inherits
should only be on children. - We now use
Nexus.launcher
to dispatch all events, so you can now use coroutines or related.
v1.0.0
Changelog
To read all about the changes that this brought, simply read the v1.0.0-beta
pull request. Although, to know more about the changes brought about from the last version of beta, simply read v1.0.0-next
.
Nexus 1.0 has long been overdue, and the main branch has always been the v1.0.0-beta
, so any other bots that were created after the branch was changed to v1.0.0-beta
can safely read v1.0.0-next
for changes.
Otherwise, those even older bots should read the v1.0.0-beta
pull request.
Associated Pull Requests
- Global and Local Inheritance by @ShindouMihou in #11
- Adds a basic subcommand router and copying option validators. by @ShindouMihou in #12
- Adds deferred middlewares and better interceptor handling by @ShindouMihou in #13
- Adds support for auto-deferring responses by @ShindouMihou in #14
- Fixes major Express Way issues by @ShindouMihou in #15
- [STABLE] Adds the remaining final touches to stable version. by @ShindouMihou in #17
- Forwarding into Beta [1.0.0-BETA] by @ShindouMihou in #8
Full Changelog: v1.0.0-alpha6...v1.0.0
v1.0.0-beta.13
What's Changed
- Added convenience methods to
NexusMessage
. - Fixes an issue where
NexusMessage
's ephemeral was not being respected. It will only be disrespected when it is a deferred response (since the caller of the updater only has the right to set deferred responses to ephemeral).
fun from(text: String, ephemeral: Boolean = false, builder: NexusMessageBuilder = {}): NexusMessage
fun from(ephemeral: Boolean = false, builder: NexusMessageBuilder = {}, vararg embeds: EmbedBuilder): NexusMessage
Full Changelog: v1.0.0-beta.12...v1.0.0-beta.13
v1.0.0-beta.12
What's Changed
- Fixes major Express Way issues by @ShindouMihou in #15
Full Changelog: v1.0.0-beta.11...v1.0.0-beta.12
v1.0.0-beta.11
Changes
- Fixes an accident where auto-defer would always cause a defer.
Full Changelog: v1.0.0-beta.10...v1.0.0-beta.11
v1.0.0-beta.10
Changes
- Auto-cancel auto-defer task if the future completed before the auto-defer task started.
Full Changelog: v1.0.0-beta.09...v1.0.0-beta.095
v1.0.0-beta.09
What's Changed
- Adds deferred middlewares and better interceptor handling by @ShindouMihou in #13
- Adds support for auto-deferring responses by @ShindouMihou in #14
Breaking
NexusMessage
has been reformed to be more simpler and generalized by using Javacord's native interfaces.- Removed
Nexus.configuration.interceptors.autoDeferMiddlewaresAfterMilliseconds
in favor ofNexus.configuration.global.autoDeferAfterMilliseconds
Full Changelog: v1.0.0-beta.08...v1.0.0-beta.09
v1.0.0-beta.08
Full Changelog: v1.0.0-beta.07...v1.0.0-beta.08