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 class
IdentifyOptions.Builder
Builder to createIdentifyOptions
.
-
Constructor Summary
Constructors Modifier Constructor Description protected
IdentifyOptions(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.Builder
builder(int shardIndex, int shardCount)
Create a builder to create anIdentifyOptions
using the given shard information.static IdentifyOptions.Builder
builder(ShardInfo shardInfo)
Create a builder to create anIdentifyOptions
using the given shard information.static IdentifyOptions
create(int shardIndex, int shardCount)
Create a defaultIdentifyOptions
using the given shard index and count.static IdentifyOptions
create(ShardInfo shardInfo)
Create a defaultIdentifyOptions
using 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.int
getLargeThreshold()
Retrieve the number of members used to determine if a guild is "large".Optional<SessionInfo>
getResumeSession()
Retrieve theSessionInfo
that should be used to resume a Gateway session.ShardInfo
getShardInfo()
Retrieve theShardInfo
to be used when authenticating, specifying shard index and count.IdentifyOptions.Builder
mutate()
Derive aIdentifyOptions.Builder
from this object, reusing all properties.IdentifyOptions.Builder
mutate(ShardInfo shardInfo)
Derive aIdentifyOptions.Builder
from this object, targeting a differentShardInfo
but reusing all other properties.String
toString()
-
-
-
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 defaultIdentifyOptions
using 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 defaultIdentifyOptions
using 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 anIdentifyOptions
using 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 anIdentifyOptions
using 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.Builder
from this object, reusing all properties.- Returns:
- a
IdentifyOptions.Builder
for further configuration
-
mutate
public IdentifyOptions.Builder mutate(ShardInfo shardInfo)
Derive aIdentifyOptions.Builder
from this object, targeting a differentShardInfo
but reusing all other properties.- Parameters:
shardInfo
- the shard information for authentication to be used in the builder- Returns:
- a
IdentifyOptions.Builder
for further configuration
-
getShardInfo
public ShardInfo getShardInfo()
Retrieve theShardInfo
to 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 theSessionInfo
that should be used to resume a Gateway session.- Returns:
- the session details for resumption
-
-