Plugins topic

Plugins provide a structured way for code to access a nyxx client, as well as allowing HTTP requests and Gateway events to be intercepted.

To create your own plugin, create a subclass of NyxxPlugin and specify the type of client the plugin can be used with in the type parameter. Plugins that have per-client state should override NyxxPlugin.createState and return a subclass of NyxxPluginState. The methods in NyxxPlugin and NyxxPluginState can then be overridden to execute code at various points of the client lifecycle.

Plugins can be added to clients using ClientOptions.plugins.

Nyxx also comes with some prebuilt plugins.

Classes

CliIntegration Plugins
A plugin that lets clients close their session gracefully when the process is terminated.
IgnoreExceptions Plugins
A plugin that prevents errors from crashing the program, instead logging them to the console.
Logging Plugins
A plugin that outputs a client's logs to stdout and stderr.
NyxxPlugin<ClientType extends Nyxx> Core Plugins
Provides access to the connection and closing process for implementing plugins.
NyxxPluginState<ClientType extends Nyxx, PluginType extends NyxxPlugin<ClientType>> Core Plugins
Holds the state of a plugin added to a client.

Properties

cliIntegration CliIntegration Plugins
A global instance of the CliIntegration plugin.
final
ignoreExceptions IgnoreExceptions Plugins
A global instance of the IgnoreExceptions plugin.
final
logging Logging Plugins
A global instance of the Logging plugin.
final

Exceptions / Errors

PluginError Plugins
An error thrown when an issue with a client's plugin is encountered.