From 8e8e65abdb64b67c27a8368b728ed0807825de8b Mon Sep 17 00:00:00 2001 From: Yukine Date: Wed, 27 Jan 2021 19:10:52 +0100 Subject: [PATCH] [Fix] Ensure that options have correct types this is for the js user who use Environment variables and don't check for types themself --- src/Sharding/ShardingManager.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Sharding/ShardingManager.ts b/src/Sharding/ShardingManager.ts index 7bd5b47..96a0c3f 100644 --- a/src/Sharding/ShardingManager.ts +++ b/src/Sharding/ShardingManager.ts @@ -61,16 +61,16 @@ export class ShardingManager extends EventEmitter { public constructor(public path: string, options: SharderOptions) { super(); - this.clusterCount = options.clusterCount ?? cpus().length; - this.guildsPerShard = options.guildsPerShard ?? 1000; + this.clusterCount = Number(options.clusterCount ?? cpus().length); + this.guildsPerShard = Number(options.guildsPerShard ?? 1000); this.clientOptions = options.clientOptions ?? {}; this.development = options.development ?? false; - this.shardCount = options.shardCount ?? 'auto'; + this.shardCount = Number.isNaN(options.shardCount) ? 'auto' : Number(options.shardCount); this.client = options.client ?? Client; this.respawn = options.respawn ?? true; this.ipcSocket = options.ipcSocket ?? 9999; this.retry = options.retry ?? true; - this.timeout = options.timeout ?? 30000; + this.timeout = Number(options.timeout ?? 30000); this.token = options.token; this.nodeArgs = options.nodeArgs; this.ipc = new MasterIPC(this);