Features • How To Use • Installation • License
A few things you can do with the library:
- Create and manage Slash Commands
- Assign callbacks to Slash Commands (supports per command path and wildcard callbacks)
- Assign callbacks to message components:
- Buttons
- Selection Menus
- Bind data to a message component:
- Raw data buffer
- Session storage
@Slash.Tag("ping_command")
@Slash.Command(
name = "ping",
description = "Check if the application is online"
)
public class PingCommand {
public static void main(String[] args) throws LoginException, InterruptedException {
final JDA jda = JDABuilder.createDefault(...)
.build()
.awaitReady(); // wait for JDA to be connected (mandatory)
final SlashClient slash = SlashClientBuilder.create(jda)
.addCommand(new PingCommand()) // register the ping command
.build();
slash.getCommand("ping_command") // get the ping command by it's @Slash.Tag
.upsertGuild(...); // upsert it as a guild Slash Command
}
@Slash.Handler()
public void callback(SlashCommandEvent event) {
event.deferReply()
.setContent("pong!")
.queue();
}
}
For more examples and usage guides, please refer to the wiki and the playground module.
This project uses Jitpack.
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.azzerial.slash-commands:api:1.1'
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.azzerial.slash-commands</groupId>
<artifactId>api</artifactId>
<version>1.1</version>
</dependency>
This project is licensed under the Apache License 2.0 © 2021 Robin Mercier.
Slash Commands by Robin Mercier • azzerial.net