Package net.dv8tion.jda.api.utils
Interface ChunkingFilter
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ChunkingFilter
Filter function for member chunking of guilds.
The filter decides based on the provided guild id whether chunking should be done on guild initialization.To use chunking, the
GUILD_MEMBERS
intent must be enabled! Otherwise you must useNONE
!- Since:
- 4.1.0
- See Also:
ALL
,NONE
,JDABuilder.setChunkingFilter(ChunkingFilter)
,DefaultShardManagerBuilder.setChunkingFilter(ChunkingFilter)
-
-
Field Summary
Fields Modifier and Type Field Description static ChunkingFilter
ALL
Chunk all guildsstatic ChunkingFilter
NONE
Do not chunk any guilds (lazy loading)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static ChunkingFilter
exclude(long... ids)
Factory method to disable chunking for a blacklist of guild ids.boolean
filter(long guildId)
Decide whether the specified guild should chunk members.static ChunkingFilter
include(long... ids)
Factory method to chunk a whitelist of guild ids.
-
-
-
Field Detail
-
ALL
static final ChunkingFilter ALL
Chunk all guilds
-
NONE
static final ChunkingFilter NONE
Do not chunk any guilds (lazy loading)
-
-
Method Detail
-
filter
boolean filter(long guildId)
Decide whether the specified guild should chunk members.- Parameters:
guildId
- The guild id- Returns:
- True, if this guild should chunk
-
include
@Nonnull static ChunkingFilter include(@Nonnull long... ids)
Factory method to chunk a whitelist of guild ids.
All guilds that are not mentioned will use lazy loading.This is useful to only chunk specific guilds like the hub server of a bot.
- Parameters:
ids
- The ids that should be chunked- Returns:
- The resulting filter
-
exclude
@Nonnull static ChunkingFilter exclude(@Nonnull long... ids)
Factory method to disable chunking for a blacklist of guild ids.
All guilds that are not mentioned will use chunking.This is useful when the bot is only in one very large server that takes most of its memory and should be ignored instead.
- Parameters:
ids
- The ids that should not be chunked- Returns:
- The resulting filter
-
-