Git Product home page Git Product logo

jda.command.api's Introduction

JDA Command API

Do you code discord bot with JDA? This is the perfect command API for you!

Where to find

You can find the Command API at src/main/java/xyz/damt/commands/Command.java

Credits

This API was created by damt.

Telegram -> https://t.me/therealdamt

Rights

Any user has full rights to resell bots using this API, and using it. However, the user may not claim this API as his own.

Registering

public class Bot { //The class "Bot" must be your main class!

    private final JDA jda;

    @SneakyThrows
    public Bot() {
        jda = JDABuilder.createDefault("your token").build();

        Arrays.asList(
                new TestCommand()
        ).forEach(command -> command.register(jda, true)); //You can do it like this or you can 
                                                           //identify each command and register 
                                                           //it seperately
    }

    public static void main(String[] args) {
        new Bot();
    }

Example Method

public class TestCommand extends Command {

    public TestCommand() {
        super("test", Permission.ADMINISTRATOR, "test test");

        this.isMemberOnly = true; //sets if the command is member only
        this.prefix = "-"; //the default prefix is "-" you can change in here or in Command.java
    }

    @Override
    public void execute(Member member, Message message, Guild guild, TextChannel channel, String[] args) {
        if (member.getUser().isBot() || member.getUser().isFake()) return;

        if (args.length != 1) {
            channel.sendMessage(getUsage()).queue();
            return;
        }

        if (args[0].isEmpty() || !args[0].equalsIgnoreCase("test")) {
            channel.sendMessage("Invalid Value").queue();
            return;
        }

        channel.sendMessage("Passed").queue();
    }

jda.command.api's People

Contributors

therealdamt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.