@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
@@ -514,6 +514,9 @@ var BaseManager = class {
514
514
  this.rest = guild.rest;
515
515
  this.cache = new Collection();
516
516
  }
517
+ toJSON() {
518
+ return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
519
+ }
517
520
  };
518
521
 
519
522
  // src/managers/player/PlayerManager.ts
@@ -587,7 +590,7 @@ var PlayerManager = class extends Collection {
587
590
  // src/rest/Routes.ts
588
591
  var Routes = {
589
592
  //base: "http://localhost:80/api/v1",
590
- base: "https://duque-api.up.railway.app/api/v1",
593
+ base: "https://duqueapi.shardweb.app/api/v1",
591
594
  field: (field) => `/${field}`,
592
595
  fields: (...fields) => `${fields.join("/")}`,
593
596
  guilds: {
@@ -743,7 +746,8 @@ var Assertion = class {
743
746
  var import_undici = require("undici");
744
747
 
745
748
  // src/structures/betuser/GuildBetUser.ts
746
- var GuildBetUser = class _GuildBetUser {
749
+ var _GuildBetUser_instances, updateInternals_fn;
750
+ var _GuildBetUser = class _GuildBetUser {
747
751
  /**
748
752
  * Bet user
749
753
  * @param data The user's data
@@ -751,6 +755,7 @@ var GuildBetUser = class _GuildBetUser {
751
755
  * @param rest The rest client
752
756
  */
753
757
  constructor(data, manager) {
758
+ __privateAdd(this, _GuildBetUser_instances);
754
759
  /** User daily */
755
760
  __publicField(this, "daily");
756
761
  __publicField(this, "profile");
@@ -845,7 +850,7 @@ var GuildBetUser = class _GuildBetUser {
845
850
  url: route,
846
851
  payload
847
852
  });
848
- return this._updateInternals(response);
853
+ return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
849
854
  }
850
855
  async updateProfile(data) {
851
856
  const _data = {
@@ -865,20 +870,7 @@ var GuildBetUser = class _GuildBetUser {
865
870
  url: route,
866
871
  payload: _data
867
872
  });
868
- return this._updateInternals(response);
869
- }
870
- _updateInternals(data) {
871
- for (let key in data) {
872
- if (key === "id" || key === "createdAt") continue;
873
- if (key in this) {
874
- this[key] = data[key];
875
- }
876
- }
877
- this.updatedAt = /* @__PURE__ */ new Date();
878
- this.createdAt = new Date(data.createdAt);
879
- this.manager.set(this);
880
- this.rest.emit("betuserUpdate", this);
881
- return this;
873
+ return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
882
874
  }
883
875
  /**
884
876
  * Update certain property
@@ -915,7 +907,7 @@ var GuildBetUser = class _GuildBetUser {
915
907
  url: route,
916
908
  payload
917
909
  });
918
- return this._updateInternals(response);
910
+ return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
919
911
  }
920
912
  async _update(data) {
921
913
  const route = Routes.guilds.betusers.get(this.manager.guild.id, this.id);
@@ -925,7 +917,7 @@ var GuildBetUser = class _GuildBetUser {
925
917
  url: route,
926
918
  payload
927
919
  });
928
- return this._updateInternals(response);
920
+ return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
929
921
  }
930
922
  async delete() {
931
923
  const route = Routes.guilds.betusers.delete(this.manager.guild.id, this.id);
@@ -949,6 +941,21 @@ var GuildBetUser = class _GuildBetUser {
949
941
  return json;
950
942
  }
951
943
  };
944
+ _GuildBetUser_instances = new WeakSet();
945
+ updateInternals_fn = function(data) {
946
+ for (let key in data) {
947
+ if (key === "id" || key === "createdAt") continue;
948
+ if (key in this) {
949
+ this[key] = data[key];
950
+ }
951
+ }
952
+ this.updatedAt = /* @__PURE__ */ new Date();
953
+ this.createdAt = new Date(data.createdAt);
954
+ this.manager.set(this);
955
+ this.rest.emit("betuserUpdate", this);
956
+ return this;
957
+ };
958
+ var GuildBetUser = _GuildBetUser;
952
959
 
953
960
  // src/managers/betuser/GuildBetUserManager.ts
954
961
  var GuildBetUserManager = class extends BaseManager {
@@ -1026,7 +1033,8 @@ var GuildBetUserManager = class extends BaseManager {
1026
1033
  };
1027
1034
 
1028
1035
  // src/structures/mediator/GuildMediator.ts
1029
- var GuildMediator = class _GuildMediator {
1036
+ var _GuildMediator_instances, updateInternals_fn2;
1037
+ var _GuildMediator = class _GuildMediator {
1030
1038
  /**
1031
1039
  * Bet user
1032
1040
  * @param data The user's data
@@ -1034,6 +1042,7 @@ var GuildMediator = class _GuildMediator {
1034
1042
  * @param rest The rest client
1035
1043
  */
1036
1044
  constructor(data, manager) {
1045
+ __privateAdd(this, _GuildMediator_instances);
1037
1046
  /** User's name */
1038
1047
  __publicField(this, "id");
1039
1048
  __publicField(this, "guild_id");
@@ -1092,19 +1101,7 @@ var GuildMediator = class _GuildMediator {
1092
1101
  url: route,
1093
1102
  payload
1094
1103
  });
1095
- return this._updateInternals(response);
1096
- }
1097
- _updateInternals(data) {
1098
- for (let key in data) {
1099
- if (key === "id" || key === "createdAt") continue;
1100
- if (key in this) {
1101
- this[key] = data[key];
1102
- }
1103
- }
1104
- this.updatedAt = /* @__PURE__ */ new Date();
1105
- this.createdAt = new Date(data.createdAt);
1106
- this.manager.set(this);
1107
- return this;
1104
+ return __privateMethod(this, _GuildMediator_instances, updateInternals_fn2).call(this, response);
1108
1105
  }
1109
1106
  /**
1110
1107
  * Update certain property
@@ -1119,7 +1116,7 @@ var GuildMediator = class _GuildMediator {
1119
1116
  url: route,
1120
1117
  payload
1121
1118
  });
1122
- return this._updateInternals(response);
1119
+ return __privateMethod(this, _GuildMediator_instances, updateInternals_fn2).call(this, response);
1123
1120
  }
1124
1121
  async setPaymentlink(type, link) {
1125
1122
  const route = Routes.guilds.mediators.get(this.manager.guild.id, this.id);
@@ -1129,7 +1126,7 @@ var GuildMediator = class _GuildMediator {
1129
1126
  url: route,
1130
1127
  payload
1131
1128
  });
1132
- return this._updateInternals(response);
1129
+ return __privateMethod(this, _GuildMediator_instances, updateInternals_fn2).call(this, response);
1133
1130
  }
1134
1131
  async delete() {
1135
1132
  const route = Routes.guilds.mediators.delete(this.manager.guild.id, this.id);
@@ -1152,6 +1149,20 @@ var GuildMediator = class _GuildMediator {
1152
1149
  return json;
1153
1150
  }
1154
1151
  };
1152
+ _GuildMediator_instances = new WeakSet();
1153
+ updateInternals_fn2 = function(data) {
1154
+ for (let key in data) {
1155
+ if (key === "id" || key === "createdAt") continue;
1156
+ if (key in this) {
1157
+ this[key] = data[key];
1158
+ }
1159
+ }
1160
+ this.updatedAt = /* @__PURE__ */ new Date();
1161
+ this.createdAt = new Date(data.createdAt);
1162
+ this.manager.set(this);
1163
+ return this;
1164
+ };
1165
+ var GuildMediator = _GuildMediator;
1155
1166
 
1156
1167
  // src/managers/mediator/GuildMediatorManager.ts
1157
1168
  var GuildMediatorManager = class extends BaseManager {
@@ -1236,14 +1247,150 @@ var GuildMediatorManager = class extends BaseManager {
1236
1247
  }
1237
1248
  };
1238
1249
 
1250
+ // src/structures/tournament/Tournament.ts
1251
+ var _Tournament_instances, updateInternals_fn3;
1252
+ var Tournament = class {
1253
+ constructor(data, manager) {
1254
+ __privateAdd(this, _Tournament_instances);
1255
+ __publicField(this, "_id");
1256
+ __publicField(this, "guild_id");
1257
+ __publicField(this, "type");
1258
+ __publicField(this, "max_teams");
1259
+ __publicField(this, "teams");
1260
+ __publicField(this, "message");
1261
+ __publicField(this, "message_id");
1262
+ __publicField(this, "status");
1263
+ __publicField(this, "createdAt");
1264
+ __publicField(this, "updatedAt");
1265
+ __publicField(this, "guild");
1266
+ __publicField(this, "rest");
1267
+ __publicField(this, "manager");
1268
+ __publicField(this, "data");
1269
+ this.manager = manager;
1270
+ this.guild = manager.guild;
1271
+ this.rest = manager.rest;
1272
+ this.guild_id = data?.guild_id;
1273
+ this.type = data?.type;
1274
+ this.teams = data?.teams;
1275
+ this.message = data?.message;
1276
+ this.message_id = data?.message_id;
1277
+ this.status = data?.status;
1278
+ this.createdAt = data?.createdAt ? new Date(data?.createdAt) : /* @__PURE__ */ new Date();
1279
+ this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
1280
+ this.data = data;
1281
+ }
1282
+ async fetch() {
1283
+ const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
1284
+ const response = await this.rest.request({
1285
+ method: "get",
1286
+ url: route
1287
+ });
1288
+ return __privateMethod(this, _Tournament_instances, updateInternals_fn3).call(this, response);
1289
+ }
1290
+ async update(data) {
1291
+ const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
1292
+ const response = await this.rest.request({
1293
+ method: "patch",
1294
+ url: route,
1295
+ payload: data
1296
+ });
1297
+ return __privateMethod(this, _Tournament_instances, updateInternals_fn3).call(this, response);
1298
+ }
1299
+ toJSON() {
1300
+ return {
1301
+ guild_id: this.guild_id,
1302
+ type: this.type,
1303
+ max_teams: this.max_teams,
1304
+ teams: this.teams,
1305
+ message: this.message,
1306
+ message_id: this.message_id,
1307
+ status: this.status,
1308
+ createdAt: this.createdAt ? new Date(this?.createdAt) : /* @__PURE__ */ new Date(),
1309
+ updatedAt: this.updatedAt ? new Date(this?.updatedAt) : /* @__PURE__ */ new Date()
1310
+ };
1311
+ }
1312
+ };
1313
+ _Tournament_instances = new WeakSet();
1314
+ updateInternals_fn3 = function(data) {
1315
+ for (let key in data) {
1316
+ if (key === "id" || key === "createdAt") continue;
1317
+ if (key in this) {
1318
+ this[key] = data[key];
1319
+ }
1320
+ }
1321
+ this.updatedAt = /* @__PURE__ */ new Date();
1322
+ this.createdAt = new Date(data.createdAt);
1323
+ this.manager._add(this);
1324
+ return this;
1325
+ };
1326
+
1327
+ // src/managers/tournament/TournamentManager.ts
1328
+ var TournamentManager = class extends BaseManager {
1329
+ constructor(guild) {
1330
+ super(guild);
1331
+ this.guild = guild;
1332
+ this.rest = guild.rest;
1333
+ this.base_url = Routes.guilds.resource(guild.id, "tournaments");
1334
+ this.cache = new Collection();
1335
+ }
1336
+ async fetch(options) {
1337
+ if (options && options.cache) return this.cache;
1338
+ if (options && options.tournamentId) {
1339
+ const response2 = await this.rest.request({
1340
+ method: "GET",
1341
+ url: Routes.fields(this.base_url, options.tournamentId)
1342
+ });
1343
+ const tournament = new Tournament(response2, this);
1344
+ this._add(tournament);
1345
+ return tournament;
1346
+ }
1347
+ const response = await this.rest.request({
1348
+ method: "GET",
1349
+ url: this.base_url
1350
+ });
1351
+ return this.set(response);
1352
+ }
1353
+ set(data) {
1354
+ this.cache.clear();
1355
+ if (Array.isArray(data)) {
1356
+ for (let _m of data) {
1357
+ if (!_m._id) continue;
1358
+ if (_m instanceof Tournament) this.cache.set(_m._id, _m);
1359
+ else this.cache.set(_m._id, new Tournament(_m, this));
1360
+ }
1361
+ } else {
1362
+ if (!data._id) return this.cache;
1363
+ if (data instanceof Tournament) this.cache.set(data._id, data);
1364
+ else this.cache.set(data._id, new Tournament(data, this));
1365
+ }
1366
+ return this.cache;
1367
+ }
1368
+ _add(data) {
1369
+ if (Array.isArray(data)) {
1370
+ for (let _m of data) {
1371
+ if (!_m._id) continue;
1372
+ if (_m instanceof Tournament) this.cache.set(_m._id, _m);
1373
+ else this.cache.set(_m._id, new Tournament(_m, this));
1374
+ }
1375
+ } else {
1376
+ if (!data._id) return this.cache;
1377
+ if (data instanceof Tournament) this.cache.set(data._id, data);
1378
+ else this.cache.set(data._id, new Tournament(data, this));
1379
+ }
1380
+ return this.cache;
1381
+ }
1382
+ };
1383
+
1239
1384
  // src/structures/guild/Guild.ts
1240
- var Guild = class {
1385
+ var _Guild_instances, updateInternals_fn4;
1386
+ var Guild2 = class {
1241
1387
  /**
1242
1388
  * The guild structure
1243
1389
  * @param data The guild's data
1244
1390
  * @param rest The rest client
1245
1391
  */
1246
1392
  constructor(data, rest) {
1393
+ __privateAdd(this, _Guild_instances);
1247
1394
  /** The data of this guild */
1248
1395
  __publicField(this, "data");
1249
1396
  /** The rest client */
@@ -1269,6 +1416,7 @@ var Guild = class {
1269
1416
  __publicField(this, "roulette_settings");
1270
1417
  /** Guild Prefix */
1271
1418
  __publicField(this, "prefix");
1419
+ __publicField(this, "prefixes");
1272
1420
  /** Guild Creation Date */
1273
1421
  __publicField(this, "createdAt");
1274
1422
  /** Guild Updated Date */
@@ -1288,6 +1436,7 @@ var Guild = class {
1288
1436
  __publicField(this, "mediators");
1289
1437
  __publicField(this, "automatic_messages");
1290
1438
  __publicField(this, "automaticMessagesManager");
1439
+ __publicField(this, "tournaments");
1291
1440
  __publicField(this, "adverts");
1292
1441
  __publicField(this, "codes");
1293
1442
  __publicField(this, "coin_symbol");
@@ -1302,6 +1451,7 @@ var Guild = class {
1302
1451
  this.scores = data?.scores;
1303
1452
  this.codes = data?.codes;
1304
1453
  this.prefix = data?.prefix;
1454
+ this.prefixes = data?.prefixes;
1305
1455
  this.status = data?.status;
1306
1456
  this.tickets_configuration = data?.tickets_configuration;
1307
1457
  this.automatic_messages = data?.automatic_messages;
@@ -1322,6 +1472,7 @@ var Guild = class {
1322
1472
  this.bets = new GuildBetManager(this);
1323
1473
  this.mediators = new GuildMediatorManager(this);
1324
1474
  this.automaticMessagesManager = new AutomaticMessageManager(this);
1475
+ this.tournaments = new TournamentManager(this);
1325
1476
  this.adverts = [];
1326
1477
  for (let _adv of data?.adverts || []) {
1327
1478
  this.adverts.push({
@@ -1358,7 +1509,7 @@ var Guild = class {
1358
1509
  url: route,
1359
1510
  payload: { channels }
1360
1511
  });
1361
- this._updateInternals(response);
1512
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1362
1513
  return response.channels.find((t) => t.type === type);
1363
1514
  }
1364
1515
  }
@@ -1373,7 +1524,7 @@ var Guild = class {
1373
1524
  url: route,
1374
1525
  payload: { permissions }
1375
1526
  });
1376
- this._updateInternals(response);
1527
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1377
1528
  return response.permissions.find((t) => t.type === type);
1378
1529
  }
1379
1530
  }
@@ -1382,26 +1533,26 @@ var Guild = class {
1382
1533
  const route = Routes.guilds.get(this.id);
1383
1534
  const payload = { adverts: this.adverts };
1384
1535
  const response = await this.rest.request({ method: "PATCH", url: route, payload });
1385
- return this._updateInternals(response);
1536
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1386
1537
  }
1387
1538
  async removeAdvert(advertId) {
1388
1539
  const route = Routes.guilds.get(this.id);
1389
1540
  const payload = { adverts: this.adverts.filter((a) => a._id !== advertId) };
1390
1541
  const response = await this.rest.request({ method: "PATCH", url: route, payload });
1391
- return this._updateInternals(response);
1542
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1392
1543
  }
1393
1544
  async createCode(data) {
1394
1545
  this.codes.push(data);
1395
1546
  const route = Routes.guilds.get(this.id);
1396
1547
  const payload = { codes: this.codes };
1397
1548
  const response = await this.rest.request({ method: "PATCH", url: route, payload });
1398
- return this._updateInternals(response);
1549
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1399
1550
  }
1400
1551
  async removeCode(codeId) {
1401
1552
  const route = Routes.guilds.get(this.id);
1402
1553
  const payload = { codes: this.codes.filter((a) => a._id !== codeId) };
1403
1554
  const response = await this.rest.request({ method: "PATCH", url: route, payload });
1404
- return this._updateInternals(response);
1555
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1405
1556
  }
1406
1557
  async addIdToChannel(type, id) {
1407
1558
  const channel = this.channels.find((c) => c.type === type);
@@ -1420,7 +1571,7 @@ var Guild = class {
1420
1571
  url: route,
1421
1572
  payload
1422
1573
  });
1423
- return this._updateInternals(response);
1574
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1424
1575
  }
1425
1576
  async setChannelIds(type, ...ids) {
1426
1577
  const channel = this.channels.find((c) => c.type === type);
@@ -1439,7 +1590,7 @@ var Guild = class {
1439
1590
  url: route,
1440
1591
  payload
1441
1592
  });
1442
- return this._updateInternals(response);
1593
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1443
1594
  }
1444
1595
  async removeIdInChannel(type, id) {
1445
1596
  const chIndex = this.channels.findIndex((c) => c.type === type);
@@ -1461,7 +1612,7 @@ var Guild = class {
1461
1612
  url: route,
1462
1613
  payload
1463
1614
  });
1464
- return this._updateInternals(response);
1615
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1465
1616
  }
1466
1617
  async updateRouletteSettings(data) {
1467
1618
  const _data = {
@@ -1518,58 +1669,21 @@ var Guild = class {
1518
1669
  this.logEntries.fetch(),
1519
1670
  this.betusers.fetch(),
1520
1671
  this.bets.fetch(),
1521
- this.mediators.fetch()
1672
+ this.mediators.fetch(),
1673
+ this.tournaments.fetch()
1522
1674
  ]);
1523
1675
  return this;
1524
1676
  }
1525
- _updateInternals(data) {
1526
- for (let key in data) {
1527
- if (key === "id" || key === "createdAt") continue;
1528
- if (key in this) {
1529
- this[key] = data[key];
1530
- }
1531
- if (key === "adverts") {
1532
- this.adverts = [];
1533
- for (let _adv of data.adverts) {
1534
- this.adverts.push({
1535
- _id: _adv._id,
1536
- admin_id: _adv.admin_id,
1537
- points_to_remove: _adv.points_to_remove,
1538
- role_id: _adv.role_id,
1539
- createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
1540
- updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
1541
- });
1542
- }
1543
- }
1544
- if (key === "code") {
1545
- this.codes = [];
1546
- for (let _adv of data.codes) {
1547
- this.codes.push({
1548
- _id: _adv._id,
1549
- admin_id: _adv.admin_id,
1550
- type: _adv.type,
1551
- add: _adv.add,
1552
- code: _adv.code,
1553
- expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
1554
- createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
1555
- updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
1556
- });
1557
- }
1558
- }
1559
- }
1560
- this.automaticMessagesManager.set(this.automatic_messages);
1561
- this.updatedAt = /* @__PURE__ */ new Date();
1562
- this.rest.guilds.cache.set(this.id, this);
1563
- this.rest.emit("guildUpdate", this);
1564
- return this;
1565
- }
1566
1677
  async fetch() {
1567
1678
  const route = Routes.guilds.get(this.id);
1568
1679
  const response = await this.rest.request({
1569
1680
  method: "get",
1570
1681
  url: route
1571
1682
  });
1572
- return this._updateInternals(response);
1683
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1684
+ }
1685
+ async reset() {
1686
+ return this.update({ reset: true });
1573
1687
  }
1574
1688
  async update(data) {
1575
1689
  const route = Routes.guilds.get(this.id);
@@ -1578,16 +1692,7 @@ var Guild = class {
1578
1692
  url: route,
1579
1693
  payload: data
1580
1694
  });
1581
- for (const k in response) {
1582
- if (k === "id" || k == "createdAt") continue;
1583
- if (k in this) {
1584
- this[k] = response[k];
1585
- }
1586
- }
1587
- this.updatedAt = /* @__PURE__ */ new Date();
1588
- this.rest.guilds.cache.set(this.id, this);
1589
- this.rest.emit("guildUpdate", this);
1590
- return this;
1695
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1591
1696
  }
1592
1697
  async setStatus(key, status) {
1593
1698
  Assertion.assertString(key);
@@ -1612,16 +1717,27 @@ var Guild = class {
1612
1717
  await this.update({ prices: this.prices });
1613
1718
  return this;
1614
1719
  }
1615
- async setPrefix(prefix) {
1616
- Assertion.assertString(prefix);
1617
- const route = Routes.fields(Routes.guilds.resource(this.id, "prefix"));
1618
- const payload = { set: prefix };
1720
+ async addPrefix(prefixes) {
1721
+ const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
1722
+ const _p = Array.isArray(prefixes) ? prefixes : [prefixes];
1723
+ const payload = { set: [.../* @__PURE__ */ new Set([...this.prefixes, ..._p])] };
1724
+ const response = await this.rest.request({
1725
+ method: "PATCH",
1726
+ url: route,
1727
+ payload
1728
+ });
1729
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1730
+ return this;
1731
+ }
1732
+ async setPrefix(prefixes) {
1733
+ const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
1734
+ const payload = { set: Array.isArray(prefixes) ? prefixes : [prefixes] };
1619
1735
  const response = await this.rest.request({
1620
1736
  method: "PATCH",
1621
1737
  url: route,
1622
1738
  payload
1623
1739
  });
1624
- this._updateInternals(response);
1740
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1625
1741
  return this;
1626
1742
  }
1627
1743
  async toggleDailyCategory(category) {
@@ -1641,7 +1757,7 @@ var Guild = class {
1641
1757
  url: route,
1642
1758
  payload
1643
1759
  });
1644
- this._updateInternals(response);
1760
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1645
1761
  return this;
1646
1762
  }
1647
1763
  async setScores(name, amount) {
@@ -1654,7 +1770,7 @@ var Guild = class {
1654
1770
  url: route,
1655
1771
  payload
1656
1772
  });
1657
- this._updateInternals(response);
1773
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1658
1774
  return this;
1659
1775
  }
1660
1776
  async toggleMode(mode) {
@@ -1679,10 +1795,52 @@ var Guild = class {
1679
1795
  url: route,
1680
1796
  payload
1681
1797
  });
1682
- this._updateInternals(response);
1798
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1683
1799
  return this;
1684
1800
  }
1685
1801
  };
1802
+ _Guild_instances = new WeakSet();
1803
+ updateInternals_fn4 = function(data) {
1804
+ for (let key in data) {
1805
+ if (key === "id" || key === "createdAt") continue;
1806
+ if (key in this) {
1807
+ this[key] = data[key];
1808
+ }
1809
+ if (key === "adverts") {
1810
+ this.adverts = [];
1811
+ for (let _adv of data.adverts) {
1812
+ this.adverts.push({
1813
+ _id: _adv._id,
1814
+ admin_id: _adv.admin_id,
1815
+ points_to_remove: _adv.points_to_remove,
1816
+ role_id: _adv.role_id,
1817
+ createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
1818
+ updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
1819
+ });
1820
+ }
1821
+ }
1822
+ if (key === "code") {
1823
+ this.codes = [];
1824
+ for (let _adv of data.codes) {
1825
+ this.codes.push({
1826
+ _id: _adv._id,
1827
+ admin_id: _adv.admin_id,
1828
+ type: _adv.type,
1829
+ add: _adv.add,
1830
+ code: _adv.code,
1831
+ expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
1832
+ createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
1833
+ updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
1834
+ });
1835
+ }
1836
+ }
1837
+ }
1838
+ this.automaticMessagesManager.set(this.automatic_messages);
1839
+ this.updatedAt = /* @__PURE__ */ new Date();
1840
+ this.rest.guilds.cache.set(this.id, this);
1841
+ this.rest.emit("guildUpdate", this);
1842
+ return this;
1843
+ };
1686
1844
 
1687
1845
  // src/managers/guild/GuildManager.ts
1688
1846
  var GuildManager = class {
@@ -1712,7 +1870,7 @@ var GuildManager = class {
1712
1870
  method: "get",
1713
1871
  url: route2
1714
1872
  });
1715
- const guild = new Guild(response2, this.rest);
1873
+ const guild = new Guild2(response2, this.rest);
1716
1874
  await guild._start().then((g) => {
1717
1875
  this.cache.set(g.id, g);
1718
1876
  });
@@ -1726,13 +1884,22 @@ var GuildManager = class {
1726
1884
  });
1727
1885
  for (let _guild of response) {
1728
1886
  if (!_guild.id) continue;
1729
- const guild = new Guild(_guild, this.rest);
1887
+ const guild = new Guild2(_guild, this.rest);
1730
1888
  await guild._start().then((g) => {
1731
1889
  this.cache.set(g.id, g);
1732
1890
  });
1733
1891
  }
1734
1892
  return this.cache;
1735
1893
  }
1894
+ async reset(guildId) {
1895
+ if (guildId) {
1896
+ return await this.cache.get(guildId).reset();
1897
+ }
1898
+ for (let [_, g] of this.cache) {
1899
+ await g.reset();
1900
+ }
1901
+ return this.cache;
1902
+ }
1736
1903
  async delete(options) {
1737
1904
  if (options && options.guildId) {
1738
1905
  Assertion.assertString(options.guildId);
@@ -1759,12 +1926,12 @@ var GuildManager = class {
1759
1926
  if (!data) return this.cache;
1760
1927
  if (Array.isArray(data)) {
1761
1928
  for (let _guild of data) {
1762
- const guild = new Guild(_guild, this.rest);
1929
+ const guild = new Guild2(_guild, this.rest);
1763
1930
  this.cache.set(guild.id, guild);
1764
1931
  }
1765
1932
  return this.cache;
1766
1933
  } else {
1767
- const guild = new Guild(data, this.rest);
1934
+ const guild = new Guild2(data, this.rest);
1768
1935
  this.cache.set(guild.id, guild);
1769
1936
  return guild;
1770
1937
  }
@@ -1775,8 +1942,10 @@ var GuildManager = class {
1775
1942
  import_dotenv.default.config();
1776
1943
 
1777
1944
  // src/structures/bet/GuildBet.ts
1945
+ var _GuildBet_instances, updateInternals_fn5;
1778
1946
  var GuildBet = class {
1779
1947
  constructor(data, manager) {
1948
+ __privateAdd(this, _GuildBet_instances);
1780
1949
  /** The bet's type */
1781
1950
  __publicField(this, "type");
1782
1951
  /** The bet's mode */
@@ -1855,7 +2024,7 @@ var GuildBet = class {
1855
2024
  async fetch() {
1856
2025
  const route = Routes.guilds.bets.get(this.guild.id, this._id);
1857
2026
  const response = await this.rest.request({ url: route, method: "GET" });
1858
- return this._updateInternals(response);
2027
+ return __privateMethod(this, _GuildBet_instances, updateInternals_fn5).call(this, response);
1859
2028
  }
1860
2029
  async addPlayer(player, queue_type) {
1861
2030
  if (this.players.length === 2) return this;
@@ -1892,7 +2061,7 @@ var GuildBet = class {
1892
2061
  const payload = data;
1893
2062
  const route = Routes.guilds.bets.update(this.guild.id, this._id);
1894
2063
  const response = await this.rest.request({ method: "patch", url: route, payload });
1895
- return this._updateInternals(response);
2064
+ return __privateMethod(this, _GuildBet_instances, updateInternals_fn5).call(this, response);
1896
2065
  }
1897
2066
  async delete() {
1898
2067
  const route = Routes.guilds.bets.delete(this.manager.guild.id, this._id);
@@ -1904,33 +2073,6 @@ var GuildBet = class {
1904
2073
  this.manager.cache.delete(this._id);
1905
2074
  return response;
1906
2075
  }
1907
- _updateInternals(data) {
1908
- for (let key in data) {
1909
- if (key === "_id" || key === "createdAt") continue;
1910
- if (key === "messages") {
1911
- this.messages.set(data[key]);
1912
- continue;
1913
- }
1914
- if (key === "players") {
1915
- this.players._set(data[key]);
1916
- continue;
1917
- }
1918
- if (key in this) {
1919
- this[key] = data[key];
1920
- }
1921
- }
1922
- if (data?.messages?.length !== 0) {
1923
- if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
1924
- else {
1925
- this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
1926
- this.messages.set(data.messages);
1927
- }
1928
- }
1929
- this.updatedAt = /* @__PURE__ */ new Date();
1930
- this.createdAt = new Date(data.createdAt);
1931
- this.manager.set(this);
1932
- return this;
1933
- }
1934
2076
  toJSON() {
1935
2077
  let json = {};
1936
2078
  for (const [key, value] of Object.entries(this)) {
@@ -1947,10 +2089,40 @@ var GuildBet = class {
1947
2089
  };
1948
2090
  }
1949
2091
  };
2092
+ _GuildBet_instances = new WeakSet();
2093
+ updateInternals_fn5 = function(data) {
2094
+ for (let key in data) {
2095
+ if (key === "_id" || key === "createdAt") continue;
2096
+ if (key === "messages") {
2097
+ this.messages.set(data[key]);
2098
+ continue;
2099
+ }
2100
+ if (key === "players") {
2101
+ this.players._set(data[key]);
2102
+ continue;
2103
+ }
2104
+ if (key in this) {
2105
+ this[key] = data[key];
2106
+ }
2107
+ }
2108
+ if (data?.messages?.length !== 0) {
2109
+ if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
2110
+ else {
2111
+ this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
2112
+ this.messages.set(data.messages);
2113
+ }
2114
+ }
2115
+ this.updatedAt = /* @__PURE__ */ new Date();
2116
+ this.createdAt = new Date(data.createdAt);
2117
+ this.manager.set(this);
2118
+ return this;
2119
+ };
1950
2120
 
1951
2121
  // src/structures/logentry/LogEntry.ts
2122
+ var _LogEntry_instances, updateInternals_fn6;
1952
2123
  var LogEntry = class {
1953
2124
  constructor(data, manager) {
2125
+ __privateAdd(this, _LogEntry_instances);
1954
2126
  __publicField(this, "_id");
1955
2127
  __publicField(this, "guild_id");
1956
2128
  __publicField(this, "user_id");
@@ -1986,9 +2158,9 @@ var LogEntry = class {
1986
2158
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
1987
2159
  }
1988
2160
  async fetch() {
1989
- const route = Routes.guilds.resources(this.guild.id, "logs", this._id);
2161
+ const route = Routes.fields("guilds", this.guild.id, "logentries", this._id);
1990
2162
  const response = await this.rest.request({ url: route, method: "GET" });
1991
- return this._updateInternals(response);
2163
+ return __privateMethod(this, _LogEntry_instances, updateInternals_fn6).call(this, response);
1992
2164
  }
1993
2165
  toJSON() {
1994
2166
  const json = {};
@@ -1999,21 +2171,23 @@ var LogEntry = class {
1999
2171
  }
2000
2172
  return json;
2001
2173
  }
2002
- _updateInternals(data) {
2003
- for (let key in data) {
2004
- if (key === "id" || key === "createdAt") continue;
2005
- if (key in this) {
2006
- this[key] = data[key];
2007
- }
2174
+ };
2175
+ _LogEntry_instances = new WeakSet();
2176
+ updateInternals_fn6 = function(data) {
2177
+ for (let key in data) {
2178
+ if (key === "id" || key === "createdAt") continue;
2179
+ if (key in this) {
2180
+ this[key] = data[key];
2008
2181
  }
2009
- this.updatedAt = /* @__PURE__ */ new Date();
2010
- this.manager.set(this);
2011
- return this;
2012
2182
  }
2183
+ this.updatedAt = /* @__PURE__ */ new Date();
2184
+ this.manager.set(this);
2185
+ return this;
2013
2186
  };
2014
2187
 
2015
2188
  // src/structures/match/GuildMatch.ts
2016
- var GuildMatch = class _GuildMatch {
2189
+ var _GuildMatch_instances, updateInternals_fn7;
2190
+ var _GuildMatch = class _GuildMatch {
2017
2191
  /**
2018
2192
  * GuildMatch match
2019
2193
  * @param data The match's data
@@ -2021,6 +2195,7 @@ var GuildMatch = class _GuildMatch {
2021
2195
  * @param rest The rest client
2022
2196
  */
2023
2197
  constructor(data, manager) {
2198
+ __privateAdd(this, _GuildMatch_instances);
2024
2199
  __publicField(this, "_id");
2025
2200
  __publicField(this, "selections");
2026
2201
  /** Match's type */
@@ -2104,7 +2279,7 @@ var GuildMatch = class _GuildMatch {
2104
2279
  method: "get",
2105
2280
  url: route
2106
2281
  });
2107
- return await this._updateInternals(response);
2282
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2108
2283
  }
2109
2284
  async addConfirmed(type, id) {
2110
2285
  const confirmed = this.confirmed.find((c) => c.type === type);
@@ -2126,7 +2301,7 @@ var GuildMatch = class _GuildMatch {
2126
2301
  url: route,
2127
2302
  payload: set
2128
2303
  });
2129
- return await this._updateInternals(response);
2304
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2130
2305
  }
2131
2306
  async setStatus(status) {
2132
2307
  Assertion.assertString(status);
@@ -2137,7 +2312,7 @@ var GuildMatch = class _GuildMatch {
2137
2312
  url: route,
2138
2313
  payload
2139
2314
  });
2140
- return await this._updateInternals(response);
2315
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2141
2316
  }
2142
2317
  async setWinners(players) {
2143
2318
  if (!Array.isArray(players)) players = [players];
@@ -2148,7 +2323,7 @@ var GuildMatch = class _GuildMatch {
2148
2323
  url: route,
2149
2324
  payload
2150
2325
  });
2151
- return await this._updateInternals(response);
2326
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2152
2327
  }
2153
2328
  async setLoser(players) {
2154
2329
  if (!Array.isArray(players)) players = [players];
@@ -2159,7 +2334,7 @@ var GuildMatch = class _GuildMatch {
2159
2334
  url: route,
2160
2335
  payload
2161
2336
  });
2162
- return await this._updateInternals(response);
2337
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2163
2338
  }
2164
2339
  async setMvps(...usersId) {
2165
2340
  const payload = { set: usersId };
@@ -2169,7 +2344,7 @@ var GuildMatch = class _GuildMatch {
2169
2344
  url: route,
2170
2345
  payload
2171
2346
  });
2172
- return await this._updateInternals(response);
2347
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2173
2348
  }
2174
2349
  async setRoomCreatorId(userId) {
2175
2350
  Assertion.assertString(userId);
@@ -2180,7 +2355,7 @@ var GuildMatch = class _GuildMatch {
2180
2355
  url: route,
2181
2356
  payload
2182
2357
  });
2183
- return await this._updateInternals(response);
2358
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2184
2359
  }
2185
2360
  async setRoomAdminId(userId) {
2186
2361
  Assertion.assertString(userId);
@@ -2191,7 +2366,7 @@ var GuildMatch = class _GuildMatch {
2191
2366
  url: route,
2192
2367
  payload
2193
2368
  });
2194
- return await this._updateInternals(response);
2369
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2195
2370
  }
2196
2371
  async kick(player) {
2197
2372
  this.players = this.players.filter((p) => p.id !== player.id);
@@ -2215,7 +2390,7 @@ var GuildMatch = class _GuildMatch {
2215
2390
  payload: data
2216
2391
  });
2217
2392
  this.rest.emit("matchUpdate", this, new _GuildMatch(response, this.manager));
2218
- return await this._updateInternals(response);
2393
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2219
2394
  }
2220
2395
  async delete() {
2221
2396
  const route = Routes.guilds.matches.resource(this.guild.id, this._id);
@@ -2241,35 +2416,38 @@ var GuildMatch = class _GuildMatch {
2241
2416
  messages: this?.messages instanceof MessagesManager ? this.messages?.cache?.toArray() : []
2242
2417
  };
2243
2418
  }
2244
- async _updateInternals(data) {
2245
- if (!data) return;
2246
- for (let key in data) {
2247
- if (key === "id" || key === "createdAt" || key === "messages") continue;
2248
- if (key in this) {
2249
- this[key] = data[key];
2250
- }
2251
- if (key === "bet") {
2252
- this.bet = this.guild.bets.set(data.bet);
2253
- }
2419
+ };
2420
+ _GuildMatch_instances = new WeakSet();
2421
+ updateInternals_fn7 = async function(data) {
2422
+ if (!data) return;
2423
+ for (let key in data) {
2424
+ if (key === "id" || key === "createdAt" || key === "messages") continue;
2425
+ if (key in this) {
2426
+ this[key] = data[key];
2254
2427
  }
2255
- if (data?.messages?.length !== 0) {
2256
- if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
2257
- else {
2258
- this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
2259
- this.messages.set(data.messages);
2260
- }
2428
+ if (key === "bet") {
2429
+ this.bet = this.guild.bets.set(data.bet);
2261
2430
  }
2262
- if (!(this.bet instanceof GuildBet) && data?.bet) {
2263
- this.bet = this.guild.bets.cache.get(data._id) ?? await this.guild.bets.fetch({ betId: data?.bet?._id });
2431
+ }
2432
+ if (data?.messages?.length !== 0) {
2433
+ if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
2434
+ else {
2435
+ this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
2436
+ this.messages.set(data.messages);
2264
2437
  }
2265
- this.updatedAt = /* @__PURE__ */ new Date();
2266
- this.manager.set(this);
2267
- return this;
2268
2438
  }
2439
+ if (!(this.bet instanceof GuildBet) && data?.bet) {
2440
+ this.bet = this.guild.bets.cache.get(data._id) ?? await this.guild.bets.fetch({ betId: data?.bet?._id });
2441
+ }
2442
+ this.updatedAt = /* @__PURE__ */ new Date();
2443
+ this.manager.set(this);
2444
+ return this;
2269
2445
  };
2446
+ var GuildMatch = _GuildMatch;
2270
2447
 
2271
2448
  // src/structures/user/GuildUser.ts
2272
- var GuildUser = class _GuildUser {
2449
+ var _GuildUser_instances, updateInternals_fn8;
2450
+ var _GuildUser = class _GuildUser {
2273
2451
  /**
2274
2452
  * Bet user
2275
2453
  * @param data The user's data
@@ -2277,6 +2455,7 @@ var GuildUser = class _GuildUser {
2277
2455
  * @param rest The rest client
2278
2456
  */
2279
2457
  constructor(data, manager) {
2458
+ __privateAdd(this, _GuildUser_instances);
2280
2459
  /** User's id */
2281
2460
  __publicField(this, "id");
2282
2461
  __publicField(this, "guild_id");
@@ -2389,7 +2568,7 @@ var GuildUser = class _GuildUser {
2389
2568
  url: route,
2390
2569
  payload
2391
2570
  });
2392
- this._updateInternals(response);
2571
+ __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
2393
2572
  return this;
2394
2573
  }
2395
2574
  async updateProfile(data) {
@@ -2410,43 +2589,14 @@ var GuildUser = class _GuildUser {
2410
2589
  url: route,
2411
2590
  payload: _data
2412
2591
  });
2413
- this._updateInternals(response);
2414
- return this;
2415
- }
2416
- _updateInternals(data) {
2417
- for (let key in data) {
2418
- if (key === "id" || key === "createdAt") continue;
2419
- if (key in this) {
2420
- this[key] = data[key];
2421
- }
2422
- if (key === "adverts") {
2423
- this.adverts = [];
2424
- for (let _adv of data.adverts) {
2425
- this.adverts.push({
2426
- _id: _adv._id,
2427
- admin_id: _adv.admin_id,
2428
- role_id: _adv.role_id,
2429
- reason: _adv.reason,
2430
- points_removed: _adv.points_removed,
2431
- proof: _adv.proof,
2432
- proof_ext: _adv.proof_ext,
2433
- createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
2434
- updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
2435
- });
2436
- }
2437
- }
2438
- }
2439
- this.updatedAt = /* @__PURE__ */ new Date();
2440
- this.createdAt = new Date(data.createdAt);
2441
- this.manager.set(this);
2442
- this.rest.emit("userUpdate", this);
2592
+ __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
2443
2593
  return this;
2444
2594
  }
2445
2595
  async addAdvert(data) {
2446
2596
  const route = Routes.guilds.users.resource(this.manager.guild.id, this.id, "adverts");
2447
2597
  const payload = data;
2448
2598
  const response = await this.rest.request({ method: "POST", url: route, payload });
2449
- return this._updateInternals(response);
2599
+ return __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
2450
2600
  }
2451
2601
  async removeAdvert(advertId) {
2452
2602
  let advs = this.adverts;
@@ -2455,7 +2605,7 @@ var GuildUser = class _GuildUser {
2455
2605
  const payload = { adverts: advs };
2456
2606
  const route = Routes.guilds.users.update(this.manager.guild.id, this.id);
2457
2607
  const response = await this.rest.request({ method: "PATCH", url: route, payload });
2458
- return this._updateInternals(response);
2608
+ return __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
2459
2609
  }
2460
2610
  /**
2461
2611
  * Update certain property
@@ -2506,7 +2656,7 @@ var GuildUser = class _GuildUser {
2506
2656
  url: route,
2507
2657
  payload
2508
2658
  });
2509
- this._updateInternals(response);
2659
+ __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
2510
2660
  return this;
2511
2661
  }
2512
2662
  async delete() {
@@ -2531,6 +2681,37 @@ var GuildUser = class _GuildUser {
2531
2681
  return json;
2532
2682
  }
2533
2683
  };
2684
+ _GuildUser_instances = new WeakSet();
2685
+ updateInternals_fn8 = function(data) {
2686
+ for (let key in data) {
2687
+ if (key === "id" || key === "createdAt") continue;
2688
+ if (key in this) {
2689
+ this[key] = data[key];
2690
+ }
2691
+ if (key === "adverts") {
2692
+ this.adverts = [];
2693
+ for (let _adv of data.adverts) {
2694
+ this.adverts.push({
2695
+ _id: _adv._id,
2696
+ admin_id: _adv.admin_id,
2697
+ role_id: _adv.role_id,
2698
+ reason: _adv.reason,
2699
+ points_removed: _adv.points_removed,
2700
+ proof: _adv.proof,
2701
+ proof_ext: _adv.proof_ext,
2702
+ createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
2703
+ updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
2704
+ });
2705
+ }
2706
+ }
2707
+ }
2708
+ this.updatedAt = /* @__PURE__ */ new Date();
2709
+ this.createdAt = new Date(data.createdAt);
2710
+ this.manager.set(this);
2711
+ this.rest.emit("userUpdate", this);
2712
+ return this;
2713
+ };
2714
+ var GuildUser = _GuildUser;
2534
2715
 
2535
2716
  // src/structures/vipmember/VipMember.ts
2536
2717
  var _VipMember_instances, updateData_fn;
@@ -2669,8 +2850,10 @@ updateData_fn = function(data) {
2669
2850
  var VipMember = _VipMember;
2670
2851
 
2671
2852
  // src/structures/ticket/Ticket.ts
2853
+ var _GuildTicket_instances, updateInternals_fn9;
2672
2854
  var GuildTicket = class {
2673
2855
  constructor(data, manager) {
2856
+ __privateAdd(this, _GuildTicket_instances);
2674
2857
  __publicField(this, "_id");
2675
2858
  __publicField(this, "guild_id");
2676
2859
  __publicField(this, "type");
@@ -2707,7 +2890,7 @@ var GuildTicket = class {
2707
2890
  method: "GET",
2708
2891
  url: route
2709
2892
  });
2710
- return this._updateInternals(response);
2893
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2711
2894
  }
2712
2895
  async setCustomerRating(rating) {
2713
2896
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "customer_rating");
@@ -2717,7 +2900,7 @@ var GuildTicket = class {
2717
2900
  url: route,
2718
2901
  payload
2719
2902
  });
2720
- return this._updateInternals(response);
2903
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2721
2904
  }
2722
2905
  async setAdminId(id) {
2723
2906
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "admin_id");
@@ -2727,7 +2910,7 @@ var GuildTicket = class {
2727
2910
  url: route,
2728
2911
  payload
2729
2912
  });
2730
- return this._updateInternals(response);
2913
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2731
2914
  }
2732
2915
  async setChannelId(id) {
2733
2916
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "channel_id");
@@ -2737,7 +2920,7 @@ var GuildTicket = class {
2737
2920
  url: route,
2738
2921
  payload
2739
2922
  });
2740
- return this._updateInternals(response);
2923
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2741
2924
  }
2742
2925
  async setClosedById(id) {
2743
2926
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "closed_by_id");
@@ -2747,7 +2930,7 @@ var GuildTicket = class {
2747
2930
  url: route,
2748
2931
  payload
2749
2932
  });
2750
- return this._updateInternals(response);
2933
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2751
2934
  }
2752
2935
  async setStatus(status) {
2753
2936
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "status");
@@ -2757,7 +2940,7 @@ var GuildTicket = class {
2757
2940
  url: route,
2758
2941
  payload
2759
2942
  });
2760
- return this._updateInternals(response);
2943
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2761
2944
  }
