@duque.edits/sdk 1.1.0 → 1.1.3

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.
Files changed (161) hide show
  1. package/dist/{index-C87LbIta.d.ts → index-BPxglVSk.d.ts} +83 -31
  2. package/dist/{index-BHHXH2xN.d.mts → index-DjHimKUy.d.mts} +83 -31
  3. package/dist/index.d.mts +2 -1
  4. package/dist/index.d.ts +2 -1
  5. package/dist/index.js +481 -292
  6. package/dist/index.mjs +481 -292
  7. package/dist/managers/automaticmessage/AutomaticMessageManager.d.mts +2 -1
  8. package/dist/managers/automaticmessage/AutomaticMessageManager.d.ts +2 -1
  9. package/dist/managers/automaticmessage/AutomaticMessageManager.js +41 -35
  10. package/dist/managers/automaticmessage/AutomaticMessageManager.mjs +41 -35
  11. package/dist/managers/base.d.mts +2 -1
  12. package/dist/managers/base.d.ts +2 -1
  13. package/dist/managers/base.js +3 -0
  14. package/dist/managers/base.mjs +3 -0
  15. package/dist/managers/bet/GuildBetManager.d.mts +2 -1
  16. package/dist/managers/bet/GuildBetManager.d.ts +2 -1
  17. package/dist/managers/bet/GuildBetManager.js +42 -30
  18. package/dist/managers/bet/GuildBetManager.mjs +42 -30
  19. package/dist/managers/betuser/GuildBetUserManager.d.mts +2 -1
  20. package/dist/managers/betuser/GuildBetUserManager.d.ts +2 -1
  21. package/dist/managers/betuser/GuildBetUserManager.js +32 -19
  22. package/dist/managers/betuser/GuildBetUserManager.mjs +32 -19
  23. package/dist/managers/buffer/BufferManager.d.mts +2 -1
  24. package/dist/managers/buffer/BufferManager.d.ts +2 -1
  25. package/dist/managers/buffer/BufferManager.js +1 -1
  26. package/dist/managers/buffer/BufferManager.mjs +1 -1
  27. package/dist/managers/guild/GuildManager.d.mts +2 -1
  28. package/dist/managers/guild/GuildManager.d.ts +2 -1
  29. package/dist/managers/guild/GuildManager.js +465 -279
  30. package/dist/managers/guild/GuildManager.mjs +465 -279
  31. package/dist/managers/index.d.mts +2 -1
  32. package/dist/managers/index.d.ts +2 -1
  33. package/dist/managers/index.js +480 -291
  34. package/dist/managers/index.mjs +480 -291
  35. package/dist/managers/logs/LogManager.d.mts +2 -1
  36. package/dist/managers/logs/LogManager.d.ts +2 -1
  37. package/dist/managers/logs/LogManager.js +24 -12
  38. package/dist/managers/logs/LogManager.mjs +24 -12
  39. package/dist/managers/match/GuildMatchManager.d.mts +2 -1
  40. package/dist/managers/match/GuildMatchManager.d.ts +2 -1
  41. package/dist/managers/match/GuildMatchManager.js +77 -61
  42. package/dist/managers/match/GuildMatchManager.mjs +77 -61
  43. package/dist/managers/mediator/GuildMediatorManager.d.mts +2 -1
  44. package/dist/managers/mediator/GuildMediatorManager.d.ts +2 -1
  45. package/dist/managers/mediator/GuildMediatorManager.js +30 -17
  46. package/dist/managers/mediator/GuildMediatorManager.mjs +30 -17
  47. package/dist/managers/message/MessagesManager.d.mts +2 -1
  48. package/dist/managers/message/MessagesManager.d.ts +2 -1
  49. package/dist/managers/minesgame/MinesGameManager.d.mts +2 -1
  50. package/dist/managers/minesgame/MinesGameManager.d.ts +2 -1
  51. package/dist/managers/minesgame/MinesGameManager.js +22 -13
  52. package/dist/managers/minesgame/MinesGameManager.mjs +22 -13
  53. package/dist/managers/permission/GuildPermissionManager.d.mts +2 -1
  54. package/dist/managers/permission/GuildPermissionManager.d.ts +2 -1
  55. package/dist/managers/permission/GuildPermissionManager.js +4 -1
  56. package/dist/managers/permission/GuildPermissionManager.mjs +4 -1
  57. package/dist/managers/player/PlayerManager.d.mts +2 -1
  58. package/dist/managers/player/PlayerManager.d.ts +2 -1
  59. package/dist/managers/ticket/TicketManager.d.mts +2 -1
  60. package/dist/managers/ticket/TicketManager.d.ts +2 -1
  61. package/dist/managers/ticket/TicketManager.js +42 -28
  62. package/dist/managers/ticket/TicketManager.mjs +42 -28
  63. package/dist/managers/tournament/TournamentManager.d.mts +21 -0
  64. package/dist/managers/tournament/TournamentManager.d.ts +21 -0
  65. package/dist/managers/tournament/TournamentManager.js +753 -0
  66. package/dist/managers/tournament/TournamentManager.mjs +745 -0
  67. package/dist/managers/user/GuildUserManager.d.mts +2 -1
  68. package/dist/managers/user/GuildUserManager.d.ts +2 -1
  69. package/dist/managers/user/GuildUserManager.js +49 -36
  70. package/dist/managers/user/GuildUserManager.mjs +49 -36
  71. package/dist/managers/vipmember/VipMemberManager.d.mts +2 -1
  72. package/dist/managers/vipmember/VipMemberManager.d.ts +2 -1
  73. package/dist/managers/vipmember/VipMemberManager.js +4 -1
  74. package/dist/managers/vipmember/VipMemberManager.mjs +4 -1
  75. package/dist/rest/REST.d.mts +2 -1
  76. package/dist/rest/REST.d.ts +2 -1
  77. package/dist/rest/REST.js +482 -293
  78. package/dist/rest/REST.mjs +482 -293
  79. package/dist/rest/Routes.js +1 -1
  80. package/dist/rest/Routes.mjs +1 -1
  81. package/dist/rest/index.d.mts +2 -1
  82. package/dist/rest/index.d.ts +2 -1
  83. package/dist/rest/index.js +482 -293
  84. package/dist/rest/index.mjs +482 -293
  85. package/dist/structures/automaticmessage/AutomaticMessage.d.mts +2 -1
  86. package/dist/structures/automaticmessage/AutomaticMessage.d.ts +2 -1
  87. package/dist/structures/automaticmessage/AutomaticMessage.js +30 -26
  88. package/dist/structures/automaticmessage/AutomaticMessage.mjs +30 -26
  89. package/dist/structures/bet/GuildBet.d.mts +2 -1
  90. package/dist/structures/bet/GuildBet.d.ts +2 -1
  91. package/dist/structures/bet/GuildBet.js +39 -30
  92. package/dist/structures/bet/GuildBet.mjs +39 -30
  93. package/dist/structures/betuser/GuildBetUser.d.mts +2 -1
  94. package/dist/structures/betuser/GuildBetUser.d.ts +2 -1
  95. package/dist/structures/betuser/GuildBetUser.js +29 -19
  96. package/dist/structures/betuser/GuildBetUser.mjs +29 -19
  97. package/dist/structures/guild/Guild.d.mts +2 -1
  98. package/dist/structures/guild/Guild.d.ts +2 -1
  99. package/dist/structures/guild/Guild.js +451 -274
  100. package/dist/structures/guild/Guild.mjs +451 -274
  101. package/dist/structures/index.d.mts +2 -1
  102. package/dist/structures/index.d.ts +2 -1
  103. package/dist/structures/index.js +468 -288
  104. package/dist/structures/index.mjs +468 -288
  105. package/dist/structures/logentry/LogEntry.d.mts +2 -1
  106. package/dist/structures/logentry/LogEntry.d.ts +2 -1
  107. package/dist/structures/logentry/LogEntry.js +21 -12
  108. package/dist/structures/logentry/LogEntry.mjs +21 -12
  109. package/dist/structures/match/GuildMatch.d.mts +2 -1
  110. package/dist/structures/match/GuildMatch.d.ts +2 -1
  111. package/dist/structures/match/GuildMatch.js +74 -61
  112. package/dist/structures/match/GuildMatch.mjs +74 -61
  113. package/dist/structures/mediator/GuildMediator.d.mts +2 -1
  114. package/dist/structures/mediator/GuildMediator.d.ts +2 -1
  115. package/dist/structures/mediator/GuildMediator.js +27 -17
  116. package/dist/structures/mediator/GuildMediator.mjs +27 -17
  117. package/dist/structures/minesgame/MinesGame.d.mts +2 -1
  118. package/dist/structures/minesgame/MinesGame.d.ts +2 -1
  119. package/dist/structures/minesgame/MinesGame.js +22 -13
  120. package/dist/structures/minesgame/MinesGame.mjs +22 -13
  121. package/dist/structures/ticket/Ticket.d.mts +2 -1
  122. package/dist/structures/ticket/Ticket.d.ts +2 -1
  123. package/dist/structures/ticket/Ticket.js +27 -18
  124. package/dist/structures/ticket/Ticket.mjs +27 -18
  125. package/dist/structures/tournament/Tournament.d.mts +21 -0
  126. package/dist/structures/tournament/Tournament.d.ts +21 -0
  127. package/dist/structures/tournament/Tournament.js +593 -0
  128. package/dist/structures/tournament/Tournament.mjs +585 -0
  129. package/dist/structures/user/GuildUser.d.mts +2 -1
  130. package/dist/structures/user/GuildUser.d.ts +2 -1
  131. package/dist/structures/user/GuildUser.js +46 -36
  132. package/dist/structures/user/GuildUser.mjs +46 -36
  133. package/dist/structures/vipmember/VipMember.d.mts +2 -1
  134. package/dist/structures/vipmember/VipMember.d.ts +2 -1
  135. package/dist/structures/vipmember/VipMember.js +1 -1
  136. package/dist/structures/vipmember/VipMember.mjs +1 -1
  137. package/dist/types/RestTypes.d.mts +2 -1
  138. package/dist/types/RestTypes.d.ts +2 -1
  139. package/dist/types/api/APIAutomaticMessage.d.mts +2 -1
  140. package/dist/types/api/APIAutomaticMessage.d.ts +2 -1
  141. package/dist/types/api/APIGuild.d.mts +2 -1
  142. package/dist/types/api/APIGuild.d.ts +2 -1
  143. package/dist/types/api/APIGuildBet.d.mts +2 -1
  144. package/dist/types/api/APIGuildBet.d.ts +2 -1
  145. package/dist/types/api/APIGuildBetUser.d.mts +2 -1
  146. package/dist/types/api/APIGuildBetUser.d.ts +2 -1
  147. package/dist/types/api/APIGuildGroupedChannel.d.mts +2 -1
  148. package/dist/types/api/APIGuildGroupedChannel.d.ts +2 -1
  149. package/dist/types/api/APIGuildMatch.d.mts +2 -1
  150. package/dist/types/api/APIGuildMatch.d.ts +2 -1
  151. package/dist/types/api/APIGuildUser.d.mts +2 -1
  152. package/dist/types/api/APIGuildUser.d.ts +2 -1
  153. package/dist/types/api/APITournament.d.mts +16 -0
  154. package/dist/types/api/APITournament.d.ts +16 -0
  155. package/dist/types/api/APITournament.js +18 -0
  156. package/dist/types/api/APITournament.mjs +0 -0
  157. package/dist/types/api/index.d.mts +2 -1
  158. package/dist/types/api/index.d.ts +2 -1
  159. package/dist/types/index.d.mts +2 -1
  160. package/dist/types/index.d.ts +2 -1
  161. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- export { A as AutomaticMessageManager } from '../../index-BHHXH2xN.mjs';
