@stoatx/client 0.6.1 → 0.6.2
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/dist/index.cjs +13 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1067,10 +1067,21 @@ var GatewayManager = class {
|
|
|
1067
1067
|
}
|
|
1068
1068
|
case "UserUpdate": {
|
|
1069
1069
|
const existing = this.client.users.cache.get(payload.id);
|
|
1070
|
+
const isClientUser = this.client.user?.id === payload.id;
|
|
1071
|
+
let oldUser;
|
|
1072
|
+
let newUser;
|
|
1070
1073
|
if (existing) {
|
|
1071
|
-
|
|
1074
|
+
oldUser = existing._clone();
|
|
1072
1075
|
existing._patch(payload.data, payload.clear);
|
|
1073
|
-
|
|
1076
|
+
newUser = existing;
|
|
1077
|
+
}
|
|
1078
|
+
if (isClientUser) {
|
|
1079
|
+
oldUser = this.client.user?._clone();
|
|
1080
|
+
this.client.user?._patch(payload.data, payload.clear);
|
|
1081
|
+
newUser = this.client.user;
|
|
1082
|
+
}
|
|
1083
|
+
if (oldUser && newUser) {
|
|
1084
|
+
this.client.emit("userUpdate", oldUser, newUser);
|
|
1074
1085
|
}
|
|
1075
1086
|
break;
|
|
1076
1087
|
}
|