hackchat-engine 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -59,5 +59,5 @@
59
59
  "lintfix": "eslint --fix --ignore-path .gitignore .",
60
60
  "test": "echo \"Error: no test specified\" && exit 1"
61
61
  },
62
- "version": "1.1.3"
62
+ "version": "1.1.4"
63
63
  }
package/util/Constants.js CHANGED
@@ -29,6 +29,7 @@ export const DefaultOptions = {
29
29
  },
30
30
 
31
31
  isBot: true,
32
+ session: false,
32
33
  };
33
34
 
34
35
  /**
@@ -66,7 +66,7 @@ class SocketController extends EventEmitter {
66
66
  */
67
67
  connect(gateway) {
68
68
  if (!this.connection) {
69
- this.connection = new SocketHandler(this, gateway);
69
+ this.connection = new SocketHandler(this, gateway, this.client.session);
70
70
  return true;
71
71
  }
72
72
 
@@ -16,7 +16,7 @@ class SocketHandler extends EventEmitter {
16
16
  * @param {SocketController} controller Controller of this handler
17
17
  * @param {string} gateway Target gateway address to connect to
18
18
  */
19
- constructor(controller, gateway) {
19
+ constructor(controller, gateway, session) {
20
20
  super();
21
21
 
22
22
  /**
@@ -80,7 +80,7 @@ class SocketHandler extends EventEmitter {
80
80
  * Current session id
81
81
  * @type {string}
82
82
  */
83
- this.sessionID = '';
83
+ this.sessionID = session;
84
84
 
85
85
  /**
86
86
  * Store new client session id when assigned
@@ -389,7 +389,7 @@ class SocketHandler extends EventEmitter {
389
389
  const payload = {
390
390
  cmd: OPCodes.SESSION,
391
391
  isBot: this.client.options.isBot,
392
- id: this.sessionID,
392
+ token: this.sessionID,
393
393
  };
394
394
 
395
395
  return this.send(payload);