Package discord4j.gateway
Class IdentifyOptions
- java.lang.Object
-
- discord4j.gateway.IdentifyOptions
-
public class IdentifyOptions extends Object
An object that contains parameters used for authenticating a bot to Discord gateway.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIdentifyOptions.BuilderBuilder to createIdentifyOptions.
-
Constructor Summary
Constructors Modifier Constructor Description protectedIdentifyOptions(IdentifyOptions.Builder builder)Create a new Gateway authentication policy.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IdentifyOptions.Builderbuilder(int shardIndex, int shardCount)Create a builder to create anIdentifyOptionsusing the given shard information.static IdentifyOptions.Builderbuilder(ShardInfo shardInfo)Create a builder to create anIdentifyOptionsusing the given shard information.static IdentifyOptionscreate(int shardIndex, int shardCount)Create a defaultIdentifyOptionsusing the given shard index and count.static IdentifyOptionscreate(ShardInfo shardInfo)Create a defaultIdentifyOptionsusing the given shard information.Optional<discord4j.discordjson.json.gateway.StatusUpdate>getInitialStatus()Retrieve the initial status used to identify bots.Optional<IntentSet>getIntents()Retrieve the intents which should be subscribed from the gateway when identifying.intgetLargeThreshold()Retrieve the number of members used to determine if a guild is "large".Optional<SessionInfo>getResumeSession()Retrieve theSessionInfothat should be used to resume a Gateway session.ShardInfogetShardInfo()Retrieve theShardInfoto be used when authenticating, specifying shard index and count.IdentifyOptions.Buildermutate()Derive aIdentifyOptions.Builderfrom this object, reusing all properties.IdentifyOptions.Buildermutate(ShardInfo shardInfo)Derive aIdentifyOptions.Builderfrom this object, targeting a differentShardInfobut reusing all other properties.StringtoString()
-
-
-
Constructor Detail
-
IdentifyOptions
protected IdentifyOptions(IdentifyOptions.Builder builder)
Create a new Gateway authentication policy.- Parameters:
builder- a builder used to configure this object
-
-
Method Detail
-
create
public static IdentifyOptions create(int shardIndex, int shardCount)
Create a defaultIdentifyOptionsusing the given shard index and count.- Parameters:
shardIndex- the shard index for authenticationshardCount- the shard count for authentication- Returns:
- a default authentication policy
-
create
public static IdentifyOptions create(ShardInfo shardInfo)
Create a defaultIdentifyOptionsusing the given shard information.- Parameters:
shardInfo- the shard index and count to be used when authenticating- Returns:
- a default authentication policy
-
builder
public static IdentifyOptions.Builder builder(int shardIndex, int shardCount)
Create a builder to create anIdentifyOptionsusing the given shard information.- Parameters:
shardIndex- the shard index for authenticationshardCount- the shard count for authentication- Returns:
- a
IdentifyOptions.Builder
-
builder
public static IdentifyOptions.Builder builder(ShardInfo shardInfo)
Create a builder to create anIdentifyOptionsusing the given shard information.- Parameters:
shardInfo- the shard index and count to be used when authenticating- Returns:
- a
IdentifyOptions.Builder
-
mutate
public IdentifyOptions.Builder mutate()
Derive aIdentifyOptions.Builderfrom this object, reusing all properties.- Returns:
- a
IdentifyOptions.Builderfor further configuration
-
mutate
public IdentifyOptions.Builder mutate(ShardInfo shardInfo)
Derive aIdentifyOptions.Builderfrom this object, targeting a differentShardInfobut reusing all other properties.- Parameters:
shardInfo- the shard information for authentication to be used in the builder- Returns:
- a
IdentifyOptions.Builderfor further configuration
-
getShardInfo
public ShardInfo getShardInfo()
Retrieve theShardInfoto be used when authenticating, specifying shard index and count.- Returns:
- the shard information used by this object
-
getInitialStatus
public Optional<discord4j.discordjson.json.gateway.StatusUpdate> getInitialStatus()
Retrieve the initial status used to identify bots.- Returns:
- the presence used to identify bots
-
getIntents
public Optional<IntentSet> getIntents()
Retrieve the intents which should be subscribed from the gateway when identifying.- Returns:
Possible.absent()when no intents are set or the raw intent value which should be subscribed
-
getLargeThreshold
public int getLargeThreshold()
Retrieve the number of members used to determine if a guild is "large". Gateway will not send offline member information for a large guild member list.- Returns:
- the value used to determine if a guild is considered large
-
getResumeSession
public Optional<SessionInfo> getResumeSession()
Retrieve theSessionInfothat should be used to resume a Gateway session.- Returns:
- the session details for resumption
-
-