2762
2945
  async addMessage(message) {
2763
2946
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "messages");
@@ -2767,25 +2950,28 @@ var GuildTicket = class {
2767
2950
  url: route,
2768
2951
  payload
2769
2952
  });
2770
- return this._updateInternals(response);
2771
- }
2772
- _updateInternals(data) {
2773
- for (let key in data) {
2774
- if (key === "id" || key === "createdAt") continue;
2775
- if (key in this) {
2776
- this[key] = data[key];
2777
- }
2778
- }
2779
- this.updatedAt = /* @__PURE__ */ new Date();
2780
- this.createdAt = new Date(data.createdAt);
2781
- this.manager.set(this);
2782
- return this;
2953
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2783
2954
  }
2784
2955
  };
2956
+ _GuildTicket_instances = new WeakSet();
2957
+ updateInternals_fn9 = function(data) {
2958
+ for (let key in data) {
2959
+ if (key === "id" || key === "createdAt") continue;
2960
+ if (key in this) {
2961
+ this[key] = data[key];
2962
+ }
2963
+ }
2964
+ this.updatedAt = /* @__PURE__ */ new Date();
2965
+ this.createdAt = new Date(data.createdAt);
2966
+ this.manager.set(this);
2967
+ return this;
2968
+ };
2785
2969
 
