Skip to content

Kaktushose/jda-commands

Repository files navigation

JDA-Version Generic badge Java CI Release Deployment Codacy Badge license-shield

JDA-Commands

A lightweight, easy-to-use command framework for building Discord bots with JDA with full support for interactions. JDA-Commands goal is to remove any boilerplate code, so you can focus solely on the business logic of your bot - writing bots has never been easier!

Features

  • Simple and intuitive syntax following an annotation-driven and declarative style

  • Built-in support for slash commands, components, context menus and modals

  • Automatic and customizable type adapting and constraint validation of parameters

  • Expandable executing chain (Middleware API)

  • Multithreaded event handling using VirtualThreads

If you want to learn more, go check out the Wiki or the Javadocs.

Example

@Interaction
public class CookieClicker {

    private int count;

    @Command(value = "cookie clicker", desc = "Play cookie clicker")
    public void onClicker(CommandEvent event) {
        event.with().components("onCookie", "onReset").reply("You've got %s cookie(s)!", count);
    }

    @Button(value = "Collect", emoji = "🍪", style = ButtonStyle.SUCCESS)
    public void onCookie(ComponentEvent event) {
        count++;
        event.reply("You've got %s cookie(s)!", count);
    }

    @Button(value = "Reset", emoji = "🔄", style = ButtonStyle.DANGER)
    public void onReset(ComponentEvent event) {
        count = 0;
        event.reply("You've got %s cookie(s)!", count);
    }
}

Download

You can download the latest version here.

Maven

<dependency>
   <groupId>io.github.kaktushose</groupId>
   <artifactId>jda-commands</artifactId>
   <version>4.0.0-beta.5</version>
</dependency>

Gradle

repositories {
   mavenCentral()
}
dependencies {
   implementation("io.github.kaktushose:jda-commands:4.0.0-beta.5")
}

Contributing

If you think that something is missing, and you want to add it yourself, feel free to open a pull request. Please consider opening an issue first, so we can discuss if your changes fit to the framework. Also check out the project board to see what we already planned for future releases.

Special thanks to all contributors, especially to @Goldmensch and @lus <3

Contributors Display