API
ServerAssistantAI provides a powerful API for developers to integrate the AI assistant's functionality into their own plugins or applications, as well as create Addons for ServerAssistantAI.
Last updated
ServerAssistantAI provides a powerful API for developers to integrate the AI assistant's functionality into their own plugins or applications, as well as create Addons for ServerAssistantAI.
Last updated
The API is subject to change in future versions as we improve ServerAssistantAI and may result in breakages. You can join our discord server to make sure you're notified when a breaking change is done/will be done to ServerAssistantAI, so you can update your addons accordingly.
Please check the links to ensure you are working with the desired version. The badges below display the latest versions.
To integrate with the ServerAssistantAI API, simply add the necessary repository and dependency to your build configuration. For Maven users, update your pom.xml
file, and for Gradle users, modify your build.gradle
/build.gradle.kts
file.
Replace VERSION
with the API version you would like. The badges above display the latest versions available.
Additionally, ServerAssistantAI should load before your plugin by specifying this in the plugin.yml
:
softdepend: [ServerAssistantAI]
ServerAssistantAI's API is public and accessible to all developers, even if they haven't purchased the plugin. As long as you obtain the plugin's JAR file legally, such as receiving it from someone for testing purposes, you can receive support for our API. However, using pirated or illegally obtained versions of ServerAssistantAI will not be eligible for support.
ServerAssistantAI API includes four events that can be used to interact with the AI assistant's functionality and customize its behavior.
The PreDiscordHandleEvent is fired before the bot handles a question on Discord.
This allows you to cancel the event, preventing the bot from responding to the message or sending typing indicators. You can also access the user, message, event, and history associated with the question.
The PostDiscordHandleEvent is fired after the bot has finished handling a question on Discord.
This event provides access to the user, message, event, history, reply message, response, response text, and information used to generate the response. It allows you to perform custom actions or logging based on the bot's response.
The PreMinecraftHandleEvent is fired before the bot handles an in-game question, either through chat or the /serverassistantai ask
command.
This event allows you to cancel the question-handling process, preventing the bot from responding to the player's message. You can access the player, message, and whether the question was forced.
The PostMinecraftHandleEvent is fired after the bot has finished handling an in-game question.
This event provides access to the player, message, whether the question was forced, response, response text, whether the response was private, and information used to generate the response. It allows you to perform custom actions or logging based on the bot's interaction with the player.