/JCommands

Nothing really big

Primary LanguageJava

JCommands

Java library for easier use of JDA

Installation

Checkout releases and download the latest jar with all required dependencies.

Usage

Classic commands
class Main {
    public static void main(String[] args) {
        JDA jda = JDABuilder.createDefault("Your token").build();
        JApi.init(jda, "your prefix", true);
        
        new Command("commandName", (event) -> {
            event.reply("cool");
        });
    }
}
Slash commands
class Main {
    public static void main(String[] args) {
        JDA jda = JDABuilder.createDefault("Your token").build();
        JApi.init(jda, "your prefix", true);
        
        // Required
        JApi.createSlashCommandSupport(true, null);
        JApi.setTestGuildId("You test guild id");
        
        new SlashCommand("command", "description", true, (event) -> {
            event.reply("pong!");
        });
    }
}

But if you want arguments:

class Main {
    public static void main(String[] args) {
        JDA jda = JDABuilder.createDefault("Your token").build();
        JApi.init(jda, "your prefix", true);
        
        // Required
        JApi.createSlashCommandSupport(true, null);
        JApi.setTestGuildId("You test guild id");

        new SlashCommand("command", "description", true, new OptionData[]  {
                new OptionData(OptionType.STRING, "name", "description", true)
        } ,(event) -> {
            event.reply("yup");
        });
    }
}

Planned features

  1. Buttons
  2. Applications
Contacts

GamestationCZ#4663