@stoatx/client 0.6.0 → 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 +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -3
- 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
|
}
|
|
@@ -1337,7 +1348,7 @@ var RESTManager = class {
|
|
|
1337
1348
|
await sleep(waitTime);
|
|
1338
1349
|
}
|
|
1339
1350
|
const options = {
|
|
1340
|
-
method,
|
|
1351
|
+
method: method.toUpperCase(),
|
|
1341
1352
|
headers: {
|
|
1342
1353
|
"X-Bot-Token": this.token,
|
|
1343
1354
|
"Content-Type": "application/json"
|