@duque.edits/sdk 1.6.7 → 1.6.9

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.
@@ -51,10 +51,6 @@ class MessagesManager {
51
51
  if (Array.isArray(data)) messages.push(...data);
52
52
  else messages.push(data);
53
53
  messages = [.../* @__PURE__ */ new Set([...messages, this._messages])];
54
- console.log({
55
- messages,
56
- s: messages.length
57
- });
58
54
  if (messages.length >= 10) {
59
55
  const response = await this.rest.request({
60
56
  method: "PATCH",
package/dist/rest/REST.js CHANGED
@@ -115,12 +115,19 @@ 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
120
  const res = await (0, import_undici.request)(url, {
119
- method: method.toUpperCase(),
120
- headers,
121
- body: JSON.stringify(body),
122
- bodyTimeout: 120 * 1e3,
123
- headersTimeout: 120 * 1e3
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
124
131
  });
125
132
  const responseBody = await res.body.json();
126
133
  const { data, message } = responseBody;
@@ -667,6 +667,7 @@ class Guild {
667
667
  }
668
668
  _Guild_instances = new WeakSet();
669
669
  update_fn = function(data) {
670
+ if (!data) return;
670
671
  for (let key in data) {
671
672
  if (key === "id" || key === "createdAt" || key === "shops") continue;
672
673
  if (key in this) {
@@ -715,7 +716,7 @@ update_fn = function(data) {
715
716
  continue;
716
717
  }
717
718
  }
718
- if ("buffs" in data) {
719
+ if (data?.buffs) {
719
720
  this.buffs = new import_Collection.Collection();
720
721
  for (let buff of data?.buffs || []) {
721
722
  this.buffs.set(buff._id, {
@@ -300,9 +300,6 @@ update_fn = async function(data) {
300
300
  this.bet = this.guild.bets.set(data.bet);
301
301
  }
302
302
  }
303
- console.log({
304
- message: `[Match #update]: ${typeof this.messages} is instance ${this.messages instanceof import_managers.MessagesManager}`
305
- });
306
303
  if (data?.messages?.length !== 0) {
307
304
  if (this?.messages instanceof import_managers.MessagesManager) this.messages.set(data.messages);
308
305
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duque.edits/sdk",
3
- "version": "1.6.7",
3
+ "version": "1.6.9",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",