Creating a Builder
createDefault
Creates a JDABuilder with recommended default settings.The bot token
First intent to enable
Additional intents to enable
Configured JDABuilder instance
- Member cache policy:
MemberCachePolicy.DEFAULT - Chunking filter:
ChunkingFilter.NONE - Gateway intents:
GatewayIntent.DEFAULT(if not specified) - Disabled cache:
ACTIVITY,CLIENT_STATUS
createLight
Creates a JDABuilder with low memory profile settings.The bot token
First intent to enable
Additional intents to enable
Configured JDABuilder instance
- Member cache policy:
MemberCachePolicy.NONE - Chunking filter:
ChunkingFilter.NONE - All cache flags disabled
- Large threshold: 50
create
Creates a completely empty JDABuilder with specified intents.The bot token (can be set later)
First intent to enable
Additional intents to enable
JDABuilder instance
Building the Instance
build
Builds the JDA instance and starts the login process.The JDA instance
Configuration
Token
setToken
Sets the bot token for authentication.The bot token from Discord Developer Portal
The builder for chaining
Gateway Intents
enableIntents
Enables specific gateway intents.First intent to enable
Additional intents to enable
The builder for chaining
disableIntents
Disables specific gateway intents.First intent to disable
Additional intents to disable
The builder for chaining
setEnabledIntents
Sets the complete list of enabled intents, replacing any previous configuration.First intent to enable
Additional intents to enable
The builder for chaining
Cache Configuration
enableCache
Enables specific cache flags.First cache flag to enable
Additional cache flags to enable
The builder for chaining
disableCache
Disables specific cache flags.First cache flag to disable
Additional cache flags to disable
The builder for chaining
setMemberCachePolicy
Configures which members to cache.The member cache policy
The builder for chaining
setChunkingFilter
Configures which guilds should use member chunking.The chunking filter
The builder for chaining
Event Listeners
addEventListeners
Adds event listeners that will be registered when JDA is built.One or more event listeners
The builder for chaining
setEventManager
Sets the event manager implementation.The event manager (null for default)
The builder for chaining
Presence
setActivity
Sets the initial activity (game status) for the bot.The activity to display
The builder for chaining
setStatus
Sets the initial online status for the bot.The online status
The builder for chaining
setIdle
Sets whether the bot session should be marked as idle.Whether to mark as idle
The builder for chaining
Sharding
useSharding
Enables sharding mode for the bot.The shard ID (0-based)
Total number of shards
The builder for chaining
Thread Pools
setCallbackPool
Sets the executor for RestAction callbacks.The executor service
Whether JDA should shutdown this pool
The builder for chaining
setGatewayPool
Sets the executor for gateway operations.The scheduled executor service
Whether JDA should shutdown this pool
The builder for chaining
setRateLimitPool
Sets the executor for rate limit handling.The scheduled executor service
Whether JDA should shutdown this pool
The builder for chaining
Behavior
setAutoReconnect
Configures automatic reconnection on connection errors.Whether to automatically reconnect
The builder for chaining
setBulkDeleteSplittingEnabled
Configures whether bulk delete events should be split into individual events.Whether to split bulk deletes
The builder for chaining
setEnableShutdownHook
Configures whether to use a shutdown hook for cleanup.Whether to enable shutdown hook
The builder for chaining
setCompression
Sets the compression algorithm for the gateway connection.The compression type
The builder for chaining
HTTP Configuration
setHttpClient
Sets a custom OkHttpClient for REST requests.The HTTP client
The builder for chaining
setRestConfig
Sets custom REST configuration including rate limit handling.The REST configuration
The builder for chaining
Complete Example
Related
- JDA Interface - The main JDA interface
- RestAction - Asynchronous request handling