-
Notifications
You must be signed in to change notification settings - Fork 3
Getting Started
This guide assumes you're using IntelliJ IDEA, and are familiar with Java and JVM configuration.
If you don't have Java 16 already, download the corresponding JDK. Use the free AdoptOpenJDK binaries.
./gradlew shadowJar on UNIX-like systems (e.g. Linux, macOS, *BSD)
gradlew.bat shadowJar on Windows
Chances are, you don't want to keep our package name. A good IDE will have refactoring support.
Refactor the following:
- The package name
-
mainClassin the build script -
rootProject.namein the project settings -
rollingFileNameproperty in the Log4j2 configuration
Test to make sure it builds correctly.
When running your Initium-based bot, it checks for a file named "config.toml" in the current working directory. Copy the TOML below and put it into a new file with that name.
prefix = "%"
token = "TOKEN"For maximum performance, run the bot with a command like the following:
java -Xmx1024m -Xms1024m -jar initium-all.jar
In the command package, create a new class in one of the categories and make it extend Command
In IntelliJ IDEA, press Ctrl + O, and override the execute and getDescription methods.
In getDescription, return what you'd like the help command to display for your command.
In execute, enter the following:
messageReceivedEvent.getChannel().sendMessage("Hello, world!").queue();These aren't the only methods you can override. There's quite a few other ways you can customize your command.
Return to the main class. In the method registerCommands, enter the following:
COMMANDS.put("mycommand", new MyCommand());Tweak it for your own command, of course.
The string will be what triggers it, so if your prefix is '%', you'd type "%mycommand".
You're all done! Fire up your bot to test it out.