@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.cjs
CHANGED
|
@@ -1140,10 +1140,21 @@ var GatewayManager = class {
|
|
|
1140
1140
|
}
|
|
1141
1141
|
case "UserUpdate": {
|
|
1142
1142
|
const existing = this.client.users.cache.get(payload.id);
|
|
1143
|
+
const isClientUser = this.client.user?.id === payload.id;
|
|
1144
|
+
let oldUser;
|
|
1145
|
+
let newUser;
|
|
1143
1146
|
if (existing) {
|
|
1144
|
-
|
|
1147
|
+
oldUser = existing._clone();
|
|
1145
1148
|
existing._patch(payload.data, payload.clear);
|
|
1146
|
-
|
|
1149
|
+
newUser = existing;
|
|
1150
|
+
}
|
|
1151
|
+
if (isClientUser) {
|
|
1152
|
+
oldUser = this.client.user?._clone();
|
|
1153
|
+
this.client.user?._patch(payload.data, payload.clear);
|
|
1154
|
+
newUser = this.client.user;
|
|
1155
|
+
}
|
|
1156
|
+
if (oldUser && newUser) {
|
|
1157
|
+
this.client.emit("userUpdate", oldUser, newUser);
|
|
1147
1158
|
}
|
|
1148
1159
|
break;
|
|
1149
1160
|
}
|