Plugins topic
Plugins provide a structured way for code to access a uhxx client, as well as
allowing HTTP requests and Gateway events to be intercepted.
To create your own plugin, create a subclass of UhxxPlugin and specify the type of client the plugin can be used with in the type parameter. Plugins that have per-client state should override UhxxPlugin.createState and return a subclass of UhxxPluginState. The methods in UhxxPlugin and UhxxPluginState can then be overridden to execute code at various points of the client lifecycle.
Plugins can be added to clients using ClientOptions.plugins.
Uhxx 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.
-
UhxxPlugin<
ClientType extends Uhxx> Core Plugins - Provides access to the connection and closing process for implementing plugins.
-
UhxxPluginState<
ClientType extends Uhxx, PluginType extends UhxxPlugin< Core PluginsClientType> > - 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.