This wiki page is migrating to jda.wiki/introduction/jda
JDA strives to provide a clean and full wrapping of the Discord REST api and its Websocket-Events for Java.
Note: If you have any suggestions/questions/feedback for this wiki please contact Minn#6688 or DV8FromTheWorld#6297 via Discord
public class ReadyListener implements EventListener
{
public static void main(String[] args)
throws LoginException
{
JDA jda = JDABuilder.createDefault(args[0])
.addEventListeners(new ReadyListener()).build();
}
@Override
public void onEvent(GenericEvent event)
{
if(event instanceof ReadyEvent)
System.out.println("API is ready!");
}
}
public class MessageListener extends ListenerAdapter
{
public static void main(String[] args)
throws LoginException
{
JDA jda = JDABuilder.createDefault(args[0]).build();
jda.addEventListeners(new MessageListener());
}
@Override
public void onMessageReceived(MessageReceivedEvent event)
{
if (event.isFromType(ChannelType.TEXT))
{
System.out.printf("[%s][%s] %#s: %s%n", event.getGuild().getName(),
event.getChannel().getName(), event.getAuthor(), event.getMessage().getContentDisplay());
}
else
{
System.out.printf("[PM] %#s: %s%n", event.getAuthor(), event.getMessage().getContentDisplay());
}
}
}
We provide a small set of Examples in the Example Directory.
You can get the latest released builds here: Promoted Downloads
If you want the most up-to-date builds, you can get them here: Latest Build Downloads
Javadocs are available in both jar format and web format.
The jar format is available on the Promoted Downloads page or on any of the
build pages of the Downloads.
The web format allows for viewing of the Latest Docs
and also viewing of each individual build's javadoc. To view the javadoc for a specific build, you will need to go to that build's page
on the build server and download the javadoc jar for the specific build.
A shortcut would be: https://ci.dv8tion.net/job/JDA/BUILD_NUMBER_GOES_HERE, you just need to replace the
"BUILD_NUMBER_GOES_HERE" with the build you want.
Once you have the jar extract the files with the zip tool of your preference (winrar or 7zip, etc.) and open the index.html
file with your internet browser.
If you need help, or just want to talk with the JDA or other Devs, you can join the Official JDA Discord Guild.
Alternatively you can also join the Unofficial Discord API Guild.
Once you joined, you can find JDA-specific help in the #java_jda
channel.
For guides and setup help you can also take a look at the wiki
Especially interesting are the Getting Started
and Setup Pages.
If you want to contribute to JDA, make sure to base your branch off of our development branch (or a feature-branch) and create your PR into that same branch. We will be rejecting any PRs between branches or into release branches!
It is also highly recommended to get in touch with the Devs before opening Pull Requests (either through an issue or the Discord servers mentioned above).
It is very possible that your change might already be in development or you missed something.
More information can be found at the wiki page Contributing
This project requires Java 8.
For other dependencies, see README