Class DefaultShardingStrategy.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • indices

        public DefaultShardingStrategy.Builder indices​(int... shardIndices)
        Set the list of shard indices to identify to Discord Gateway. Defaults to identifying all shards. Any invocation of this method will also replace the previously set value at indices(Function).
        Parameters:
        shardIndices - the list of shard indices to identify
        Returns:
        this builder
      • indices

        public DefaultShardingStrategy.Builder indices​(Function<Integer,​Publisher<Integer>> shardIndexSource)
        Set a generator function to derive a Publisher of shard indices to identify to Discord Gateway. Defaults to identify all shards. Any invocation of this method will also replace the previously set value at indices(int...).
        Parameters:
        shardIndexSource - the generator function to determine the shards to identify
        Returns:
        this builder
      • filter

        public DefaultShardingStrategy.Builder filter​(Predicate<ShardInfo> shardFilter)
        Set a filter to determine which shards should be accepted for identifying to Discord Gateway. Defaults to connecting to all shards given by shard count.
        Parameters:
        shardFilter - a Predicate for ShardInfo objects. Called for each shard determined by count(int) and schedules it for connection if returning true.
        Returns:
        this builder
      • maxConcurrency

        public DefaultShardingStrategy.Builder maxConcurrency​(int maxConcurrency)
        Set the sharding maximum concurrency to use when identifying to the Discord Gateway, determining the amount of shards that will be concurrently identified. Defaults to 1. You should only change this value if your bot is authorized to use the very large bot sharding system, otherwise you will hit a rate limit on identifying. maxConcurrency always needs to be a power of 2 and must not be lower than one.
        Parameters:
        maxConcurrency - a positive number indicating the amount of shards that can be identified concurrently.
        Returns:
        this builder