Update readme; Move shard calculating to shard manager

This commit is contained in:
Szymon Uglis 2021-04-07 00:45:03 +02:00
parent 0585fff0a5
commit e01a670a19
No known key found for this signature in database
GPG key ID: 112376C5BEE91FE2
3 changed files with 6 additions and 4 deletions

View file

@ -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

View file

@ -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);
});
}

View file

@ -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);