OrdinalBot-API

forthebadge Discord GitHub last commit GitHub commit activity the past week, 4 weeks

Overview

OrdinalBot-API is a framework similar to Spigot, designed to enable the creation of plugins for Discord bots.

Version

Current Version: 0.1.0

Features

  • Create custom modules for your Bot.
  • Simplified API similar to Spigot.
  • Create customs / commands and use JDAListener

Getting Started

Installation

  1. Download the library from the releases page and place it in the libs directory of your project.
  2. Add the library to your local dependency manager.

Gradle

Add the following to your build.gradle:

repositories {
    mavenCentral()
}

dependencies {
    implementation(fileTree("/libs"))
}

Maven

Add the following to your pom.xml:

<repositories>
    <repository>
        <id>libs-release</id>
        <url>file://${project.basedir}/libs</url>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.ordinalteam</groupId>
        <artifactId>OrdinalBot-API</artifactId>
        <version>0.1.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/libs/OrdinalBot-API-0.1.0.jar</systemPath>
    </dependency>
</dependencies>

Usage

Create a plugin.json in your resources directory:

{
  "name": "Module Test",
  "main": "fr.ordinalteam.moduletest.Main",
  "version": "1.0.0",
  "author": "Arinonia"
}

Implement your main class:

public class Main extends Plugin {

    @Override
    public void onEnable() {
        this.logger.log("Registering test module");
    }
}

Register commands and listeners:

public class Main extends Plugin {

    @Override
    public void onEnable() {
        this.logger.log("Registering test module");
        this.getJDAListenerManager().registerJDAListener(new YourListenerAdapter());
        this.getCommandRegistry().registerCommand(new YourCommand(), this);
    }
}

public class YourListenerAdapter extends ListenerAdapter {
    // Your listeners
}

public class YourCommand extends Command {
    public YourCommand() {
        super("test", "!test <@user> to tag user");
    }

    @Override
    public void onCommand(final SlashCommandInteractionEvent event) {
        // Command logic
    }
}

Contributing

Feel free to submit issues and pull requests. For suggestions and discussions, join our Discord server.

License

This project is licensed under the GPLv3 License - see the LICENSE file for details.

Contact

For more information, visit our Website.