This library aims to provide a typed wrapper for creating Application Commands and Message Components using extendable class structures.
Add the Jitpack repository to your build file
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Release artifact
<dependency>
<groupId>com.github.zrdj</groupId>
<artifactId>javachord</artifactId>
<version>3.8.0.14</version>
</dependency>
As this library is tied directly to Javacord, packages will be released based on
the version of Javacord and extended by an additional build version, which will
only indicate that something in this library has changed.
So for the version 3.8.0
of Javacord, this library will be released in
version 3.8.0.X
. This library will always release a matching version
of Javacord, even if there are no changes to this libraries code.
Make sure you register the current DiscordApi with Javachord by using Javachord.Instance.Get.register()
method as in
the example below
...
private DiscordApi _discord;
private final String _token = System.getProperty("token");
private final long _serverId = Long.parseLong(System.getProperty("serverId"));
public void start() {
_discord = new DiscordApiBuilder()
.setToken(_token)
.setIntents(
Intent.GUILDS
, Intent.GUILD_MEMBERS
, Intent.GUILD_MESSAGES
, Intent.GUILD_BANS
, Intent.GUILD_INVITES
, Intent.GUILD_PRESENCES
, Intent.MESSAGE_CONTENT
)
.login()
.join()
;
var server = _discord.getServerById(_serverId).get();
Javachord.Instance.Get.register(_discord, server);
System.out.printf("Discord bot successfully initialized with ID %s%n", _discord.getYourself().getIdAsString());
}
...
Javachord components will register themselves globally as soon as they get created.