https://github.com/mluizaa00/jda-framework
Annotation based JDA Command Framework.
https://github.com/mluizaa00/jda-framework
java jda jda-framework
Last synced: 9 months ago
JSON representation
Annotation based JDA Command Framework.
- Host: GitHub
- URL: https://github.com/mluizaa00/jda-framework
- Owner: mluizaa00
- Created: 2020-12-02T22:36:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-13T00:06:16.000Z (over 4 years ago)
- Last Synced: 2025-04-07T23:51:09.287Z (about 1 year ago)
- Topics: java, jda, jda-framework
- Language: Java
- Homepage:
- Size: 101 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://jitpack.io/#mluizaa00/jda-framework)
# jda-framework
Hello! Welcome to the jda-framework repository.
## Creating your first command
This framework uses the annotation **@Command** to register a command.
It can register the name, aliases, permissions and role.
Example:
````java
@Command(
name = "ping",
aliases = "pong",
permissions = Permission.ADMINISTRATOR,
role = 773622683450736672L
)
public void handlePingCommand(final Message context, final String[] args) {
final TextChannel channel = context.getTextChannel();
channel.sendMessage("Pong!").queue();
}
````
***
## Registring the CommandFrame:
After creating all your commands, the only thing you need to do is create a **CommandFrame** and set your prefix!
The CommandFrame simplifies your life! It registers all commands and catch the event when a command is used.
Example:
```java
final CommandFrame frame = AbstractCommandFrame.builder()
.addPrefixes("!", "-")
.build();
frame.loadCommands(new PingCommand());
frame.build(jda);
```
***
## MessageHolder
The MessageHolder holds the messages for errors when using a **Command** such as:
* No permission
* No role
To use it, you just need to use the method below **before** the frame.build method.
Example:
```java
frame.getMessageHolder().setMessage(MessageType.LACK_PERM_MESSAGE, "Custom message!");
```