2786
2970
  // src/structures/minesgame/MinesGame.ts
2971
+ var _MinesGame_instances, updateInternals_fn10;
2787
2972
  var MinesGame = class {
2788
2973
  constructor(data, manager) {
2974
+ __privateAdd(this, _MinesGame_instances);
2789
2975
  __publicField(this, "guild_id");
2790
2976
  __publicField(this, "_id");
2791
2977
  __publicField(this, "creatorId");
@@ -2819,7 +3005,7 @@ var MinesGame = class {
2819
3005
  method: "GET",
2820
3006
  url: route
2821
3007
  });
2822
- return this._updateInternals(response);
3008
+ return __privateMethod(this, _MinesGame_instances, updateInternals_fn10).call(this, response);
2823
3009
  }
2824
3010
  async delete() {
2825
3011
  const route = `/${Routes.fields("minesgames", this._id)}`;
@@ -2827,7 +3013,7 @@ var MinesGame = class {
2827
3013
  method: "delete",
2828
3014
  url: route
2829
3015
  });
2830
- return this._updateInternals(response);
3016
+ return __privateMethod(this, _MinesGame_instances, updateInternals_fn10).call(this, response);
2831
3017
  }
2832
3018
  async update(data) {
2833
3019
  const route = `/${Routes.fields("minesgames", this._id)}`;
@@ -2836,25 +3022,27 @@ var MinesGame = class {
2836
3022
  url: route,
2837
3023
  payload: data
2838
3024
  });
