hackchat-engine 1.1.13 → 1.1.14

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.13"
62
+ "version": "1.1.14"
63
63
  }
@@ -21,28 +21,10 @@ class SessionStruct {
21
21
  */
22
22
  setup(data) {
23
23
  /**
24
- * Current channel count
25
- * @type {number}
26
- */
27
- this.channelCount = data.chans;
28
-
29
- /**
30
- * Available public channels and their user count
24
+ * Currently connected channels
31
25
  * @type {object}
32
26
  */
33
- this.publicChannels = data.public;
34
-
35
- /**
36
- * Current session id
37
- * @type {string}
38
- */
39
- this.sessionID = data.sessionID;
40
-
41
- /**
42
- * Current channel count
43
- * @type {number}
44
- */
45
- this.userCount = data.users;
27
+ this.channels = data.channels;
46
28
 
47
29
  /**
48
30
  * Was this a new or renewed session
@@ -50,13 +32,11 @@ class SessionStruct {
50
32
  */
51
33
  this.restored = data.restored;
52
34
 
53
- // add non-standard properties
54
- const dataKeys = Object.keys(data);
55
- for (let i = 0, j = dataKeys.length; i < j; i += 1) {
56
- if (dataKeys[i] !== 'cmd' && dataKeys[i] !== 'time') {
57
- this[dataKeys[i]] = data[dataKeys[i]];
58
- }
59
- }
35
+ /**
36
+ * The new token
37
+ * @type {string}
38
+ */
39
+ this.token = data.token;
60
40
  }
61
41
  }
62
42
 
@@ -85,9 +85,9 @@ class SocketHandler extends EventEmitter {
85
85
  /**
86
86
  * Store new client session id when assigned
87
87
  */
88
- this.client.on(Events.SESSION, (data) => {
89
- this.sessionID = data.sessionID;
90
- });
88
+ this.client.on(Events.SESSION, (data) =>
89
+ this.sessionID = data.token,
90
+ );
91
91
 
92
92
  // Initiate connection
93
93
  this.connect(gateway);