Skip to content

Releases: ShindouMihou/Nexus

v1.0.0-alpha3.10

23 Apr 06:14
e55085c
Compare
Choose a tag to compare

This patch introduces several critical memory and computation solutions that can affect one application:

  • Indexing is now more efficient and straightforward with the new indexing methods which also aim to reduce costly indexes by referencing commands to their UUIDs instead of the actual command themselves. This should hopefully save up some memory usage.
  • A critical issue with paginators was solved where destroying the paginator does not clear up its listeners, leading to objects inside the listeners not being dereferenced.
  • A critical issue with responders was also solved where methods such as getEphemeral and get were spawning their own responders onto the repository when it's no longer needed. This is one of the major factors of memory leaks.

I recommend updating to this version ASAP to solve many of the issues that you may encounter at scale.

Indexing diagram

Nexus Indexing

v1.0.0-alpha3.09

09 Apr 18:55
f8942c4
Compare
Choose a tag to compare

This minor patch enables developers to customize the methods for synchronizing commands, in case of which that you are using a custom fork of Javacord that supports different arguments. You can refer to the following over how to implement:

To tell Nexus to use your customized methods, make sure that you add this line BEFORE ANY FORM OF SYNCHRONIZATION:

NexusSynchronizer.SYNCHRONIZE_METHODS.set(<Your Synchronize Methods Class>);

v1.0.0-alpha3.08

30 Mar 05:13
158327e
Compare
Choose a tag to compare

