Build a Discord bot in Java that listens for slash commands and responds to messages in a server.
Create a moderation bot that reacts to user events like joins, message edits, or voice channel activity.
Add Discord notifications to a Java application by sending messages through a bot using JDA's API wrapper.
Requires creating a Discord Application and obtaining a bot token from the Discord developer portal before you can run any code.
JDA, short for Java Discord API, is a Java library for building bots on Discord. It connects your Java application to Discord's real-time systems and REST API, so you can write code that reacts to messages, commands, voice events, and other platform activity. The library is open source and available through the standard Java package repositories Maven Central and JitPack. The library is built around three ideas. First, an event system: your bot registers listeners, and JDA calls them whenever something happens on Discord, such as a message being posted or a user joining a voice channel. Second, a set of tools for calling Discord's API: these handle the rate limits Discord imposes automatically, and they give you the choice of handling responses with callbacks, futures, or blocking calls. Third, a configurable cache that lets you trade memory usage for performance depending on the size and needs of your bot. To get started, you create a Discord Application in the developer dashboard, obtain a bot token, and then use JDA's builder classes to configure and launch your bot. JDA provides two builders: one for smaller bots running on a single connection and one for larger bots that need to split their load across multiple connections. The README includes working code examples for a message-logging bot and a slash-command bot, showing how both approaches look in practice. The minimum Java version required is Java 8. The library also works with Kotlin without extra configuration. Audio support in bots requires an additional dependency that handles the DAVE Protocol, which Discord uses for voice encryption. Full documentation, a wiki, and an FAQ are available on jda.wiki, and there is a Discord server for community support.
← discord-jda on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.