Method CreateSharded
- Namespace
- DSharpPlus
- Assembly
- DSharpPlus.dll
CreateSharded(string, DiscordIntents, uint?, IServiceCollection?)
Creates a new sharding DiscordClientbuilder using the specified token.
public static DiscordClientBuilder CreateSharded(string token, DiscordIntents intents, uint? shardCount = null, IServiceCollection? serviceCollection = null)Parameters
- tokenstring
- The token to use for this application. 
- intentsDiscordIntents
- The intents to connect to the gateway with. 
- shardCountuint?
- The amount of shards to start. 
- serviceCollectionIServiceCollection
- The service collection to base this builder on. 
Returns
- DiscordClientBuilder
- A new DiscordClientBuilder. 
Remarks
DSharpPlus supports more advanced sharding over just specifying the amount of shards, which can be accessed
through the underlying service collection: 
builder.ConfigureServices(services =>
{
    services.Configure<ShardingOptions>(x => ...);
    // The default orchestrator supports a shard count and a "stride" (offset from shard 0), which requires
    // a total shard count. If you wish to customize sharding further, you can specify your own orchestrator:
    services.AddSingleton<IShardOrchestrator, MyCustomShardOrchestrator>();
}