gitmyhub

JDA

Java ★ 4.7k updated 3d ago

Java wrapper for the popular chat & VOIP service: Discord https://discord.com

A Java library for building Discord bots that handles the platform's real-time events, API rate limits, and caching automatically, so you can focus on writing bot logic in plain Java or Kotlin.

JavaKotlinMavenJitPacksetup: moderatecomplexity 3/5

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.

Where it fits