Update readme; Move shard calculating to shard manager
This commit is contained in:
parent
0585fff0a5
commit
e01a670a19
|
@ -42,7 +42,7 @@ void main() {
|
|||
Slash commands:
|
||||
```dart
|
||||
void main() {
|
||||
final bot = Nyxx("<%TOKEN%>", GatewayIntents.all);
|
||||
final bot = Nyxx("<%TOKEN%>", GatewayIntents.allUnprivileged);
|
||||
final interactions = Interactions(bot);
|
||||
|
||||
interactions
|
||||
|
|
|
@ -32,7 +32,7 @@ class _ConnectionManager {
|
|||
|
||||
checkForConnections();
|
||||
|
||||
this._client.shardManager = ShardManager._new(this, this._client._options.shardCount != null ? this._client._options.shardCount! : this.recommendedShardsNum);
|
||||
this._client.shardManager = ShardManager._new(this);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -38,11 +38,13 @@ class ShardManager implements Disposable {
|
|||
.fold<int>(0, (first, second) => first + second)) ~/ shards.length);
|
||||
|
||||
final _ConnectionManager _ws;
|
||||
final int _numShards;
|
||||
late final int _numShards;
|
||||
final Map<int, Shard> _shards = {};
|
||||
|
||||
/// Starts shard manager
|
||||
ShardManager._new(this._ws, this._numShards) {
|
||||
ShardManager._new(this._ws) {
|
||||
this._numShards = this._ws._client._options.shardCount != null ? this._ws._client._options.shardCount! : this._ws.recommendedShardsNum;
|
||||
|
||||
if (this._numShards < 1) {
|
||||
this._logger.shout("Number of shards cannot be lower than 1.");
|
||||
exit(1);
|
||||
|
|
Loading…
Reference in a new issue