|
@@ -70,11 +70,9 @@ As your bot grows in popularity, it is recommended that you should section your |
|
|
The [DiscordShardedClient] is essentially a class that allows you to easily create and manage multiple [DiscordSocketClient] |
|
|
The [DiscordShardedClient] is essentially a class that allows you to easily create and manage multiple [DiscordSocketClient] |
|
|
instances, with each one serving a different amount of guilds. |
|
|
instances, with each one serving a different amount of guilds. |
|
|
|
|
|
|
|
|
Aside from a few noteworthy differences in some event names, and specifying the amount of shards to connect with |
|
|
|
|
|
in a [DiscordSocketConfig], there are very few differences from the [DiscordSocketClient] class, and it is very straightforward |
|
|
|
|
|
|
|
|
There are very few differences from the [DiscordSocketClient] class, and it is very straightforward |
|
|
to modify your existing code to use a [DiscordShardedClient] when necessary. |
|
|
to modify your existing code to use a [DiscordShardedClient] when necessary. |
|
|
|
|
|
|
|
|
The main differences are: |
|
|
|
|
|
1. You need to specify the total amount of shards, or shard ids, via [DiscordShardedClient]'s constructors. |
|
|
1. You need to specify the total amount of shards, or shard ids, via [DiscordShardedClient]'s constructors. |
|
|
2. The [Connected], [Disconnected], [Ready], and [LatencyUpdated] events |
|
|
2. The [Connected], [Disconnected], [Ready], and [LatencyUpdated] events |
|
|
are replaced with [ShardConnected], [ShardDisconnected], [ShardReady], and [ShardLatencyUpdated]. |
|
|
are replaced with [ShardConnected], [ShardDisconnected], [ShardReady], and [ShardLatencyUpdated]. |
|
@@ -82,4 +80,15 @@ The main differences are: |
|
|
If you wish to control a specific shard's events, you can access an individual shard through the `Shards` property. |
|
|
If you wish to control a specific shard's events, you can access an individual shard through the `Shards` property. |
|
|
|
|
|
|
|
|
If you do not wish to use the [DiscordShardedClient] and instead reuse the same [DiscordSocketClient] code and manually shard them, |
|
|
If you do not wish to use the [DiscordShardedClient] and instead reuse the same [DiscordSocketClient] code and manually shard them, |
|
|
you can do so by specifiying the [ShardId] for the [DiscordSocketConfig] and pass that to the [DiscordSocketClient]'s constructor. |
|
|
|
|
|
|
|
|
you can do so by specifying the [ShardId] for the [DiscordSocketConfig] and pass that to the [DiscordSocketClient]'s constructor. |
|
|
|
|
|
|
|
|
|
|
|
[DiscordSocketClient]: xref:Discord.WebSocket.DiscordSocketClient |
|
|
|
|
|
[DiscordShardedClient]: xref:Discord.WebSocket.DiscordShardedClient |
|
|
|
|
|
[Connected]: xref:Discord.WebSocket.DiscordSocketClient.Connected |
|
|
|
|
|
[Disconnected]: xref:Discord.WebSocket.DiscordSocketClient.Disconnected |
|
|
|
|
|
[LatencyUpdated]: xref:Discord.WebSocket.DiscordSocketClient.LatencyUpdated |
|
|
|
|
|
[ShardConnected]: xref:Discord.WebSocket.DiscordShardedClient.ShardConnected |
|
|
|
|
|
[ShardDisconnected]: xref:Discord.WebSocket.DiscordShardedClient.ShardDisconnected |
|
|
|
|
|
[ShardReady]: xref:Discord.WebSocket.DiscordShardedClient.ShardReady |
|
|
|
|
|
[ShardLatencyUpdated]: xref:Discord.WebSocket.DiscordShardedClient.ShardLatencyUpdated |
|
|
|
|
|
[ShardId]: xref:Discord.WebSocket.DiscordSocketConfig.ShardId |