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.
  • Constructor Details

    • IdentifyOptions

      protected IdentifyOptions(IdentifyOptions.Builder builder)
      Create a new Gateway authentication policy.
      Parameters:
      builder - a builder used to configure this object
  • Method Details

    • create

      public static IdentifyOptions create(int shardIndex, int shardCount)
      Create a default IdentifyOptions using the given shard index and count.
      Parameters:
      shardIndex - the shard index for authentication
      shardCount - the shard count for authentication
      Returns:
      a default authentication policy
    • create

      public static IdentifyOptions create(ShardInfo shardInfo)
      Create a default IdentifyOptions 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 an IdentifyOptions using the given shard information.
      Parameters:
      shardIndex - the shard index for authentication
      shardCount - the shard count for authentication
      Returns:
      a IdentifyOptions.Builder
    • builder

      public static IdentifyOptions.Builder builder(ShardInfo shardInfo)
      Create a builder to create an IdentifyOptions 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 a IdentifyOptions.Builder from this object, reusing all properties.
      Returns:
      a IdentifyOptions.Builder for further configuration
    • mutate

      public IdentifyOptions.Builder mutate(ShardInfo shardInfo)
      Derive a IdentifyOptions.Builder from this object, targeting a different ShardInfo 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 the ShardInfo 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 the SessionInfo that should be used to resume a Gateway session.
      Returns:
      the session details for resumption
    • toString

      public String toString()
      Overrides:
      toString in class Object