1
+ export { A as AutomaticMessageManager } from '../../index-DjHimKUy.mjs';
2
2
  import '../../structures/Collection.mjs';
3
3
  import '../../types/api/APIAdvert.mjs';
4
4
  import '../../types/api/APIBaseChannel.mjs';
@@ -18,3 +18,4 @@ import '../../types/api/APILogEntry.mjs';
18
18
  import '../../types/api/APIMinesGame.mjs';
19
19
  import '../../types/api/APIVipMember.mjs';
20
20
  import 'events';
21
+ import '../../types/api/APITournament.mjs';
@@ -1,4 +1,4 @@
1
- export { A as AutomaticMessageManager } from '../../index-C87LbIta.js';
1
+ export { A as AutomaticMessageManager } from '../../index-BPxglVSk.js';
2
2
  import '../../structures/Collection.js';
3
3
  import '../../types/api/APIAdvert.js';
4
4
  import '../../types/api/APIBaseChannel.js';
@@ -18,3 +18,4 @@ import '../../types/api/APILogEntry.js';
18
18
  import '../../types/api/APIMinesGame.js';
19
19
  import '../../types/api/APIVipMember.js';
20
20
  import 'events';
21
+ import '../../types/api/APITournament.js';
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __typeError = (msg) => {
9
+ throw TypeError(msg);
10
+ };
8
11
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
12
  var __commonJS = (cb, mod) => function __require() {
10
13
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
@@ -31,6 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
34
  ));
