@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 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
- const oldUser = existing._clone();
1147
+ oldUser = existing._clone();
1145
1148
  existing._patch(payload.data, payload.clear);
1146
- this.client.emit("userUpdate", oldUser, existing);
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
  }
@@ -1410,7 +1421,7 @@ var RESTManager = class {
1410
1421
  await sleep(waitTime);
1411
1422
  }
1412
1423
  const options = {
1413
- method,
1424
+ method: method.toUpperCase(),
1414
1425
  headers: {
1415
1426
  "X-Bot-Token": this.token,
1416
1427
  "Content-Type": "application/json"