hackchat-engine 1.1.16 → 1.1.17

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.
@@ -14,7 +14,13 @@ class UpdateUser extends AbstractEvent {
14
14
  const { client } = this;
15
15
  const user = client.users.get(data.userid);
16
16
 
17
- user.updateUser(data);
17
+ if (user) {
18
+ user.updateUser(data);
19
+ }
20
+
21
+ if (client.myUser && client.myUser.userid === data.userid) {
22
+ client.myUser.updateUser(data);
23
+ }
18
24
 
19
25
  return user;
20
26
  }
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.16"
62
+ "version": "1.1.17"
63
63
  }
@@ -261,10 +261,11 @@ class User {
261
261
  updateUser(data) {
262
262
  if (data.channel) {
263
263
  this.channels.add(data.channel);
264
+ this.channel = data.channel;
264
265
  }
265
266
 
266
- if (data.trip) this.usertrip = data.trip;
267
- if (data.hash) this.userhash = data.hash;
267
+ if (typeof data.trip !== 'undefined') this.usertrip = data.trip;
268
+ if (typeof data.hash !== 'undefined') this.userhash = data.hash;
268
269
 
269
270
  this.username = data.nick;
270
271
  this.userlevel = data.uType;
@@ -1,5 +1,5 @@
1
1
  import AbstractHandler from './AbstractHandler.js';
2
- import { Events } from '../../../util/Constants.js';
2
+ import { Events, Status } from '../../../util/Constants.js';
3
3
 
4
4
  /**
5
5
  * Handles a new chat message that has been broadcast within a channel
@@ -15,19 +15,21 @@ class SessionHandler extends AbstractHandler {
15
15
  const { client } = this.packetRouter;
16
16
 
17
17
  client.readyAt = new Date();
18
- const t = client.setTimeout(() => {
19
- client.ws.connection.triggerReady();
20
- }, 1);
21
18
 
22
- client.once('ready', () => {
23
- client.setMaxListeners(10);
24
- client.clearTimeout(t);
25
- });
19
+ if (client.status !== Status.READY) {
20
+ const t = client.setTimeout(() => {
21
+ client.ws.connection.triggerReady();
22
+ }, 1);
23
+
24
+ client.once(Events.READY, () => {
25
+ client.clearTimeout(t);
26
+ });
27
+ }
26
28
 
27
29
  const response = client.events.Session.handle(packet);
28
30
 
29
31
  /**
30
- * Emitted when a message is sent in a channel
32
+ * Emitted when a session packet is received
31
33
  * @event Client#session
32
34
  * @param {SessionStruct} session Full session details
33
35
  */