hackchat-engine 1.1.17 → 1.1.19
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/events/UpdateUser.js +5 -1
- package/events/UserLeave.js +4 -0
- package/package.json +1 -1
- package/structures/EmoteStruct.js +4 -4
- package/structures/UserStruct.js +23 -7
package/events/UpdateUser.js
CHANGED
|
@@ -14,15 +14,19 @@ class UpdateUser extends AbstractEvent {
|
|
|
14
14
|
const { client } = this;
|
|
15
15
|
const user = client.users.get(data.userid);
|
|
16
16
|
|
|
17
|
+
let targetUser = null;
|
|
18
|
+
|
|
17
19
|
if (user) {
|
|
18
20
|
user.updateUser(data);
|
|
21
|
+
targetUser = user;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
if (client.myUser && client.myUser.userid === data.userid) {
|
|
22
25
|
client.myUser.updateUser(data);
|
|
26
|
+
targetUser = client.myUser;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
|
-
return user;
|
|
29
|
+
return targetUser || user;
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
32
|
|
package/events/UserLeave.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import AbstractEvent from './AbstractEvent.js';
|
|
2
|
+
import { Events } from '../util/Constants.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* This class handles an incoming `leave` event from the server
|
|
@@ -19,6 +20,9 @@ class UserLeave extends AbstractEvent {
|
|
|
19
20
|
|
|
20
21
|
if (user.channels.size === 0) {
|
|
21
22
|
user.online = false;
|
|
23
|
+
user.userEffect = 0;
|
|
24
|
+
|
|
25
|
+
client.emit(Events.USER_UPDATE, user);
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
28
|
|
package/package.json
CHANGED
|
@@ -11,10 +11,10 @@ class Emote {
|
|
|
11
11
|
Object.defineProperty(this, 'client', { value: client });
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
* User who sent the emote
|
|
15
|
+
* @type {User}
|
|
16
|
+
* @readonly
|
|
17
|
+
*/
|
|
18
18
|
Object.defineProperty(this, 'user', { value: user });
|
|
19
19
|
|
|
20
20
|
this.setup(data);
|
package/structures/UserStruct.js
CHANGED
|
@@ -125,6 +125,12 @@ class User {
|
|
|
125
125
|
* @type {number}
|
|
126
126
|
*/
|
|
127
127
|
this.permissionLevel = data.level || false;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* User's ui effect
|
|
131
|
+
* @type {number}
|
|
132
|
+
*/
|
|
133
|
+
this.userEffect = data.effect || 0;
|
|
128
134
|
}
|
|
129
135
|
|
|
130
136
|
/**
|
|
@@ -253,6 +259,15 @@ class User {
|
|
|
253
259
|
return this.permissionLevel;
|
|
254
260
|
}
|
|
255
261
|
|
|
262
|
+
/**
|
|
263
|
+
* User's ui effect
|
|
264
|
+
* @type {number}
|
|
265
|
+
* @readonly
|
|
266
|
+
*/
|
|
267
|
+
get effect() {
|
|
268
|
+
return this.userEffect;
|
|
269
|
+
}
|
|
270
|
+
|
|
256
271
|
/**
|
|
257
272
|
* Patch new user info sent from server
|
|
258
273
|
* @param {object} data User object sent from server
|
|
@@ -266,13 +281,14 @@ class User {
|
|
|
266
281
|
|
|
267
282
|
if (typeof data.trip !== 'undefined') this.usertrip = data.trip;
|
|
268
283
|
if (typeof data.hash !== 'undefined') this.userhash = data.hash;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
this.
|
|
272
|
-
this.
|
|
273
|
-
this.
|
|
274
|
-
this.
|
|
275
|
-
this.
|
|
284
|
+
if (typeof data.effect !== 'undefined') this.userEffect = data.effect;
|
|
285
|
+
|
|
286
|
+
if (typeof data.nick !== 'undefined') this.username = data.nick;
|
|
287
|
+
if (typeof data.uType !== 'undefined') this.userlevel = data.uType;
|
|
288
|
+
if (typeof data.isBot !== 'undefined') this.botting = data.isBot;
|
|
289
|
+
if (typeof data.color !== 'undefined') this.nickColor = data.color;
|
|
290
|
+
if (typeof data.flair !== 'undefined') this.flair = data.flair;
|
|
291
|
+
if (typeof data.level !== 'undefined') this.permissionLevel = data.level;
|
|
276
292
|
}
|
|
277
293
|
|
|
278
294
|
/**
|