@duque.edits/sdk 1.6.9 → 1.7.0

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.
@@ -67,9 +67,8 @@ class GuildManager {
67
67
  for (let _guild of response) {
68
68
  if (!_guild.id) continue;
69
69
  const guild = new import_Guild.Guild(_guild, this.rest);
70
- await guild._start().then((g) => {
71
- this.cache.set(g.id, g);
72
- });
70
+ await guild._start();
71
+ this.cache.set(guild.id, guild);
73
72
  }
74
73
  return this.cache;
75
74
  }
package/dist/rest/REST.js CHANGED
@@ -115,19 +115,13 @@ class REST extends import_events.default {
115
115
  if ("cache" in body) delete body.cache;
116
116
  if ("rest" in body) delete body.rest;
117
117
  if ("guilds" in body) delete body.guilds;
118
- const methodUpper = method.toUpperCase();
119
- const hasBody = body !== void 0 && body !== null && methodUpper !== "GET" && methodUpper !== "HEAD";
118
+ if ("guild" in body) delete body.guild;
120
119
  const res = await (0, import_undici.request)(url, {
121
- method: methodUpper,
122
- headers: {
123
- ...headers,
124
- ...hasBody && { "content-type": "application/json" }
125
- },
126
- ...hasBody && {
127
- body: JSON.stringify(body)
128
- },
129
- bodyTimeout: 12e4,
130
- headersTimeout: 12e4
120
+ method: method.toUpperCase(),
121
+ headers,
122
+ body: JSON.stringify(body),
123
+ bodyTimeout: 120 * 1e3,
124
+ headersTimeout: 120 * 1e3
131
125
  });
132
126
  const responseBody = await res.body.json();
133
127
  const { data, message } = responseBody;
@@ -726,7 +726,7 @@ update_fn = function(data) {
726
726
  });
727
727
  }
728
728
  }
729
- if ("automatic_roles" in data) {
729
+ if (data?.automatic_roles) {
730
730
  this.automatic_roles = new import_Collection.Collection();
731
731
  for (let role of data?.automatic_roles || []) {
732
732
  this.automatic_roles.set(role._id, {
@@ -412,7 +412,7 @@ const _GuildUser = class _GuildUser {
412
412
  }
413
413
  }
414
414
  }
415
- if ("accessories" in data) payload["accessories"] = data["accessories"];
415
+ if (data?.accessories) payload["accessories"] = data["accessories"];
416
416
  const response = await this.rest.request({
417
417
  method: "patch",
418
418
  url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duque.edits/sdk",
3
- "version": "1.6.9",
3
+ "version": "1.7.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "@discordjs/builders": "^1.13.1",
42
42
  "discord-api-types": "^0.38.39",
43
43
  "tsup": "^8.5.1",
44
- "undici": "^7.10.0"
44
+ "undici": "^7.24.7"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@eslint/js": "^9.29.0",
@@ -59,4 +59,4 @@
59
59
  "engines": {
60
60
  "node": ">=20"
61
61
  }
62
- }
62
+ }