From b92a7d72332c35b607db54aa6aca24b8e10e00ad Mon Sep 17 00:00:00 2001 From: J-Human Date: Sun, 9 Jan 2022 18:49:03 +0800 Subject: [PATCH] fix(BaseClient): do not append default options if provided is not an object (#6453) --- packages/discord.js/src/client/BaseClient.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/discord.js/src/client/BaseClient.js b/packages/discord.js/src/client/BaseClient.js index 3bf037fae..968988d5d 100644 --- a/packages/discord.js/src/client/BaseClient.js +++ b/packages/discord.js/src/client/BaseClient.js @@ -1,6 +1,7 @@ 'use strict'; const EventEmitter = require('node:events'); +const { TypeError } = require('../errors'); const RESTManager = require('../rest/RESTManager'); const Options = require('../util/Options'); const Util = require('../util/Util'); @@ -13,6 +14,10 @@ class BaseClient extends EventEmitter { constructor(options = {}) { super(); + if (typeof options !== 'object' || options === null) { + throw new TypeError('INVALID_TYPE', 'options', 'object', true); + } + /** * The options the client was instantiated with * @type {ClientOptions}