This patch fixes a critical CPU leak from Nexus' EngineX:

  • EngineX has been refactored to passively push the events straight to the DiscordApi if the shard manager has it non-null instead of going through a queue loop which was hugely inefficient. It will still process through a queue if there were events that were pushed before the shard was active. (tested and verified in production with https://manabot.fun with results going from 90% CPU usage stable to 2-5% CPU usage [including the bot's functions])

v1.0.0-alpha3.07

09 Mar 09:30
bdb00bd
Compare
Choose a tag to compare
v1.0.0-alpha3.07 Pre-release
Pre-release

This patch adds the following changes:

  • Add support for respondLaterAsEphemeralIf(...) on NexusCommandEvent.
  • Add support for ephemeral delay response on middlewares.

v1.0.0-alpha3.06.5

09 Mar 09:24
e6398eb
Compare
Choose a tag to compare
v1.0.0-alpha3.06.5 Pre-release
Pre-release

This patch adds two new methods for NexusCommandEvent to make the life of the developers easier:

  • Added respondLaterAsEphemeralIf(...) methods

v1.0.0-alpha3.06

09 Mar 08:12
4552c98
Compare
Choose a tag to compare
v1.0.0-alpha3.06 Pre-release
Pre-release

This patch adds the following bit improvement, fixes, and changes:

  • Added NexusConsoleLoggingAdapter which can be used for users that do not use SLF4J but still want something similar for Nexus. It is configurable from the format, date-time format, and the allowed-disallowed logging levels.
  • NexusSynchronizer should now complete exceptionally whenever a server is missing while doing upsert, delete, etc... This is somehow a case on Javacord in which the server is possibly unavailable when EngineX kicks in or when you place the wrong totalShards value.
  • To assist with fixing the above, EngineX will now delay all queued Nexus shard events such as synchronization for 2 seconds during the time the shard was added, this is to give Javacord some time to initialize the servers if possible.

How to use the Console Logging Adapter?

The console logging adapter is customizable enough for one's liking and can therefore be used, but we provide default configurations that follows Javacord's logging style with an example of the logging message being:

2022-03-09 15:57:20.493+0800 INFO Nexus You have received the message: Hello World

You can configure Nexus to use this logging adapter with a single line of code:

Nexus.setLogger(new NexusConsoleLoggingAdapter(new NexusConsoleLoggingConfiguration()));

The default configuration follows the specific configuration:

  • $_DATE $_LEVEL Nexus $_MESSAGE format
  • A default date-time format of yyyy-MM-dd HH:mm:ss.SSSZ.

Customizing Formats

You can customize the format but keep the default date-time format by creating a new instance with this:

new NexusConsoleLoggingConfiguration(
       "$_DATE $_LEVEL Nexus is Potato! $_MESSAGE"
)

This will create a configuration that has the following:

  • $_DATE $_LEVEL Nexus is Potato! $_MESSAGE format which translates into 2022-03-09 15:57:20.493+0800 INFO Nexus is Potato! You have received the message: Hello World.
  • A default date-time format of yyyy-MM-dd HH:mm:ss.SSSZ.

You can customize the date-time format but keep the default logging format by creating a new instance with this:

new NexusConsoleLoggingConfiguration(
       DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSZ")
)

You can also customize both of them at the same time if you wish by creating a new instance like this:

new NexusConsoleLoggingConfiguration(
       "$_DATE $_LEVEL Nexus is Potato! $_MESSAGE",
       DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSZ")
)

You can disable date-time formatting by either not including $_DATE in the format or by setting the date-time format as null.

Customizing Logging Levels

If you want to enable DEBUG logging level then you can use the method:

new NexusConsoleLoggingConfiguration().allow(NexusConsoleLoggingLevel.DEBUG);

If you want to prevent the logging of a specific level, for instance, INFO then you can use the method:

new NexusConsoleLoggingConfiguration().disallow(NexusConsoleLoggingLevel.INFO);

If you want to set specific logging levels without using disallow everytime then you can use this method:

new NexusConsoleLoggingConfiguration().set(NexusConsoleLoggingLevel.ERROR, NexusConsoleLoggingLevel.WARN);

1.0.0-alpha3.05

06 Mar 10:42
70312af
Compare
Choose a tag to compare
1.0.0-alpha3.05 Pre-release
Pre-release

This patch introduces a lot of breaking changes, major improvements, and fixes in the areas of:

  • Middlewares
  • User, Roles, Permissions Command Authentication
  • Commands

🍶 Changes

  • Introduced support for shared fields which can be used to store data in commands that are shared towards middleware and afterwares, especially handy for middleware or afterware that requires data in the command itself such as cooldown middleware and so forth. You can view examples of this in action with the new command authentication middleware and also the examples.
  • Pre-built authentication functionality has been removed in favor of the new new command authentication middleware which allows users to create their own authentication middleware to override the default behavior.
  • Uncaught exceptions that are thrown during middleware or afterwares execution is now printed to console.
  • Added NexusInterceptorRepository to replace static method addition of middleware and afterwares.
  • Added unit tests for command generation to ensure that all the commands are generated properly after a new change.

📦 Migrating to alpha-3.0.5

The breaking change of alpha-3.0.5 lies in the removal of the half-baked, built-in authentication methods which are improved upon and made non-mandatory like the ratelimiters. If you are using these authentication methods then all you have to do is make the fields shared using the @Share annotation then add the middleware: NexusCommonInterceptors.NEXUS_AUTH_<TYPE>_MIDDLEWARE with <TYPE> being what authentication method you were using. An example would be:

Before

private final List<Long> requiredUsers = List.of(...);

After

@Share private final List<Long> requiredUsers = List.of(...)
private final List<String> middleware = List.of(NexusCommonInterceptors.NEXUS_AUTH_PERMISSIONS_MIDDLEWARE, ...);

Fix interceptors not found

05 Mar 07:03
b904373
Compare
Choose a tag to compare
Pre-release

This patch fixes an issue where common interceptors weren't being added because the static method was not being called by Java since there were no main methods or similar triggering the class to function.

Fix private common interceptors

05 Mar 06:35
0b2e166
Compare
Choose a tag to compare
Pre-release

This patch fixes a known issue where some common interceptors that should be a public static were made into a private static.

Ratelimit Middleware

05 Mar 06:27
e7f9e70
Compare
Choose a tag to compare
Ratelimit Middleware Pre-release
Pre-release

Ratelimit Middleware Patch

This patch introduces a new standard and also fixes a known issue with the previous rate-limiter implementation which doesn't take middleware into consideration, this newer standard makes rate-limiters as a middleware to fully utilize the middleware functionality and also to allow developers to create their own rate-limiters with the data available.

The cooldown field is kept for several reasons:

  • It is still used by the middleware itself.
  • It can be used by developers to introduce their own middleware for rate-limiting.

How to add the default rate-limiter as a middleware?

Adding the rate-limiter middleware is simple and easy, all you need is to have a Nexus instance or even just create a new instance of the NexusRatelimiter yourself but we recommend using the Nexus instance's own rate limiter middleware which can be added to your command by adding this as a middleware:

NexusCommonInterceptors.NEXUS_RATELIMITER

You can add it to a command by adding this field in your command class:

List<String> middlewares = List.of(NexusCommonInterceptors.NEXUS_RATELIMITER, ...);

You can also add it as a global middleware by using the Nexus instance's addGlobalMiddleware function:

Nexus nexus = ...
nexus.addGlobalMiddleware(NexusCommonInterceptors.NEXUS_RATELIMITER);