-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Create your bot discord more easily with Modulo. Allows you to add features easily with modules. You can see it as a minecraft server with plugins. Modulo will load the modules you added in the modules folder.
./gradlew clean shadowJar-
PROJECT_VERSION- the version of the project - default:develop -
USERNAME- the maven user - default: `` -
TOKEN- the maven pass - default: `` -
REPO_URL- the maven repo - default: ``
This will build the project.
To publish the jar on the maven repo, you need to set the environment variables.
./gradlew clean build publishTo publish the docker image, you need to login to docker hub.
echo yourPassword | docker login -u yourUsername --password-stdinAnd then you can publish the docker image.
./gradlew clean shadowJar dockerPushDockerHub<repository>
<url>"https://maven.pkg.github.com/aytronnn/Modulo"</url>
</repository>- Artifact Information:
<dependency>
<groupId>fr.aytronn</groupId>
<artifactId>modulo-api</artifactId>
<version>latest</version>
</dependency>Or alternatively, with Gradle:
- Repository:
repositories {
maven {
url = uri("https://maven.pkg.github.com/aytronnn/Modulo")
}
}
dependencies {
compileOnly("fr.aytronn:modulo-api:latest")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(19))
}You will need to install docker and docker-compose.
You can launch the bot with a docker compose. By creating a docker-compose.yml file and filling it like this:
version: '3'
services:
app:
container_name: Modulo
image: aytronn/modulo:latest
build: .
ports:
- "8080:8080"
environment:
- BOT_TOKEN=YourToken
volumes:
- ./Module:/home/app/ModuloCore/modules/Then you create a Module folder.

And in this folder you put your modules.

To launch the bot you return in the folder where there is the file docker-compose.yml and you make:
docker-compose up -dYou will have to pull the project.
git clone https://github.com/aytronnn/Modulo.gitThen the build with gradle.
./gradlew clean shadowJarThen you go to the build/libs folder and launch the jar.
And you copy the .jar file to a folder.

Then you will have to create a start.sh file and fill it like this:
#!/bin/bash
while true; do
java -jar ModuloCore.jar
echo "Restarting app in 5s..."
sleep 5s
doneNow you should have a file like this:

You can now launch the bot with the command:
./start.shIf you have this error:

Your java version is not the right one. You must have version 19 of java.
Once launched you should have this error:

This is normal you should also have created a ModuloCore folder and in this folder a configuration.json file like this:
{
"mongoUri": "",
"botToken": ""
}You will have to fill in the botToken field with your bot token. And if you need to use the database you will have to fill in the mongoUri field with your mongo uri.
Now you can launch the bot with the command:
./start.shAnd that's it, the bot is launched. You can now create your modules. And put them in the modules folder which is in the ModuloCore folder.
public class Example extends IModule {
private static Example instance;
private Config config;
private TorrentManager torrentManager;
@Override
public void onEnable() {
instance = this;
getLogger().info("Starting Example...");
registerListeners();
registerCommands();
}
public void registerListeners() {
registerListener(new ExampleListener());
}
public void registerCommands() {
registerCommand(new ExampleCommand());
}
public static PlexFTH getInstance() {
return instance;
}
}
public class ExampleCommand {
@Command(name = "plexfth.clear", subCommand = {"nbMessage"}, subCommandType = {SlashCommandOptionType.DECIMAL}, description = "Clear the channel")
public void clearCommand(CommandArgs arg) {
//Do some code for clear the channel
//Mandatory to respond to the command
arg.getCommandInteraction().createImmediateResponder()
.setContent("Clear command")
.setFlags(MessageFlag.EPHEMERAL)
.respond();
}
}public class ExampleListener implements MessageCreateListener {
@Override
public void onMessageCreate(MessageCreateEvent event) {
event.getChannel().sendMessage("Thank you for message! <@" + event.getMessageAuthor().getIdAsString() + ">");
}
}For more information, see the wiki of Javacord this is the api I use to make the CoreBot. For the module loader the code comes from @HookWoods