32
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
36
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
37
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
38
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
39
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
34
40
 
35
41
  // node_modules/dotenv/package.json
36
42
  var require_package = __commonJS({
@@ -494,12 +500,15 @@ var BaseManager = class {
494
500
  this.rest = guild.rest;
495
501
  this.cache = new Collection();
496
502
  }
503
+ toJSON() {
504
+ return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
505
+ }
497
506
  };
498
507
 
499
508
  // src/rest/Routes.ts
500
509
  var Routes = {
501
510
  //base: "http://localhost:80/api/v1",
502
- base: "https://duque-api.up.railway.app/api/v1",
511
+ base: "https://duqueapi.shardweb.app/api/v1",
503
512
  field: (field) => `/${field}`,
504
513
  fields: (...fields) => `${fields.join("/")}`,
505
514
  guilds: {
@@ -604,9 +613,10 @@ var import_undici = require("undici");
604
613
  import_dotenv.default.config();
605
614
 
606
615
  // src/structures/automaticmessage/AutomaticMessage.ts
616
+ var _AutomaticMessage_instances, updateInternals_fn;
607
617
  var AutomaticMessage = class {
608
618
  constructor(data, manager) {
609
- __publicField(this, "_id");
619
+ __privateAdd(this, _AutomaticMessage_instances);
610
620
  __publicField(this, "id");
611
621
  __publicField(this, "type");
612
622
  __publicField(this, "admin_id");
@@ -625,7 +635,6 @@ var AutomaticMessage = class {
625
635
  this.manager = manager;
626
636
  this.guild = manager.guild;
627
637
  this.rest = manager.rest;
628
- this._id = data?._id;
629
638
  this.id = data?.id;
630
639
  this.type = data?.type;
631
640
  this.admin_id = data?.admin_id;
@@ -640,12 +649,7 @@ var AutomaticMessage = class {
640
649
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
641
650
  }
642
651
  async fetch() {
643
- const route = Routes.guilds.resource(this.guild.id, "automatic_messages", this._id);
644
- const response = await this.rest.request({
645
- method: "get",
646
- url: route
647
- });
648
- return this._updateInternals(response);
652
+ return this.manager.fetch(this.id);
649
653
  }
650
654
  async addChannelId(...id) {
651
655
  const ids = [.../* @__PURE__ */ new Set([...this.channel_ids, ...id])];
@@ -657,39 +661,28 @@ var AutomaticMessage = class {
657
661
  return this.update({ channel_ids: ids });
658
662
  }
659
663
  async update(data) {
664
+ this.manager.cache.set(this.id, { ...this, ...data, id: this.id });
660
665
  const route = Routes.guilds.get(this.guild.id);
661
666
  const response = await this.rest.request({
662
667
  method: "patch",
663
668
  url: route,
664
- payload: { automatic_messages: this.manager.cache.toArray() }
669
+ payload: { automatic_messages: this.manager.toJSON() }
665
670
  });
666
- return this._updateInternals(response);
671
+ return __privateMethod(this, _AutomaticMessage_instances, updateInternals_fn).call(this, response);
667
672
  }
668
673
  async delete() {
669
- this.manager.cache.delete(this._id);
674
+ this.manager.cache.delete(this.id);
675
+ this.guild.automatic_messages = this.manager.cache.toArray();
670
676
  const route = Routes.guilds.get(this.guild.id);
671
677
  const response = await this.rest.request({
672
678
  method: "patch",
673
679
  url: route,
674
- payload: { automatic_messages: this.manager.cache.toArray() }
680
+ payload: { automatic_messages: this.manager.toJSON() }
675
681
  });
676
682
  return this.manager.set(response.automatic_messages);
677
683
  }
678
- _updateInternals(data) {
679
- for (let key in data) {
680
- if (key === "_id" || key === "createdAt") continue;
681
- if (key in this) {
682
- this[key] = data[key];
683
- }
684
- }
685
- this.updatedAt = /* @__PURE__ */ new Date();
686
- this.createdAt = new Date(data.createdAt);
687
- this.manager._add(this);
688
- return this;
689
- }
690
684
  toJSON() {
691
685
  return {
692
- _id: this._id,
693
686
  id: this.id,
694
687
  type: this.type,
695
688
  admin_id: this.admin_id,
@@ -705,6 +698,20 @@ var AutomaticMessage = class {
705
698
  };
706
699
  }
707
700
  };
701
+ _AutomaticMessage_instances = new WeakSet();
702
+ updateInternals_fn = function(data) {
703
+ const _this = data?.automatic_messages?.find((m) => m.id === this.id);
704
+ for (let key in _this) {
705
+ if (key === "id" || key === "createdAt") continue;
706
+ if (key in this) {
707
+ this[key] = _this[key];
708
+ }
709
+ }
710
+ this.updatedAt = /* @__PURE__ */ new Date();
711
+ this.createdAt = new Date(data.createdAt);
712
+ this.manager._add(data.automatic_messages);
713
+ return this;
714
+ };
708
715
 
709
716
  // src/utils/randomKeyGenerator.ts
710
717
  var import_crypto = require("crypto");
@@ -718,25 +725,19 @@ var AutomaticMessageManager = class extends BaseManager {
718
725
  super(guild);
719
726
  this.guild = guild;
720
727
  this.rest = guild.rest;
721
- this.base_url = Routes.guilds.resource(guild.id, "automatic_messages");
728
+ this.base_url = Routes.guilds.resource(guild.id);
722
729
  this.cache = new Collection();
723
730
  if (guild.automatic_messages && guild.automatic_messages.length !== 0) this.set(guild.automatic_messages);
724
731
  else this.guild.automatic_messages = [];
725
732
  }
726
733
  async fetch(messageId) {
727
734
  const route = this.base_url;
728
- if (messageId) {
729
- const response2 = await this.rest.request({
730
- method: "get",
731
- url: `${route}`
732
- });
733
- return this._add(response2).find((m) => m.id === messageId);
734
- }
735
735
  const response = await this.rest.request({
736
736
  method: "get",
737
737
  url: route
738
738
  });
739
- return this._add(response.automatic_messages);
739
+ this._add(response.automatic_messages);
740
+ return this.cache;
740
741
  }
741
742
  async create(data) {
742
743
  if (!data.type) throw new Error(`Missing message's type.`);
@@ -763,6 +764,7 @@ var AutomaticMessageManager = class extends BaseManager {
763
764
  if (data instanceof AutomaticMessage) this.cache.set(data.id, data);
764
765
  else this.cache.set(data.id, new AutomaticMessage(data, this));
765
766
  }
767
+ this.guild.automatic_messages = this.cache.toArray();
766
768
  return this.cache;
767
769
  }
768
770
  set(data) {
@@ -791,6 +793,10 @@ var AutomaticMessageManager = class extends BaseManager {
791
793
  });
792
794
  return response;
793
795
  }
796
+ toJSON() {
797
+ [...this.cache.values()].map((m) => console.log(m instanceof AutomaticMessage));
798
+ return this.cache.toArray();
799
+ }
794
800
  };
795
801
  // Annotate the CommonJS export names for ESM import in node:
796
802
  0 && (module.exports = {
@@ -4,6 +4,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __typeError = (msg) => {
8
+ throw TypeError(msg);
9
+ };
7
10
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
11
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
12
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
@@ -31,6 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
34
  mod
32
35
  ));
33
36
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
37
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
38
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
39
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
34
40
 
35
41
  // node_modules/dotenv/package.json
36
42
  var require_package = __commonJS({
@@ -487,12 +493,15 @@ var BaseManager = class {
487
493
  this.rest = guild.rest;
488
494
  this.cache = new Collection();
489
495
  }
496
+ toJSON() {
497
+ return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
498
+ }
490
499
  };
491
500
 
492
501
  // src/rest/Routes.ts
493
502
  var Routes = {
494
503
  //base: "http://localhost:80/api/v1",
495
- base: "https://duque-api.up.railway.app/api/v1",
504
+ base: "https://duqueapi.shardweb.app/api/v1",
496
505
  field: (field) => `/${field}`,
497
506
  fields: (...fields) => `${fields.join("/")}`,
498
507
  guilds: {
@@ -597,9 +606,10 @@ import { request, Headers } from "undici";
597
606
  import_dotenv.default.config();
598
607
 
599
608
  // src/structures/automaticmessage/AutomaticMessage.ts
609
+ var _AutomaticMessage_instances, updateInternals_fn;
600
610
  var AutomaticMessage = class {
601
611
  constructor(data, manager) {
602
- __publicField(this, "_id");
612
+ __privateAdd(this, _AutomaticMessage_instances);
603
613
  __publicField(this, "id");
604
614
  __publicField(this, "type");
605
615
  __publicField(this, "admin_id");
@@ -618,7 +628,6 @@ var AutomaticMessage = class {
618
628
  this.manager = manager;
619
629
  this.guild = manager.guild;
620
630
  this.rest = manager.rest;
621
- this._id = data?._id;
622
631
  this.id = data?.id;
623
632
  this.type = data?.type;
624
633
  this.admin_id = data?.admin_id;
@@ -633,12 +642,7 @@ var AutomaticMessage = class {
633
642
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
634
643
  }
635
644
  async fetch() {
636
- const route = Routes.guilds.resource(this.guild.id, "automatic_messages", this._id);
637
- const response = await this.rest.request({
638
- method: "get",
639
- url: route
640
- });
641
- return this._updateInternals(response);
645
+ return this.manager.fetch(this.id);
642
646
  }
643
647
  async addChannelId(...id) {
644
648
  const ids = [.../* @__PURE__ */ new Set([...this.channel_ids, ...id])];
@@ -650,39 +654,28 @@ var AutomaticMessage = class {
650
654
  return this.update({ channel_ids: ids });
651
655
  }
652
656
  async update(data) {
657
+ this.manager.cache.set(this.id, { ...this, ...data, id: this.id });
653
658
  const route = Routes.guilds.get(this.guild.id);
654
659
  const response = await this.rest.request({
655
660
  method: "patch",
656
661
  url: route,
657
- payload: { automatic_messages: this.manager.cache.toArray() }
662
+ payload: { automatic_messages: this.manager.toJSON() }
658
663
  });
659
- return this._updateInternals(response);
664
+ return __privateMethod(this, _AutomaticMessage_instances, updateInternals_fn).call(this, response);
660
665
  }
661
666
  async delete() {
662
- this.manager.cache.delete(this._id);
667
+ this.manager.cache.delete(this.id);
668
+ this.guild.automatic_messages = this.manager.cache.toArray();
663
669
  const route = Routes.guilds.get(this.guild.id);
664
670
  const response = await this.rest.request({
665
671
  method: "patch",
666
672
  url: route,
667
- payload: { automatic_messages: this.manager.cache.toArray() }
673
+ payload: { automatic_messages: this.manager.toJSON() }
668
674
  });
669
675
  return this.manager.set(response.automatic_messages);
670
676
  }
671
- _updateInternals(data) {
672
- for (let key in data) {
673
- if (key === "_id" || key === "createdAt") continue;
674
- if (key in this) {
675
- this[key] = data[key];
676
- }
677
- }
678
- this.updatedAt = /* @__PURE__ */ new Date();
679
- this.createdAt = new Date(data.createdAt);
680
- this.manager._add(this);
681
- return this;
682
- }
683
677
  toJSON() {
684
678
  return {
685
- _id: this._id,
686
679
  id: this.id,
687
680
  type: this.type,
688
681
  admin_id: this.admin_id,
@@ -698,6 +691,20 @@ var AutomaticMessage = class {
698
691
  };
699
692
  }
700
693
  };
694
+ _AutomaticMessage_instances = new WeakSet();
695
+ updateInternals_fn = function(data) {
696
+ const _this = data?.automatic_messages?.find((m) => m.id === this.id);
697
+ for (let key in _this) {
698
+ if (key === "id" || key === "createdAt") continue;
699
+ if (key in this) {
700
+ this[key] = _this[key];
701
+ }
702
+ }
703
+ this.updatedAt = /* @__PURE__ */ new Date();
704
+ this.createdAt = new Date(data.createdAt);
705
+ this.manager._add(data.automatic_messages);
706
+ return this;
707
+ };
701
708
 
702
709
  // src/utils/randomKeyGenerator.ts
703
710
  import { randomBytes } from "crypto";
@@ -711,25 +718,19 @@ var AutomaticMessageManager = class extends BaseManager {
711
718
  super(guild);
712
719
  this.guild = guild;
713
720
  this.rest = guild.rest;
714
- this.base_url = Routes.guilds.resource(guild.id, "automatic_messages");
721
+ this.base_url = Routes.guilds.resource(guild.id);
715
722
  this.cache = new Collection();
716
723
  if (guild.automatic_messages && guild.automatic_messages.length !== 0) this.set(guild.automatic_messages);
717
724
  else this.guild.automatic_messages = [];
718
725
  }
719
726
  async fetch(messageId) {
720
727
  const route = this.base_url;
721
- if (messageId) {
722
- const response2 = await this.rest.request({
723
- method: "get",
724
- url: `${route}`
725
- });
726
- return this._add(response2).find((m) => m.id === messageId);
727
- }
728
728
  const response = await this.rest.request({
729
729
  method: "get",
730
730
  url: route
731
731
  });
732
- return this._add(response.automatic_messages);
732
+ this._add(response.automatic_messages);
733
+ return this.cache;
733
734
  }
734
735
  async create(data) {
735
736
  if (!data.type) throw new Error(`Missing message's type.`);
@@ -756,6 +757,7 @@ var AutomaticMessageManager = class extends BaseManager {
756
757
  if (data instanceof AutomaticMessage) this.cache.set(data.id, data);
757
758
  else this.cache.set(data.id, new AutomaticMessage(data, this));
758
759
  }
760
+ this.guild.automatic_messages = this.cache.toArray();
759
761
  return this.cache;
760
762
  }
761
763
  set(data) {
@@ -784,6 +786,10 @@ var AutomaticMessageManager = class extends BaseManager {
784
786
  });
785
787
  return response;
786
788
  }
789
+ toJSON() {
790
+ [...this.cache.values()].map((m) => console.log(m instanceof AutomaticMessage));
791
+ return this.cache.toArray();
792
+ }
787
793
  };
788
794
  export {
789
795
  AutomaticMessageManager
@@ -1,4 +1,4 @@
1
- export { k as BaseManager } from '../index-BHHXH2xN.mjs';
1
+ export { k as BaseManager } from '../index-DjHimKUy.mjs';
2
2
  import '../structures/Collection.mjs';
3
3
  import '../types/api/APIAdvert.mjs';
4
4
  import '../types/api/APIBaseChannel.mjs';
@@ -18,3 +18,4 @@ import '../types/api/APILogEntry.mjs';
18
18
  import '../types/api/APIMinesGame.mjs';
19
19
  import '../types/api/APIVipMember.mjs';
20
20
  import 'events';
21
+ import '../types/api/APITournament.mjs';
@@ -1,4 +1,4 @@
1
- export { k as BaseManager } from '../index-C87LbIta.js';
1
+ export { k as BaseManager } from '../index-BPxglVSk.js';
2
2
  import '../structures/Collection.js';
3
3
  import '../types/api/APIAdvert.js';
4
4
  import '../types/api/APIBaseChannel.js';
@@ -18,3 +18,4 @@ import '../types/api/APILogEntry.js';
18
18
  import '../types/api/APIMinesGame.js';
19
19
  import '../types/api/APIVipMember.js';
20
20
  import 'events';
21
+ import '../types/api/APITournament.js';
@@ -122,6 +122,9 @@ var BaseManager = class {
122
122
  this.rest = guild.rest;
123
123
  this.cache = new Collection();
124
124
  }
125
+ toJSON() {
126
+ return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
127
+ }
125
128
  };
126
129
  // Annotate the CommonJS export names for ESM import in node:
127
130
  0 && (module.exports = {
@@ -98,6 +98,9 @@ var BaseManager = class {
98
98
  this.rest = guild.rest;
99
99
  this.cache = new Collection();
100
100
  }
101
+ toJSON() {
102
+ return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
103
+ }
101
104
  };
102
105
  export {
103
106
  BaseManager
@@ -1,4 +1,4 @@
1
- export { F as FetchOptions, G as GuildBetManager } from '../../index-BHHXH2xN.mjs';
1
+ export { F as FetchOptions, G as GuildBetManager } from '../../index-DjHimKUy.mjs';
2
2
  import '../../structures/Collection.mjs';
3
3
  import '../../types/api/APIAdvert.mjs';
4
4
  import '../../types/api/APIBaseChannel.mjs';
@@ -18,3 +18,4 @@ import '../../types/api/APILogEntry.mjs';
18
18
  import '../../types/api/APIMinesGame.mjs';
19
19
  import '../../types/api/APIVipMember.mjs';
20
20
  import 'events';
21
+ import '../../types/api/APITournament.mjs';
@@ -1,4 +1,4 @@
1
- export { F as FetchOptions, G as GuildBetManager } from '../../index-C87LbIta.js';
1
+ export { F as FetchOptions, G as GuildBetManager } from '../../index-BPxglVSk.js';
2
2
  import '../../structures/Collection.js';
3
3
  import '../../types/api/APIAdvert.js';
4
4
  import '../../types/api/APIBaseChannel.js';
@@ -18,3 +18,4 @@ import '../../types/api/APILogEntry.js';
18
18
  import '../../types/api/APIMinesGame.js';
19
19
  import '../../types/api/APIVipMember.js';
20
20
  import 'events';
21
+ import '../../types/api/APITournament.js';
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __typeError = (msg) => {
9
+ throw TypeError(msg);
10
+ };
8
11
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
12
  var __commonJS = (cb, mod) => function __require() {
10
13
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
@@ -31,6 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
34
  ));
32
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
36
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
37
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
38
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
39
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
34
40
 
35
41
  // node_modules/dotenv/package.json
36
42
  var require_package = __commonJS({
@@ -401,7 +407,7 @@ module.exports = __toCommonJS(GuildBetManager_exports);
401
407
  // src/rest/Routes.ts
402
408
  var Routes = {
403
409
  //base: "http://localhost:80/api/v1",
404
- base: "https://duque-api.up.railway.app/api/v1",
410
+ base: "https://duqueapi.shardweb.app/api/v1",
405
411
  field: (field) => `/${field}`,
406
412
  fields: (...fields) => `${fields.join("/")}`,
407
413
  guilds: {
@@ -600,6 +606,9 @@ var BaseManager = class {
600
606
  this.rest = guild.rest;
601
607
  this.cache = new Collection();
602
608
  }
609
+ toJSON() {
610
+ return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
611
+ }
603
612
  };
604
613
 
605
614
  // src/managers/player/PlayerManager.ts
@@ -671,8 +680,10 @@ var PlayerManager = class extends Collection {
671
680
  };
672
681
 
673
682
  // src/structures/bet/GuildBet.ts
683
+ var _GuildBet_instances, updateInternals_fn;
674
684
  var GuildBet = class {
675
685
  constructor(data, manager) {
686
+ __privateAdd(this, _GuildBet_instances);
676
687
  /** The bet's type */
677
688
  __publicField(this, "type");
678
689
  /** The bet's mode */
@@ -751,7 +762,7 @@ var GuildBet = class {
751
762
  async fetch() {
752
763
  const route = Routes.guilds.bets.get(this.guild.id, this._id);
753
764
  const response = await this.rest.request({ url: route, method: "GET" });
754
- return this._updateInternals(response);
765
+ return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
755
766
  }
756
767
  async addPlayer(player, queue_type) {
757
768
  if (this.players.length === 2) return this;
@@ -788,7 +799,7 @@ var GuildBet = class {
788
799
  const payload = data;
789
800
  const route = Routes.guilds.bets.update(this.guild.id, this._id);
790
801
  const response = await this.rest.request({ method: "patch", url: route, payload });
791
- return this._updateInternals(response);
802
+ return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
792
803
  }
793
804
  async delete() {
794
805
  const route = Routes.guilds.bets.delete(this.manager.guild.id, this._id);
@@ -800,33 +811,6 @@ var GuildBet = class {
800
811
  this.manager.cache.delete(this._id);
801
812
  return response;
802
813
  }
803
- _updateInternals(data) {
804
- for (let key in data) {
805
- if (key === "_id" || key === "createdAt") continue;
806
- if (key === "messages") {
807
- this.messages.set(data[key]);
808
- continue;
809
- }
810
- if (key === "players") {
811
- this.players._set(data[key]);
812
- continue;
813
- }
814
- if (key in this) {
815
- this[key] = data[key];
816
- }
817
- }
818
- if (data?.messages?.length !== 0) {
819
- if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
820
- else {
821
- this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
822
- this.messages.set(data.messages);
823
- }
824
- }
825
- this.updatedAt = /* @__PURE__ */ new Date();
826
- this.createdAt = new Date(data.createdAt);
827
- this.manager.set(this);
828
- return this;
829
- }
830
814
  toJSON() {
831
815
  let json = {};
832
816
  for (const [key, value] of Object.entries(this)) {
@@ -843,6 +827,34 @@ var GuildBet = class {
843
827
  };
844
828
  }
845
829
  };
830
+ _GuildBet_instances = new WeakSet();
831
+ updateInternals_fn = function(data) {
832
+ for (let key in data) {
833
+ if (key === "_id" || key === "createdAt") continue;
834
+ if (key === "messages") {
835
+ this.messages.set(data[key]);
836
+ continue;
837
+ }
838
+ if (key === "players") {
839
+ this.players._set(data[key]);
840
+ continue;
841
+ }
842
+ if (key in this) {
843
+ this[key] = data[key];
844
+ }
845
+ }
846
+ if (data?.messages?.length !== 0) {
847
+ if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
848
+ else {
849
+ this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
850
+ this.messages.set(data.messages);
851
+ }
852
+ }
853
+ this.updatedAt = /* @__PURE__ */ new Date();
854
+ this.createdAt = new Date(data.createdAt);
855
+ this.manager.set(this);
856
+ return this;
857
+ };
846
858
 
847
859
  // src/managers/message/MessagesManager.ts
848
860
  var MessagesManager = class {