pub async fn create_recommended<F: Fn(ShardId, ConfigBuilder) -> Config>(
client: &Client,
config: Config,
per_shard_config: F
) -> Result<impl Iterator<Item = Shard>, StartRecommendedError>
Available on crate feature twilight-http only.
Expand description

Create a range of shards from Discord’s recommendation.

Passing a primary config is required. Further customization of this config may be performed in the callback.

Internally calls create_range with the values from GetGatewayAuthed.

Errors

Returns a StartRecommendedErrorType::Deserializing error type if the response body failed to deserialize.

Returns a StartRecommendedErrorType::Request error type if the request failed to complete.

Panics

Panics if loading TLS certificates fails.