Giter VIP home page Giter VIP logo

jda-commands's Introduction

Generic badge Codacy Badge license-shield

JDA-Commands

A simple yet highly customizable, annotation driven command framework for JDA.

Features

The focus of this framework is strongly oriented towards the reduction of boilerplate code. This goes along with the aim to reduce configuration steps that are needed before startup. Therefore IoC, Dependency Injection and Declarative Programming are the key concepts of this framework. Nevertheless, there is a high level of customization, if wanted, every part of this framework can be replaced by an own implementation.

The core features of this framework are as following:

  • Fully annotation driven command declaration
  • Argument Parsing based on method signature
  • Label shortening (comparable to auto complete)
  • Basic implementation of Dependency Injection
  • Automatic error resolving
  • Automatically generated Help Commands & Error Messages
  • Command modification at runtime
  • Many settings such as Guild specific prefixes

Example

The following example will demonstrate how easy it is to write a command:

@CommandController
public class GreetCommand {

    @Command("greet")
    public void greet(CommandEvent event, Member member) {
        event.reply("Hello %s!", member.getAsMention());
    }

}

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

Download

You can download the latest version here.

Repository

JDA-Commands is hosted by GitHub Packages, because of this you need to declare a new maven repository to search in. In this configuration you will have to set USERNAME and TOKEN as environment variables on the machine you build on.

Gradle

Paste this into your repositories {}:

    maven {
        name = "jda-commands"
        url = uri("https://maven.pkg.github.com/kaktushose/jda-commands")
        credentials {
            username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
            password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
        }
    }

Maven

Whereas in this example you have to paste USERNAME and TOKEN directly in the code.

  <activeProfiles>
    <activeProfile>github</activeProfile>
  </activeProfiles>

  <profiles>
    <profile>
      <id>github</id>
      <repositories>
        <repository>
          <id>github</id>
          <name>GitHub Packages Kaktushose jda-commands</name>
          <url>https://maven.pkg.github.com/kaktushose/jda-commands</url>
        </repository>
      </repositories>
    </profile>
  </profiles>

  <servers>
    <server>
      <id>github</id>
      <username>USERNAME</username>
      <password>TOKEN</password>
    </server>
  </servers>
</settings>

Use as dependency

Maven

<dependency>
  <groupId>com.github.kaktushose</groupId>
  <artifactId>jda-commands</artifactId>
  <version>1.0.0</version>
</dependency>

Gradle

implementation 'com.github.kaktushose:jda-commands:1.0.0'

Contributing

If you think that something is missing and you want to add it yourself, feel free to open a pull request. Please try to keep your code quality as good as mine and stick to the core concepts of this framework.

Dependencies

The following dependencies were used to build this framework:

  • JDA
  • Reflections
  • Jackson
  • slf4j-api

jda-commands's People

Contributors

kaktushose avatar oleggtro 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.