Matt's Framework - JDA

Annotation command framework for JDA.

Лицензия

Лицензия

Группа

Группа

me.mattstudios.utils
Идентификатор

Идентификатор

matt-framework-jda
Последняя версия

Последняя версия

1.1.14-BETA
Дата

Дата

Тип

Тип

jar
Описание

Описание

Matt's Framework - JDA
Annotation command framework for JDA.
Ссылка на сайт

Ссылка на сайт

https://github.com/ipsk/MattFramework
Система контроля версий

Система контроля версий

http://github.com/ipsk/MattFrameworkJDA

Скачать matt-framework-jda

Как подключить последнюю версию

<!-- 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"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.google.guava : guava jar 29.0-jre

provided (1)

Идентификатор библиотеки Тип Версия
net.dv8tion : JDA jar 4.1.1_148

Модули Проекта

Данный проект не имеет модулей.

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, "!");

Версии библиотеки

Версия
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