JDA
This page describes how to integrate Lamp with JDA's slash commands, as well as what to expect out of it.
Setting up
Adding Lamp dependency
To add Lamp to your project, add the following (depending on your project structure):
<dependencies>
<!-- Required for all platforms -->
<dependency>
<groupId>io.github.revxrsal</groupId>
<artifactId>lamp.common</artifactId>
<version>[VERSION]</version>
</dependency>
<!-- JDA module -->
<dependency>
<groupId>io.github.revxrsal</groupId>
<artifactId>lamp.jda</artifactId>
<version>[VERSION]</version>
</dependency>
</dependencies>dependencies {
// Required for all platforms
implementation 'io.github.revxrsal:lamp.common:[VERSION]'
// JDA module
implementation 'io.github.revxrsal:lamp.jda:[VERSION]'
}Latest version:
Optional: Preserve parameter names
Lamp identifies parameters by their names and uses them to generate relevant command metadata. By default, Java does not preserve parameter names reflectively. You need to add the following to your project:
JDA-specific annotations
@Choices
@ChoicesDefines up to 25 predefined choices for the parameter. The user can only provide one of the choices and cannot specify any other value.
@CommandPermission
@CommandPermissionAnnotation for specifying the required Permissions for JDA slash commands
@GuildOnly
@GuildOnlyMarks a command as executable in guilds only.
@NSFW
@NSFWMarks a command as NSFW
Supported JDA types
SlashCommandInteractionEventand its subclasses in place of CommandActorUserand its subclasses in place of CommandActorMemberand its subclasses in place of CommandActorMessageChanneland its subclasses in place of CommandActorRoleUserMemberTextChannelVoiceChannelStageChannelNewsChannelThreadChannelScheduledEventCategoryEmoji
Example
Example: /ban command

Which will also do client-side range validation:

Last updated
Was this helpful?