This is a small bot intended for use on the Together Java discord server.
We will see whether it evolves, but it will likely only handle smaller tasks for now.
- JDA
- Discord API
- TOML4J
- A Java implementation of the TOML config language
- Brigardier
- Mojang's Minecraft command parser
- Logback and SLF4J
- Logging
- Maven
- Build system
Some day Junit5 might join that list…
You are welcome to raise issues or suggestions in the issue tracker here. PRs are welcome too :)
- You should probably clone this repository via
git clone https://github.com/I-Al-Istannen/TogetherJavaBot.git
- Enter the cloned directory and set up your IDE of choice
- Copy the default bot config found in
src/main/resources
to another place and edit it to your heart's content. If you copy it to a file calledrealized.toml
in the root of this project it is already covered by an ignore rule.- Edit the run configuration for the
ApplicationEntry
class to add an environment variable calledTJ_CONFIG_PATH
which contains the path to the config file. - OR pass the path to the config as the first command line argument
- Edit the run configuration for the
- Set your bot token in the config
- Run the
org.togetherjava.ApplicationEntry
class
This project uses Maven
as its build system.
You can generate a jar file by running mvn clean package
while inside the root of the project.
The jar file can then be found in the target
folder.
- Make a new class in the
org.togetherjava.command.commands
package. All classes in that package are automatically registered at runtime. - Make sure the class has a constructor that takes no arguments or takes a single
Toml
instance (the bot config). - Implement the mandated method:
public LiteralCommandNode<CommandSource> getCommand(CommandDispatcher<CommandSource> dispatcher) {
- Build your command in there. Here is the echo command, which might serve as an example:
@Override public LiteralCommandNode<CommandSource> getCommand(CommandDispatcher<CommandSource> dispatcher) { return CommandGenericHelper.literal("echo") .then( CommandGenericHelper.argument("message", StringArgumentType.greedyString()) .executes(context -> { CommandSource source = context.getSource(); String argument = context.getArgument("message", String.class); source.getMessageSender() .sendMessage(SimpleMessage.information(argument), source.getChannel()); return 0; }) ) .build(); }
- For more information on adding commands, refer to the documentation for Brigardier or ask :)
- Role assignment via reactions
- Rep? Maybe give/remove via a given emoji?