Releases: comroid-git/CrystalShard
1.0.0-SNAPSHOT:1
preV1 lol snapshot
0.10 Untested PreRelease
Merge pull request #39 from burdoto/gradle-adjust Update build.gradle
Modular Release (Untested)
0.9.1 Adjustments
Testing Version: 0.9 - Listeners and message modifying methods working.
This release is currently not working. A working release will be posted soon.
The library currently cannot be implemented using Gradle or Maven! You have to use the JAR File.
The JAR file contains the Library + all dependencies.
Included Gradle dependencies are:
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.3'
implementation 'com.vdurmont:emoji-java:4.0.0'
Logging in to discord is as simple as 2 or 3 chained methods:
Discord discord = new DiscordLoginTool()
.setToken(args[0])
.login();
Currently the MultiShardHelper
class is not functioning at all.
Listeners can be attached to everything that has the #attachListener(C extends XyzAttachableListener
method, where you can then attach a listener that extends the XyzAttachableListener
interface.
All listeners are grouped in the following attaching groups:
- DiscordAttachableListener
- ServerAttachableListener
- ChannelAttachableListener
- RoleAttachableListener
- UserAttachableListener
- MessageAttachableListener
Attaching a listener is achieved by casting the listener lambda to the listener type, like this:
discord.attachListener((ReactionAddListener) event -> {
System.out.println("Reaction added:");
System.out.println(event.getUser());
System.out.println(event.getReaction().toString());
});
Most implemented listeners should already be firing.
The firing of listeners has high testing priority, especially the Edit-/Update-listeners!
The included logging framework can be set up either by calling static methods before init:
Logger.setLevel(LoggingLevel.TRACE);
Logger.setSuffix("{%r}");
Logger.setPrefix("[%l]\t%t - %s:");
or by creating a logging.json
file at resources root.
Logging of future exceptions can be achieved in a static and in a non static way.
// Static logging of exceptions:
channel.sendMessage("Hello world!")
.exceptionally(Logger::get);
try {
new URL("foo");
} catch (MalformedURLException e) {
Logger.get(e);
}
// Non-Static logging of exceptions:
Logger log = new Logger(Test.class);
channel.sendMessage("Hello world!")
.exceptionally(log::exception);
try {
new URL("foo");
} catch (MalformedURLException e) {
log.exception(e, "A URL was malformed!");
}
This release also contains a non-tested command framework.
You can create commands with the @Command
annotation.
@Command(aliases = "foo", enablePrivateChat = false)
public static void foo(TextChannel channel) {
channel.sendMessage("bar");
}
Commands are then registered like this:
CommandFramework commandFramework = discord.getUtilities().getCommandFramework();
commandFramework.registerCommands(Test.class); // Register a whole class. Only @Command annotated methods will be used.
commandFramework.registerCommands(Test.class.getMethod("foo", TextChannel.class)); // Register only a method.
Command methods must me static.
The parameters of a @Command
method should be flexible, as documented in the @Command
annotation.
First Preview Version: 0.8.1 - Working MessageCreateListener and ChannelCreateListener!
Merge pull request #15 from CrystalShardDiscord/development Development
InDev Release: 0.8
We are currently at PreRelease 0.8.
It is currently possible to send Messages with all information and recieve new messages.
The code for more is there, there is just not all Handlers yet.
At commit 84cf10c
The CrystalShard-Full.jar is the full package of CrystalShard, WITHOUT dependencies.
The CrystalShard-Dependencies.jar contains all dependencies. (Jackson, vdurmont's Emoji Library)