Library for Discord bots using the gateway and REST API. Offers events, REST actions with rate-limit handling, and configurable caching.
Overview
JDA (Java Discord API) is an open-source library for building bots on Discord. It connects to the real-time gateway and REST API so applications can react to platform events and call Discord endpoints from Java or Kotlin.
An event system maps gateway activity into listener callbacks. REST work goes through lazy RestAction builders that support queues, futures, blocking calls, combinators, and timeouts. The library applies Discord rate limits automatically while still allowing custom handling.
Caching is tunable through presets such as default, light, and full member caching, alongside gateway intents that control which events arrive. Builders include JDABuilder for smaller bots and DefaultShardManagerBuilder for sharded deployments across many guilds.
Common patterns include logging messages, handling slash commands and interactions, and chaining API calls without nested callbacks. Optional extensions cover Kotlin idioms, audio playback through Lavaplayer or Lavalink, and related UDP send helpers. Distribution is through Maven Central with a documented minimum Java runtime.
Key features
- Gateway event listeners
- REST request builders
- Automatic rate-limit handling
- Configurable cache presets
- Shard manager for large bots
- Slash command support
- Kotlin extension module
- Audio via Lavaplayer or Lavalink
Use cases
- Discord moderation bots
- Slash command utilities
- Message logging bots
- Large multi-guild sharded bots
- Music bots on Discord