title: TypeError: Cannot read property 'options' of undefined | Discord.js
body: <p>Making a new bot for my server and this error wont stop showing:</p>
  <p><strong>error:</strong></p>
  <pre><code>(node:9340) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'options' of undefined
      at new WebSocketConnection (C:\Users\My\Path\To\Success\Visual Studio code\Discord Bots\Testing\Second Try\Intents\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:60:23)
      at WebSocketManager.connect (C:\Users\My\Path\To\Success\Visual Studio code\Discord Bots\Testing\Second Try\Intents\node_modules\discord.js\src\client\websocket\WebSocketManager.js:75:25)
      at Client.login (C:\Users\My\Path\To\Success\Visual Studio code\Discord Bots\Testing\Second Try\Intents\node_modules\discord.js\src\client\Client.js:220:21)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
  </code></pre>
  <p>I've looked at my other bots and their location of error which this bot is outputting and it all looks the same to me.</p>
  <p><strong>Code:</strong></p>
  <pre><code>class WebSocketConnection extends EventEmitter {
    /**
     * @param {WebSocketManager} manager The WebSocket manager
     * @param {string} gateway The WebSocket gateway to connect to
     */
    constructor(manager, gateway, client) {
      super();
      /**
       * The WebSocket Manager of this connection
       * @type {WebSocketManager}
       */
      this.manager = manager;
  
      /**
       * The client this belongs to
       * @type {Client}
       */
      this.client = manager.client;
  
      if (typeof client.options.disabledEvents == 'object' &amp;&amp; typeof client.options.disabledEvents[Symbol.iterator] == 'function')
  
      /**
       * The WebSocket connection itself
       * @type {WebSocket}
       */
      this.ws = null;
  
      /**
       * The current sequence of the WebSocket
       * @type {number}
       */
      this.sequence = -1;
  </code></pre>
  <p><strong>Other References to &quot;options&quot;:</strong></p>
  <pre><code>109:    /**
  110:     * Whether or not the WebSocket is expecting to be closed
  111:     * @type {boolean}
  112:     */
  113:    this.expectingClose = false;
  114:    for (const event of this.client.options.disabledEvents) this.disabledEvents[event] = true;
  
  /////////////////////////////////////////////////////////////////////////////////////////////////////
  
  135: /**
  136:    * Checks whether the client is ready to be marked as ready.
  137:    * @returns {void}
  138:    */
  139:   checkIfReady() {
  140:     if (this.status === Constants.Status.READY || this.status === Constants.Status.NEARLY) return false;
  141:     let unavailableGuilds = 0;
  142:     for (const guild of this.client.guilds.values()) {
  143:       if (!guild.available) unavailableGuilds++;
  144:     }
  145:     if (unavailableGuilds === 0) {
  146:       this.status = Constants.Status.NEARLY;
  147:       if (!this.client.options.fetchAllMembers) return this.triggerReady();
  148:       // Fetch all members before marking self as ready
  149:       const promises = this.client.guilds.map(g =&gt; g.fetchMembers());
  150:       Promise.all(promises)
  151:         .then(() =&gt; this.triggerReady())
  152:         .catch(e =&gt; {
  153:           this.debug(`Failed to fetch all members before ready! ${e}`);
  154:           this.triggerReady();
  155:         });
  156:     }
  157:     return true;
  158:   }
  
  ////////////////////////////////////////////////////////////////////////////////////////////////////
  
  460: /**
  461:    * Identifies as a new connection on the gateway.
  462:    * @returns {void}
  463:    */
  464:   identifyNew() {
  465:     if (!this.client.token) {
  466:       this.debug('No token available to identify a new session with');
  467:       return;
  468:     }
  469:     // Clone the generic payload and assign the token
  470:     const d = Object.assign({ token: this.client.token }, this.client.options.ws);
  471: 
  472:     // Sharding stuff
  473:     const { shardId, shardCount } = this.client.options;
  474:     if (shardCount &gt; 0) d.shard = [Number(shardId), Number(shardCount)];
  475: 
  476:     // Send the payload
  477:     this.debug('Identifying as a new session');
  478:     this.send({ op: Constants.OPCodes.IDENTIFY, d });
  479:   }
  </code></pre>
  <p>Looking at my other bots, I don't really see the issue here. Any help would be appreciated and thank you.</p>
  <p>Version of Discord.js: v11</p>