A modular bot with the ability to update command info (name, permissions, etc.) at runtime.
The first version of leilabot relied heavily on the reflections
library to register commands, which was not optimal for startup times
and also had an implementation to handle interactions
that constructed an object... every interaction?
Command registration was also very jank at times, with each command class
containing a static block that would initialize info like name and options.
As seen by this comment
I apparently had no idea why this was a bad choice as I completely forgot how
static variables in classes work.
LBV2 still holds on to some of the design choices of its predecessor, although
with major variations in its command handler.
Each command is now registered via a JSON file that holds its command data.
On startup, it will read every JSON file and parse it into a record, where the registrar will collect the data and
register the command, constructing a new command handler with the provided data.
JSON files can be generated with the JSONGenerator, and must be put into a folder called "cmds" in the root directory of the JAR.
To build just the JAR file, all you would need to do is run the shadowJar task, ensuring you have a compatible JDK version.
.\gradlew shadowJarFor creating a full build, run the deploy task.
.\gradlew :deployBefore running, there are some files that the JAR will need before running.
- A token.txt with your application token
- A cmds folder containing your commands as .json files. (see the commands directory)
- An FFMPEG binary in the same directory as the JAR (if you have a command that requires it, like shitify)
By default, the bot does not automaticly register commands on startup, to do so you need to add the --register flag:
java -jar lbv2-vX.X.X-all.jar --registerWarning
Any commands that do not have a corresponding JSON file will not be registered.