refactor: switch api and gateway to V8 (#4879)

Co-authored-by: Jan <66554238+Vaporox@users.noreply.github.com>
This commit is contained in:
Sugden
2021-02-11 17:10:35 +00:00
committed by GitHub
parent ae3c3d80ee
commit ee5bc1a5c4
33 changed files with 372 additions and 364 deletions

View File

@@ -29,9 +29,9 @@ const Structures = require('../util/Structures');
*/
class Client extends BaseClient {
/**
* @param {ClientOptions} [options] Options for the client
* @param {ClientOptions} options Options for the client
*/
constructor(options = {}) {
constructor(options) {
super(Object.assign({ _tokenType: 'Bot' }, options));
// Obtain shard details from environment or if present, worker threads
@@ -457,8 +457,10 @@ class Client extends BaseClient {
* @private
*/
_validateOptions(options = this.options) {
if (typeof options.ws.intents !== 'undefined') {
options.ws.intents = Intents.resolve(options.ws.intents);
if (typeof options.intents === 'undefined') {
throw new TypeError('CLIENT_MISSING_INTENTS');
} else {
options.intents = Intents.resolve(options.intents);
}
if (typeof options.shardCount !== 'number' || isNaN(options.shardCount) || options.shardCount < 1) {
throw new TypeError('CLIENT_INVALID_OPTION', 'shardCount', 'a number greater than or equal to 1');