Botrino is a Java framework that provides guidelines and a set of tools to build Discord bots in a more convenient way. Pretty much in the same spirit as Spring Boot, it allows to easily setup standalone bot applications that are ready to run, embedding a few third-party libraries such as Jackson for JSON-based configuration, RDI for a reactive IoC container, and Discord4J for the interface with the Discord Bot API.
Starting the development of a Discord bot follows most of the time the same pattern: you create a project, import your favorite Discord client library, export a configuration file or an environment variable with the bot token, and design a whole structure for your commands and your logic, before you can actually start to implement them. When working with Java, this structure is even more important otherwise you may adopt bad practices and end up with a bot that is difficult to maintain.
This is how came the idea of this project: have something that can handle for you all the initial workflow of setting up a project with a solid structure, at the only cost of letting the framework choose some libraries for you, so that you can focus on what matters. Botrino is born.
It also aims at providing a library for Discord's Interaction API that integrates well with the structure of Botrino, while still being decoupled from it.
Botrino utilizes Java modules, introduced in the JDK 9 and released in the JDK 11 as a LTS version. The classes of your application will reside in one or more modules with the following
The annotation as well as the
open modifier will allow Botrino to automatically scan through all the classes present in the module, in order to automatically register configuration entries, commands, services, etc.
Inside your module, you can create services using RDI annotations that are automatically loaded on startup:
The bot is configured via a JSON configuration file with contents similar to this:
To go further and familiarize yourself with the framework, check out the Getting Started guide.