Package discord4j.core.shard
Interface MemberRequestFilter
-
- 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 MemberRequestFilter
A filter to customize the guild member request strategy. Applied on each GUILD_CREATE returning a potentially delayedMono
that, if containingtrue
, guild members should be requested.The following built-in factories exist:
all()
to use a filter requesting ALL members on startupnone()
to disable this featurewithLargeGuilds()
to only request from large guilds (default)withGuilds(Snowflake...)
to request from specific guilds
-
-
Field Summary
Fields Modifier and Type Field Description static MemberRequestFilter
DEFAULT
Request members from all large guilds.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static MemberRequestFilter
all()
Request members from all guilds.Mono<Boolean>
apply(discord4j.discordjson.json.GuildCreateData guildCreateData)
default MemberRequestFilter
as(Function<Mono<Boolean>,Mono<Boolean>> transformer)
Transform this currentMemberRequestFilter
by applying the givenFunction
to derive a newMono
ofboolean
.static MemberRequestFilter
none()
Do not request guild members.static MemberRequestFilter
withGuilds(Snowflake... guildIds)
Request guild members for the given guildSnowflake
IDs.static MemberRequestFilter
withLargeGuilds()
Request members from large guilds.
-
-
-
Field Detail
-
DEFAULT
static final MemberRequestFilter DEFAULT
Request members from all large guilds.
-
-
Method Detail
-
all
static MemberRequestFilter all()
Request members from all guilds.- Returns:
- a
MemberRequestFilter
requesting members from all guilds
-
none
static MemberRequestFilter none()
Do not request guild members.- Returns:
- a
MemberRequestFilter
not requesting any member
-
withLargeGuilds
static MemberRequestFilter withLargeGuilds()
Request members from large guilds.- Returns:
- a
MemberRequestFilter
requesting members from large guilds
-
withGuilds
static MemberRequestFilter withGuilds(Snowflake... guildIds)
Request guild members for the given guildSnowflake
IDs.- Returns:
- a
MemberRequestFilter
requesting members from the given guilds
-
apply
Mono<Boolean> apply(discord4j.discordjson.json.GuildCreateData guildCreateData)
Obtain aMono
ofBoolean
for the givenGuildCreateData
. If the resulting sequence containstrue
, then members will be requested through the Gateway for this guild.- Parameters:
guildCreateData
- the guild triggering this filter- Returns:
- a
Mono
indicating if a guild should have their members requested
-
as
default MemberRequestFilter as(Function<Mono<Boolean>,Mono<Boolean>> transformer)
Transform this currentMemberRequestFilter
by applying the givenFunction
to derive a newMono
ofboolean
.- Parameters:
transformer
- the function to transform thisMemberRequestFilter
- Returns:
- a transformed
MemberRequestFilter
-
-