2839
- return this._updateInternals(response);
3025
+ return __privateMethod(this, _MinesGame_instances, updateInternals_fn10).call(this, response);
2840
3026
  }
2841
- _updateInternals(data) {
2842
- for (let key in data) {
2843
- if (key === "id" || key === "createdAt") continue;
2844
- if (key in this) {
2845
- this[key] = data[key];
2846
- }
3027
+ };
3028
+ _MinesGame_instances = new WeakSet();
3029
+ updateInternals_fn10 = function(data) {
3030
+ for (let key in data) {
3031
+ if (key === "id" || key === "createdAt") continue;
3032
+ if (key in this) {
3033
+ this[key] = data[key];
2847
3034
  }
2848
- this.updatedAt = /* @__PURE__ */ new Date();
2849
- this.manager.set(this);
2850
- return this;
2851
3035
  }
3036
+ this.updatedAt = /* @__PURE__ */ new Date();
3037
+ this.manager.set(this);
3038
+ return this;
2852
3039
  };
2853
3040
 
2854
3041
  // src/structures/automaticmessage/AutomaticMessage.ts
3042
+ var _AutomaticMessage_instances, updateInternals_fn11;
2855
3043
  var AutomaticMessage = class {
2856
3044
  constructor(data, manager) {
2857
- __publicField(this, "_id");
3045
+ __privateAdd(this, _AutomaticMessage_instances);
2858
3046
  __publicField(this, "id");
2859
3047
  __publicField(this, "type");
2860
3048
  __publicField(this, "admin_id");
@@ -2873,7 +3061,6 @@ var AutomaticMessage = class {
2873
3061
  this.manager = manager;
2874
3062
  this.guild = manager.guild;
2875
3063
  this.rest = manager.rest;
2876
- this._id = data?._id;
2877
3064
  this.id = data?.id;
2878
3065
  this.type = data?.type;
2879
3066
  this.admin_id = data?.admin_id;
@@ -2888,12 +3075,7 @@ var AutomaticMessage = class {
2888
3075
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
2889
3076
  }
2890
3077
  async fetch() {
2891
- const route = Routes.guilds.resource(this.guild.id, "automatic_messages", this._id);
2892
- const response = await this.rest.request({
2893
- method: "get",
2894
- url: route
2895
- });
2896
- return this._updateInternals(response);
3078
+ return this.manager.fetch(this.id);
2897
3079
  }
2898
3080
  async addChannelId(...id) {
2899
3081
  const ids = [.../* @__PURE__ */ new Set([...this.channel_ids, ...id])];
@@ -2905,39 +3087,28 @@ var AutomaticMessage = class {
2905
3087
  return this.update({ channel_ids: ids });
2906
3088
  }
2907
3089
  async update(data) {
3090
+ this.manager.cache.set(this.id, { ...this, ...data, id: this.id });
2908
3091
  const route = Routes.guilds.get(this.guild.id);
2909
3092
  const response = await this.rest.request({
2910
3093
  method: "patch",
2911
3094
  url: route,
2912
- payload: { automatic_messages: this.manager.cache.toArray() }
3095
+ payload: { automatic_messages: this.manager.toJSON() }
2913
3096
  });
2914
- return this._updateInternals(response);
3097
+ return __privateMethod(this, _AutomaticMessage_instances, updateInternals_fn11).call(this, response);
2915
3098
  }
2916
3099
  async delete() {
2917
- this.manager.cache.delete(this._id);
3100
+ this.manager.cache.delete(this.id);
3101
+ this.guild.automatic_messages = this.manager.cache.toArray();
2918
3102
  const route = Routes.guilds.get(this.guild.id);
2919
3103
  const response = await this.rest.request({
2920
3104
  method: "patch",
2921
3105
  url: route,
2922
- payload: { automatic_messages: this.manager.cache.toArray() }
3106
+ payload: { automatic_messages: this.manager.toJSON() }
2923
3107
  });
2924
3108
  return this.manager.set(response.automatic_messages);
2925
3109
  }
2926
- _updateInternals(data) {
2927
- for (let key in data) {
2928
- if (key === "_id" || key === "createdAt") continue;
2929
- if (key in this) {
2930
- this[key] = data[key];
2931
- }
2932
- }
2933
- this.updatedAt = /* @__PURE__ */ new Date();
2934
- this.createdAt = new Date(data.createdAt);
2935
- this.manager._add(this);
2936
- return this;
2937
- }
2938
3110
  toJSON() {
2939
3111
  return {
2940
- _id: this._id,
2941
3112
  id: this.id,
2942
3113
  type: this.type,
2943
3114
  admin_id: this.admin_id,
@@ -2953,6 +3124,20 @@ var AutomaticMessage = class {
2953
3124
  };
2954
3125
  }
2955
3126
  };
3127
+ _AutomaticMessage_instances = new WeakSet();
3128
+ updateInternals_fn11 = function(data) {
3129
+ const _this = data?.automatic_messages?.find((m) => m.id === this.id);
3130
+ for (let key in _this) {
3131
+ if (key === "id" || key === "createdAt") continue;
3132
+ if (key in this) {
3133
+ this[key] = _this[key];
3134
+ }
3135
+ }
3136
+ this.updatedAt = /* @__PURE__ */ new Date();
3137
+ this.createdAt = new Date(data.createdAt);
3138
+ this.manager._add(data.automatic_messages);
3139
+ return this;
3140
+ };
2956
3141
 
2957
3142
  // src/utils/randomKeyGenerator.ts
2958
3143
  var import_crypto = require("crypto");
@@ -2966,25 +3151,19 @@ var AutomaticMessageManager = class extends BaseManager {
2966
3151
  super(guild);
2967
3152
  this.guild = guild;
2968
3153
  this.rest = guild.rest;
2969
- this.base_url = Routes.guilds.resource(guild.id, "automatic_messages");
3154
+ this.base_url = Routes.guilds.resource(guild.id);
2970
3155
  this.cache = new Collection();
2971
3156
  if (guild.automatic_messages && guild.automatic_messages.length !== 0) this.set(guild.automatic_messages);
2972
3157
  else this.guild.automatic_messages = [];
2973
3158
  }
2974
3159
  async fetch(messageId) {
2975
3160
  const route = this.base_url;
2976
- if (messageId) {
2977
- const response2 = await this.rest.request({
2978
- method: "get",
2979
- url: `${route}`
2980
- });
2981
- return this._add(response2).find((m) => m.id === messageId);
2982
- }
2983
3161
  const response = await this.rest.request({
2984
3162
  method: "get",
2985
3163
  url: route
2986
3164
  });
2987
- return this._add(response.automatic_messages);
3165
+ this._add(response.automatic_messages);
3166
+ return this.cache;
2988
3167
  }
2989
3168
  async create(data) {
2990
3169
  if (!data.type) throw new Error(`Missing message's type.`);
@@ -3011,6 +3190,7 @@ var AutomaticMessageManager = class extends BaseManager {
3011
3190
  if (data instanceof AutomaticMessage) this.cache.set(data.id, data);
3012
3191
  else this.cache.set(data.id, new AutomaticMessage(data, this));
3013
3192
  }
3193
+ this.guild.automatic_messages = this.cache.toArray();
3014
3194
  return this.cache;
3015
3195
  }
3016
3196
  set(data) {
@@ -3039,6 +3219,10 @@ var AutomaticMessageManager = class extends BaseManager {
3039
3219
  });
3040
3220
  return response;
3041
3221
  }
3222
+ toJSON() {
3223
+ [...this.cache.values()].map((m) => console.log(m instanceof AutomaticMessage));
3224
+ return this.cache.toArray();
3225
+ }
3042
3226
  };
3043
3227
 
3044
3228
  // src/managers/bet/GuildBetManager.ts
@@ -3459,15 +3643,14 @@ var GuildTicketManager = class {
3459
3643
  } else {
3460
3644
  categories.push(data);
3461
3645
  }
3462
- const payload = { tickets_configuration: { categories } };
3463
- const route = Routes.guilds.get(this.guild.id);
3464
- const response = await this.rest.request({
3465
- method: "PATCH",
3466
- url: route,
3467
- payload
3646
+ return this.guild.update({
3647
+ tickets_configuration: {
3648
+ categories,
3649
+ creationCategory: this.guild.tickets_configuration.creationCategory,
3650
+ deletionCategory: this.guild.tickets_configuration.deletionCategory,
3651
+ rating_channel_id: this.guild.tickets_configuration.rating_channel_id
3652
+ }
3468
3653
  });
3469
- this.guild._updateInternals(response);
3470
- return response;
3471
3654
  }
3472
3655
  async deleteTicketCategory(data) {
3473
3656
  let categories = this.guild.tickets_configuration.categories;
@@ -3481,8 +3664,14 @@ var GuildTicketManager = class {
3481
3664
  url: route,
3482
3665
  payload
3483
3666
  });
3484
- this.guild._updateInternals(response);
3485
- return response;
3667
+ return this.guild.update({
3668
+ tickets_configuration: {
3669
+ categories,
3670
+ creationCategory: this.guild.tickets_configuration.creationCategory,
3671
+ deletionCategory: this.guild.tickets_configuration.deletionCategory,
3672
+ rating_channel_id: this.guild.tickets_configuration.rating_channel_id
3673
+ }
3674
+ });
3486
3675
  }
3487
3676
  async fetch(options) {
3488
3677
  if (options && options.cache) return this.cache;