Matt's Framework - JDA

Annotation command framework for JDA.

License

License

GroupId

GroupId

me.mattstudios.utils
ArtifactId

ArtifactId

matt-framework-jda
Last Version

Last Version

1.1.14-BETA
Release Date

Release Date

Type

Type

jar
Description

Description

Matt's Framework - JDA
Annotation command framework for JDA.
Project URL

Project URL

https://github.com/ipsk/MattFramework
Source Code Management

Source Code Management

http://github.com/ipsk/MattFrameworkJDA

Download matt-framework-jda

How to add to project

<!-- https://jarcasting.com/artifacts/me.mattstudios.utils/matt-framework-jda/ -->
<dependency>
    <groupId>me.mattstudios.utils</groupId>
    <artifactId>matt-framework-jda</artifactId>
    <version>1.1.14-BETA</version>
</dependency>
// https://jarcasting.com/artifacts/me.mattstudios.utils/matt-framework-jda/
implementation 'me.mattstudios.utils:matt-framework-jda:1.1.14-BETA'
// https://jarcasting.com/artifacts/me.mattstudios.utils/matt-framework-jda/
implementation ("me.mattstudios.utils:matt-framework-jda:1.1.14-BETA")
'me.mattstudios.utils:matt-framework-jda:jar:1.1.14-BETA'
<dependency org="me.mattstudios.utils" name="matt-framework-jda" rev="1.1.14-BETA">
  <artifact name="matt-framework-jda" type="jar" />
</dependency>
@Grapes(
@Grab(group='me.mattstudios.utils', module='matt-framework-jda', version='1.1.14-BETA')
)
libraryDependencies += "me.mattstudios.utils" % "matt-framework-jda" % "1.1.14-BETA"
[me.mattstudios.utils/matt-framework-jda "1.1.14-BETA"]

Dependencies

compile (1)

Group / Artifact Type Version
com.google.guava : guava jar 29.0-jre

provided (1)

Group / Artifact Type Version
net.dv8tion : JDA jar 4.1.1_148

Project Modules

There are no modules declared in this project.

Matt's Framework for JDA

This Framework is very similar to Matt's Framework for Spigot, though it is for creating Discord Bot commands rather than Plugin commands.

Be aware that this is still a W.I.P, pull requests and suggestions are very welcome

Dependency

The dependency is on Maven Central, Maven Central

Be sure to replace VERSION with the current version found on the maven repository

Maven:

<dependency>
    <groupId>me.mattstudios.utils</groupId>
    <artifactId>matt-framework-jda</artifactId>
    <version>VERSION</version>
</dependency>

Gradle:

dependencies {
    implementation "me.mattstudios.utils:matt-framework-jda:VERSION"
}

Usage

Creating commands

Creating a command can be done by making a class that extends CommandBase and annotating it with @Command

Example !ping command:

@Prefix("!")
@Command("ping")
public class PingCommand extends CommandBase {
    
    @Default
    public void defaultCommand() {
        TextChannel channel = message.textChannel;
        channel.sendMessage("Pong!").queue();
    }
}

Registering the command

Registering commands can be done by first creating a JDA instance, then passing that instance to an instance of CommandManager, then calling the register() method to register a command.

Example command registry:

public class Main {

    public static void main(String[] args) {
        JDA jda = JDABuilder.create("my_bot_token", Arrays.asList(GatewayIntent.EXAMPLE))
                            .build();
        CommandManager commandManager = new CommandManager(jda);
        commandManager.register(PingCommand());
    }
}

You can also optionally provide a global prefix to the CommandManager by using the CommandManager(JDA jda, String globalPrefix) constructor

Example global prefix:

CommandManager commandManager = new CommandManager(jda, "!");

Versions

Version
1.1.14-BETA
1.1.13-BETA
1.1.12-BETA
1.1.11-BETA
1.1.10-BETA
1.1.9-BETA
1.1.8-BETA
1.1.7-BETA
1.1.6-BETA
1.1.5-BETA
1.1.4-BETA
1.1.3-BETA
1.1.2-BETA
1.1.1-BETA
1.1-BETA
1.0-BETA