@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
package/dist/index.js CHANGED
@@ -408,7 +408,7 @@ __export(index_exports, {
408
408
  BetChannelTypes: () => BetChannelTypes,
409
409
  BufferManager: () => BufferManager,
410
410
  Collection: () => Collection,
411
- Guild: () => Guild2,
411
+ Guild: () => Guild3,
412
412
  GuildBet: () => GuildBet,
413
413
  GuildBetManager: () => GuildBetManager,
414
414
  GuildBetUser: () => GuildBetUser,
@@ -436,7 +436,7 @@ __export(index_exports, {
436
436
  MessagesManager: () => MessagesManager,
437
437
  MinesGame: () => MinesGame,
438
438
  MinesGameManager: () => MinesGameManager,
439
- REST: () => REST,
439
+ REST: () => REST2,
440
440
  Routes: () => Routes,
441
441
  STATES: () => STATES,
442
442
  VipMember: () => VipMember,
@@ -540,6 +540,9 @@ var BaseManager = class {
540
540
  this.rest = guild.rest;
541
541
  this.cache = new Collection();
542
542
  }
543
+ toJSON() {
544
+ return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
545
+ }
543
546
  };
544
547
 
545
548
  // src/managers/player/PlayerManager.ts
@@ -626,7 +629,7 @@ var APIEndpoints = {
626
629
  // src/rest/Routes.ts
627
630
  var Routes = {
628
631
  //base: "http://localhost:80/api/v1",
629
- base: "https://duque-api.up.railway.app/api/v1",
632
+ base: "https://duqueapi.shardweb.app/api/v1",
630
633
  field: (field) => `/${field}`,
631
634
  fields: (...fields) => `${fields.join("/")}`,
632
635
  guilds: {
@@ -783,7 +786,8 @@ var Assertion = class {
783
786
  var import_undici = require("undici");
784
787
 
785
788
  // src/structures/betuser/GuildBetUser.ts
786
- var GuildBetUser = class _GuildBetUser {
789
+ var _GuildBetUser_instances, updateInternals_fn;
790
+ var _GuildBetUser = class _GuildBetUser {
787
791
  /**
788
792
  * Bet user
789
793
  * @param data The user's data
@@ -791,6 +795,7 @@ var GuildBetUser = class _GuildBetUser {
791
795
  * @param rest The rest client
792
796
  */
793
797
  constructor(data, manager) {
798
+ __privateAdd(this, _GuildBetUser_instances);
794
799
  /** User daily */
795
800
  __publicField(this, "daily");
796
801
  __publicField(this, "profile");
@@ -885,7 +890,7 @@ var GuildBetUser = class _GuildBetUser {
885
890
  url: route,
886
891
  payload
887
892
  });
888
- return this._updateInternals(response);
893
+ return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
889
894
  }
890
895
  async updateProfile(data) {
891
896
  const _data = {
@@ -905,20 +910,7 @@ var GuildBetUser = class _GuildBetUser {
905
910
  url: route,
906
911
  payload: _data
907
912
  });
908
- return this._updateInternals(response);
909
- }
910
- _updateInternals(data) {
911
- for (let key in data) {
912
- if (key === "id" || key === "createdAt") continue;
913
- if (key in this) {
914
- this[key] = data[key];
915
- }
916
- }
917
- this.updatedAt = /* @__PURE__ */ new Date();
918
- this.createdAt = new Date(data.createdAt);
919
- this.manager.set(this);
920
- this.rest.emit("betuserUpdate", this);
921
- return this;
913
+ return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
922
914
  }
923
915
  /**
924
916
  * Update certain property
@@ -955,7 +947,7 @@ var GuildBetUser = class _GuildBetUser {
955
947
  url: route,
956
948
  payload
957
949
  });
958
- return this._updateInternals(response);
950
+ return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
959
951
  }
960
952
  async _update(data) {
961
953
  const route = Routes.guilds.betusers.get(this.manager.guild.id, this.id);
@@ -965,7 +957,7 @@ var GuildBetUser = class _GuildBetUser {
965
957
  url: route,
966
958
  payload
967
959
  });
968
- return this._updateInternals(response);
960
+ return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
969
961
  }
970
962
  async delete() {
971
963
  const route = Routes.guilds.betusers.delete(this.manager.guild.id, this.id);
@@ -989,6 +981,21 @@ var GuildBetUser = class _GuildBetUser {
989
981
  return json;
990
982
  }
991
983
  };
984
+ _GuildBetUser_instances = new WeakSet();
985
+ updateInternals_fn = function(data) {
986
+ for (let key in data) {
987
+ if (key === "id" || key === "createdAt") continue;
988
+ if (key in this) {
989
+ this[key] = data[key];
990
+ }
991
+ }
992
+ this.updatedAt = /* @__PURE__ */ new Date();
993
+ this.createdAt = new Date(data.createdAt);
994
+ this.manager.set(this);
995
+ this.rest.emit("betuserUpdate", this);
996
+ return this;
997
+ };
998
+ var GuildBetUser = _GuildBetUser;
992
999
 
993
1000
  // src/managers/betuser/GuildBetUserManager.ts
994
1001
  var GuildBetUserManager = class extends BaseManager {
@@ -1066,7 +1073,8 @@ var GuildBetUserManager = class extends BaseManager {
1066
1073
  };
1067
1074
 
1068
1075
  // src/structures/mediator/GuildMediator.ts
1069
- var GuildMediator = class _GuildMediator {
1076
+ var _GuildMediator_instances, updateInternals_fn2;
1077
+ var _GuildMediator = class _GuildMediator {
1070
1078
  /**
1071
1079
  * Bet user
1072
1080
  * @param data The user's data
@@ -1074,6 +1082,7 @@ var GuildMediator = class _GuildMediator {
1074
1082
  * @param rest The rest client
1075
1083
  */
1076
1084
  constructor(data, manager) {
1085
+ __privateAdd(this, _GuildMediator_instances);
1077
1086
  /** User's name */
1078
1087
  __publicField(this, "id");
1079
1088
  __publicField(this, "guild_id");
@@ -1132,19 +1141,7 @@ var GuildMediator = class _GuildMediator {
1132
1141
  url: route,
1133
1142
  payload
1134
1143
  });
1135
- return this._updateInternals(response);
1136
- }
1137
- _updateInternals(data) {
1138
- for (let key in data) {
1139
- if (key === "id" || key === "createdAt") continue;
1140
- if (key in this) {
1141
- this[key] = data[key];
1142
- }
1143
- }
1144
- this.updatedAt = /* @__PURE__ */ new Date();
1145
- this.createdAt = new Date(data.createdAt);
1146
- this.manager.set(this);
1147
- return this;
1144
+ return __privateMethod(this, _GuildMediator_instances, updateInternals_fn2).call(this, response);
1148
1145
  }
1149
1146
  /**
1150
1147
  * Update certain property
@@ -1159,7 +1156,7 @@ var GuildMediator = class _GuildMediator {
1159
1156
  url: route,
1160
1157
  payload
1161
1158
  });
1162
- return this._updateInternals(response);
1159
+ return __privateMethod(this, _GuildMediator_instances, updateInternals_fn2).call(this, response);
1163
1160
  }
1164
1161
  async setPaymentlink(type, link) {
1165
1162
  const route = Routes.guilds.mediators.get(this.manager.guild.id, this.id);
@@ -1169,7 +1166,7 @@ var GuildMediator = class _GuildMediator {
1169
1166
  url: route,
1170
1167
  payload
1171
1168
  });
1172
- return this._updateInternals(response);
1169
+ return __privateMethod(this, _GuildMediator_instances, updateInternals_fn2).call(this, response);
1173
1170
  }
1174
1171
  async delete() {
1175
1172
  const route = Routes.guilds.mediators.delete(this.manager.guild.id, this.id);
@@ -1192,6 +1189,20 @@ var GuildMediator = class _GuildMediator {
1192
1189
  return json;
1193
1190
  }
1194
1191
  };
1192
+ _GuildMediator_instances = new WeakSet();
1193
+ updateInternals_fn2 = function(data) {
1194
+ for (let key in data) {
1195
+ if (key === "id" || key === "createdAt") continue;
1196
+ if (key in this) {
1197
+ this[key] = data[key];
1198
+ }
1199
+ }
1200
+ this.updatedAt = /* @__PURE__ */ new Date();
1201
+ this.createdAt = new Date(data.createdAt);
1202
+ this.manager.set(this);
1203
+ return this;
1204
+ };
1205
+ var GuildMediator = _GuildMediator;
1195
1206
 
1196
1207
  // src/managers/mediator/GuildMediatorManager.ts
1197
1208
  var GuildMediatorManager = class extends BaseManager {
@@ -1276,14 +1287,150 @@ var GuildMediatorManager = class extends BaseManager {
1276
1287
  }
1277
1288
  };
1278
1289
 
1290
+ // src/structures/tournament/Tournament.ts
1291
+ var _Tournament_instances, updateInternals_fn3;
1292
+ var Tournament = class {
1293
+ constructor(data, manager) {
1294
+ __privateAdd(this, _Tournament_instances);
1295
+ __publicField(this, "_id");
1296
+ __publicField(this, "guild_id");
1297
+ __publicField(this, "type");
1298
+ __publicField(this, "max_teams");
1299
+ __publicField(this, "teams");
1300
+ __publicField(this, "message");
1301
+ __publicField(this, "message_id");
1302
+ __publicField(this, "status");
1303
+ __publicField(this, "createdAt");
1304
+ __publicField(this, "updatedAt");
1305
+ __publicField(this, "guild");
1306
+ __publicField(this, "rest");
1307
+ __publicField(this, "manager");
1308
+ __publicField(this, "data");
1309
+ this.manager = manager;
1310
+ this.guild = manager.guild;
1311
+ this.rest = manager.rest;
1312
+ this.guild_id = data?.guild_id;
1313
+ this.type = data?.type;
1314
+ this.teams = data?.teams;
1315
+ this.message = data?.message;
1316
+ this.message_id = data?.message_id;
1317
+ this.status = data?.status;
1318
+ this.createdAt = data?.createdAt ? new Date(data?.createdAt) : /* @__PURE__ */ new Date();
1319
+ this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
1320
+ this.data = data;
1321
+ }
1322
+ async fetch() {
1323
+ const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
1324
+ const response = await this.rest.request({
1325
+ method: "get",
1326
+ url: route
1327
+ });
1328
+ return __privateMethod(this, _Tournament_instances, updateInternals_fn3).call(this, response);
1329
+ }
1330
+ async update(data) {
1331
+ const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
1332
+ const response = await this.rest.request({
1333
+ method: "patch",
1334
+ url: route,
1335
+ payload: data
1336
+ });
1337
+ return __privateMethod(this, _Tournament_instances, updateInternals_fn3).call(this, response);
1338
+ }
1339
+ toJSON() {
1340
+ return {
1341
+ guild_id: this.guild_id,
1342
+ type: this.type,
1343
+ max_teams: this.max_teams,
1344
+ teams: this.teams,
1345
+ message: this.message,
1346
+ message_id: this.message_id,
1347
+ status: this.status,
1348
+ createdAt: this.createdAt ? new Date(this?.createdAt) : /* @__PURE__ */ new Date(),
1349
+ updatedAt: this.updatedAt ? new Date(this?.updatedAt) : /* @__PURE__ */ new Date()
1350
+ };
1351
+ }
1352
+ };
1353
+ _Tournament_instances = new WeakSet();
1354
+ updateInternals_fn3 = function(data) {
1355
+ for (let key in data) {
1356
+ if (key === "id" || key === "createdAt") continue;
1357
+ if (key in this) {
1358
+ this[key] = data[key];
1359
+ }
1360
+ }
1361
+ this.updatedAt = /* @__PURE__ */ new Date();
1362
+ this.createdAt = new Date(data.createdAt);
1363
+ this.manager._add(this);
1364
+ return this;
1365
+ };
1366
+
1367
+ // src/managers/tournament/TournamentManager.ts
1368
+ var TournamentManager = class extends BaseManager {
1369
+ constructor(guild) {
1370
+ super(guild);
1371
+ this.guild = guild;
1372
+ this.rest = guild.rest;
1373
+ this.base_url = Routes.guilds.resource(guild.id, "tournaments");
1374
+ this.cache = new Collection();
1375
+ }
1376
+ async fetch(options) {
1377
+ if (options && options.cache) return this.cache;
1378
+ if (options && options.tournamentId) {
1379
+ const response2 = await this.rest.request({
1380
+ method: "GET",
1381
+ url: Routes.fields(this.base_url, options.tournamentId)
1382
+ });
1383
+ const tournament = new Tournament(response2, this);
1384
+ this._add(tournament);
1385
+ return tournament;
1386
+ }
1387
+ const response = await this.rest.request({
1388
+ method: "GET",
1389
+ url: this.base_url
1390
+ });
1391
+ return this.set(response);
1392
+ }
1393
+ set(data) {
1394
+ this.cache.clear();
1395
+ if (Array.isArray(data)) {
1396
+ for (let _m of data) {
1397
+ if (!_m._id) continue;
1398
+ if (_m instanceof Tournament) this.cache.set(_m._id, _m);
1399
+ else this.cache.set(_m._id, new Tournament(_m, this));
1400
+ }
1401
+ } else {
1402
+ if (!data._id) return this.cache;
1403
+ if (data instanceof Tournament) this.cache.set(data._id, data);
1404
+ else this.cache.set(data._id, new Tournament(data, this));
1405
+ }
1406
+ return this.cache;
1407
+ }
1408
+ _add(data) {
1409
+ if (Array.isArray(data)) {
1410
+ for (let _m of data) {
1411
+ if (!_m._id) continue;
1412
+ if (_m instanceof Tournament) this.cache.set(_m._id, _m);
1413
+ else this.cache.set(_m._id, new Tournament(_m, this));
1414
+ }
1415
+ } else {
1416
+ if (!data._id) return this.cache;
1417
+ if (data instanceof Tournament) this.cache.set(data._id, data);
1418
+ else this.cache.set(data._id, new Tournament(data, this));
1419
+ }
1420
+ return this.cache;
1421
+ }
1422
+ };
1423
+
1279
1424
  // src/structures/guild/Guild.ts
1280
- var Guild2 = class {
1425
+ var _Guild_instances, updateInternals_fn4;
1426
+ var Guild3 = class {
1281
1427
  /**
1282
1428
  * The guild structure
1283
1429
  * @param data The guild's data
1284
1430
  * @param rest The rest client
1285
1431
  */
1286
1432
  constructor(data, rest) {
1433
+ __privateAdd(this, _Guild_instances);
1287
1434
  /** The data of this guild */
1288
1435
  __publicField(this, "data");
1289
1436
  /** The rest client */
@@ -1309,6 +1456,7 @@ var Guild2 = class {
1309
1456
  __publicField(this, "roulette_settings");
1310
1457
  /** Guild Prefix */
1311
1458
  __publicField(this, "prefix");
1459
+ __publicField(this, "prefixes");
1312
1460
  /** Guild Creation Date */
1313
1461
  __publicField(this, "createdAt");
1314
1462
  /** Guild Updated Date */
@@ -1328,6 +1476,7 @@ var Guild2 = class {
1328
1476
  __publicField(this, "mediators");
1329
1477
  __publicField(this, "automatic_messages");
1330
1478
  __publicField(this, "automaticMessagesManager");
1479
+ __publicField(this, "tournaments");
1331
1480
  __publicField(this, "adverts");
1332
1481
  __publicField(this, "codes");
1333
1482
  __publicField(this, "coin_symbol");
@@ -1342,6 +1491,7 @@ var Guild2 = class {
1342
1491
  this.scores = data?.scores;
1343
1492
  this.codes = data?.codes;
1344
1493
  this.prefix = data?.prefix;
1494
+ this.prefixes = data?.prefixes;
1345
1495
  this.status = data?.status;
1346
1496
  this.tickets_configuration = data?.tickets_configuration;
1347
1497
  this.automatic_messages = data?.automatic_messages;
@@ -1362,6 +1512,7 @@ var Guild2 = class {
1362
1512
  this.bets = new GuildBetManager(this);
1363
1513
  this.mediators = new GuildMediatorManager(this);
1364
1514
  this.automaticMessagesManager = new AutomaticMessageManager(this);
1515
+ this.tournaments = new TournamentManager(this);
1365
1516
  this.adverts = [];
1366
1517
  for (let _adv of data?.adverts || []) {
1367
1518
  this.adverts.push({
@@ -1398,7 +1549,7 @@ var Guild2 = class {
1398
1549
  url: route,
1399
1550
  payload: { channels }
1400
1551
  });
1401
- this._updateInternals(response);
1552
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1402
1553
  return response.channels.find((t) => t.type === type);
1403
1554
  }
1404
1555
  }
@@ -1413,7 +1564,7 @@ var Guild2 = class {
1413
1564
  url: route,
1414
1565
  payload: { permissions }
1415
1566
  });
1416
- this._updateInternals(response);
1567
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1417
1568
  return response.permissions.find((t) => t.type === type);
1418
1569
  }
1419
1570
  }
@@ -1422,26 +1573,26 @@ var Guild2 = class {
1422
1573
  const route = Routes.guilds.get(this.id);
1423
1574
  const payload = { adverts: this.adverts };
1424
1575
  const response = await this.rest.request({ method: "PATCH", url: route, payload });
1425
- return this._updateInternals(response);
1576
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1426
1577
  }
1427
1578
  async removeAdvert(advertId) {
1428
1579
  const route = Routes.guilds.get(this.id);
1429
1580
  const payload = { adverts: this.adverts.filter((a) => a._id !== advertId) };
1430
1581
  const response = await this.rest.request({ method: "PATCH", url: route, payload });
1431
- return this._updateInternals(response);
1582
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1432
1583
  }
1433
1584
  async createCode(data) {
1434
1585
  this.codes.push(data);
1435
1586
  const route = Routes.guilds.get(this.id);
1436
1587
  const payload = { codes: this.codes };
1437
1588
  const response = await this.rest.request({ method: "PATCH", url: route, payload });
1438
- return this._updateInternals(response);
1589
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1439
1590
  }
1440
1591
  async removeCode(codeId) {
1441
1592
  const route = Routes.guilds.get(this.id);
1442
1593
  const payload = { codes: this.codes.filter((a) => a._id !== codeId) };
1443
1594
  const response = await this.rest.request({ method: "PATCH", url: route, payload });
1444
- return this._updateInternals(response);
1595
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1445
1596
  }
1446
1597
  async addIdToChannel(type, id) {
1447
1598
  const channel = this.channels.find((c) => c.type === type);
@@ -1460,7 +1611,7 @@ var Guild2 = class {
1460
1611
  url: route,
1461
1612
  payload
1462
1613
  });
1463
- return this._updateInternals(response);
1614
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1464
1615
  }
1465
1616
  async setChannelIds(type, ...ids) {
1466
1617
  const channel = this.channels.find((c) => c.type === type);
@@ -1479,7 +1630,7 @@ var Guild2 = class {
1479
1630
  url: route,
1480
1631
  payload
1481
1632
  });
1482
- return this._updateInternals(response);
1633
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1483
1634
  }
1484
1635
  async removeIdInChannel(type, id) {
1485
1636
  const chIndex = this.channels.findIndex((c) => c.type === type);
@@ -1501,7 +1652,7 @@ var Guild2 = class {
1501
1652
  url: route,
1502
1653
  payload
1503
1654
  });
1504
- return this._updateInternals(response);
1655
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1505
1656
  }
1506
1657
  async updateRouletteSettings(data) {
1507
1658
  const _data = {
@@ -1558,58 +1709,21 @@ var Guild2 = class {
1558
1709
  this.logEntries.fetch(),
1559
1710
  this.betusers.fetch(),
1560
1711
  this.bets.fetch(),
1561
- this.mediators.fetch()
1712
+ this.mediators.fetch(),
1713
+ this.tournaments.fetch()
1562
1714
  ]);
1563
1715
  return this;
1564
1716
  }
1565
- _updateInternals(data) {
1566
- for (let key in data) {
1567
- if (key === "id" || key === "createdAt") continue;
1568
- if (key in this) {
1569
- this[key] = data[key];
1570
- }
1571
- if (key === "adverts") {
1572
- this.adverts = [];
1573
- for (let _adv of data.adverts) {
1574
- this.adverts.push({
1575
- _id: _adv._id,
1576
- admin_id: _adv.admin_id,
1577
- points_to_remove: _adv.points_to_remove,
1578
- role_id: _adv.role_id,
1579
- createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
1580
- updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
1581
- });
1582
- }
1583
- }
1584
- if (key === "code") {
1585
- this.codes = [];
1586
- for (let _adv of data.codes) {
1587
- this.codes.push({
1588
- _id: _adv._id,
1589
- admin_id: _adv.admin_id,
1590
- type: _adv.type,
1591
- add: _adv.add,
1592
- code: _adv.code,
1593
- expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
1594
- createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
1595
- updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
1596
- });
1597
- }
1598
- }
1599
- }
1600
- this.automaticMessagesManager.set(this.automatic_messages);
1601
- this.updatedAt = /* @__PURE__ */ new Date();
1602
- this.rest.guilds.cache.set(this.id, this);
1603
- this.rest.emit("guildUpdate", this);
1604
- return this;
1605
- }
1606
1717
  async fetch() {
1607
1718
  const route = Routes.guilds.get(this.id);
1608
1719
  const response = await this.rest.request({
1609
1720
  method: "get",
1610
1721
  url: route
1611
1722
  });
1612
- return this._updateInternals(response);
1723
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1724
+ }
1725
+ async reset() {
1726
+ return this.update({ reset: true });
1613
1727
  }
1614
1728
  async update(data) {
1615
1729
  const route = Routes.guilds.get(this.id);
@@ -1618,16 +1732,7 @@ var Guild2 = class {
1618
1732
  url: route,
1619
1733
  payload: data
1620
1734
  });
1621
- for (const k in response) {
1622
- if (k === "id" || k == "createdAt") continue;
1623
- if (k in this) {
1624
- this[k] = response[k];
1625
- }
1626
- }
1627
- this.updatedAt = /* @__PURE__ */ new Date();
1628
- this.rest.guilds.cache.set(this.id, this);
1629
- this.rest.emit("guildUpdate", this);
1630
- return this;
1735
+ return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1631
1736
  }
1632
1737
  async setStatus(key, status) {
1633
1738
  Assertion.assertString(key);
@@ -1652,16 +1757,27 @@ var Guild2 = class {
1652
1757
  await this.update({ prices: this.prices });
1653
1758
  return this;
1654
1759
  }
1655
- async setPrefix(prefix) {
1656
- Assertion.assertString(prefix);
1657
- const route = Routes.fields(Routes.guilds.resource(this.id, "prefix"));
1658
- const payload = { set: prefix };
1760
+ async addPrefix(prefixes) {
1761
+ const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
1762
+ const _p = Array.isArray(prefixes) ? prefixes : [prefixes];
1763
+ const payload = { set: [.../* @__PURE__ */ new Set([...this.prefixes, ..._p])] };
1659
1764
  const response = await this.rest.request({
1660
1765
  method: "PATCH",
1661
1766
  url: route,
1662
1767
  payload
1663
1768
  });
1664
- this._updateInternals(response);
1769
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1770
+ return this;
1771
+ }
1772
+ async setPrefix(prefixes) {
1773
+ const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
1774
+ const payload = { set: Array.isArray(prefixes) ? prefixes : [prefixes] };
1775
+ const response = await this.rest.request({
1776
+ method: "PATCH",
1777
+ url: route,
1778
+ payload
1779
+ });
1780
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1665
1781
  return this;
1666
1782
  }
1667
1783
  async toggleDailyCategory(category) {
@@ -1681,7 +1797,7 @@ var Guild2 = class {
1681
1797
  url: route,
1682
1798
  payload
1683
1799
  });
1684
- this._updateInternals(response);
1800
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1685
1801
  return this;
1686
1802
  }
1687
1803
  async setScores(name, amount) {
@@ -1694,7 +1810,7 @@ var Guild2 = class {
1694
1810
  url: route,
1695
1811
  payload
1696
1812
  });
1697
- this._updateInternals(response);
1813
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1698
1814
  return this;
1699
1815
  }
1700
1816
  async toggleMode(mode) {
@@ -1719,10 +1835,52 @@ var Guild2 = class {
1719
1835
  url: route,
1720
1836
  payload
1721
1837
  });
1722
- this._updateInternals(response);
1838
+ __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
1723
1839
  return this;
1724
1840
  }
1725
1841
  };
1842
+ _Guild_instances = new WeakSet();
1843
+ updateInternals_fn4 = function(data) {
1844
+ for (let key in data) {
1845
+ if (key === "id" || key === "createdAt") continue;
1846
+ if (key in this) {
1847
+ this[key] = data[key];
1848
+ }
1849
+ if (key === "adverts") {
1850
+ this.adverts = [];
1851
+ for (let _adv of data.adverts) {
1852
+ this.adverts.push({
1853
+ _id: _adv._id,
1854
+ admin_id: _adv.admin_id,
1855
+ points_to_remove: _adv.points_to_remove,
1856
+ role_id: _adv.role_id,
1857
+ createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
1858
+ updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
1859
+ });
1860
+ }
1861
+ }
1862
+ if (key === "code") {
1863
+ this.codes = [];
1864
+ for (let _adv of data.codes) {
1865
+ this.codes.push({
1866
+ _id: _adv._id,
1867
+ admin_id: _adv.admin_id,
1868
+ type: _adv.type,
1869
+ add: _adv.add,
1870
+ code: _adv.code,
1871
+ expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
1872
+ createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
1873
+ updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
1874
+ });
1875
+ }
1876
+ }
1877
+ }
1878
+ this.automaticMessagesManager.set(this.automatic_messages);
1879
+ this.updatedAt = /* @__PURE__ */ new Date();
1880
+ this.rest.guilds.cache.set(this.id, this);
1881
+ this.rest.emit("guildUpdate", this);
1882
+ return this;
1883
+ };
1726
1884
 
1727
1885
  // src/managers/guild/GuildManager.ts
1728
1886
  var GuildManager = class {
@@ -1752,7 +1910,7 @@ var GuildManager = class {
1752
1910
  method: "get",
1753
1911
  url: route2
1754
1912
  });
1755
- const guild = new Guild2(response2, this.rest);
1913
+ const guild = new Guild3(response2, this.rest);
1756
1914
  await guild._start().then((g) => {
1757
1915
  this.cache.set(g.id, g);
1758
1916
  });
@@ -1766,13 +1924,22 @@ var GuildManager = class {
1766
1924
  });
1767
1925
  for (let _guild of response) {
1768
1926
  if (!_guild.id) continue;
1769
- const guild = new Guild2(_guild, this.rest);
1927
+ const guild = new Guild3(_guild, this.rest);
1770
1928
  await guild._start().then((g) => {
1771
1929
  this.cache.set(g.id, g);
1772
1930
  });
1773
1931
  }
1774
1932
  return this.cache;
1775
1933
  }
1934
+ async reset(guildId) {
1935
+ if (guildId) {
1936
+ return await this.cache.get(guildId).reset();
1937
+ }
1938
+ for (let [_, g] of this.cache) {
1939
+ await g.reset();
1940
+ }
1941
+ return this.cache;
1942
+ }
1776
1943
  async delete(options) {
1777
1944
  if (options && options.guildId) {
1778
1945
  Assertion.assertString(options.guildId);
@@ -1799,12 +1966,12 @@ var GuildManager = class {
1799
1966
  if (!data) return this.cache;
1800
1967
  if (Array.isArray(data)) {
1801
1968
  for (let _guild of data) {
1802
- const guild = new Guild2(_guild, this.rest);
1969
+ const guild = new Guild3(_guild, this.rest);
1803
1970
  this.cache.set(guild.id, guild);
1804
1971
  }
1805
1972
  return this.cache;
1806
1973
  } else {
1807
- const guild = new Guild2(data, this.rest);
1974
+ const guild = new Guild3(data, this.rest);
1808
1975
  this.cache.set(guild.id, guild);
1809
1976
  return guild;
1810
1977
  }
@@ -1818,7 +1985,7 @@ var FgGreen = "\x1B[32m";
1818
1985
  var FgRed = "\x1B[31m";
1819
1986
  var FgBlue = "\x1B[34m";
1820
1987
  var FgCyan = "\x1B[36m";
1821
- var REST = class extends import_events.default {
1988
+ var REST2 = class extends import_events.default {
1822
1989
  /**
1823
1990
  *
1824
1991
  * @param key The unique key for he client
@@ -1915,8 +2082,10 @@ var REST = class extends import_events.default {
1915
2082
  };
1916
2083
 
1917
2084
  // src/structures/bet/GuildBet.ts
2085
+ var _GuildBet_instances, updateInternals_fn5;
1918
2086
  var GuildBet = class {
1919
2087
  constructor(data, manager) {
2088
+ __privateAdd(this, _GuildBet_instances);
1920
2089
  /** The bet's type */
1921
2090
  __publicField(this, "type");
1922
2091
  /** The bet's mode */
@@ -1995,7 +2164,7 @@ var GuildBet = class {
1995
2164
  async fetch() {
1996
2165
  const route = Routes.guilds.bets.get(this.guild.id, this._id);
1997
2166
  const response = await this.rest.request({ url: route, method: "GET" });
1998
- return this._updateInternals(response);
2167
+ return __privateMethod(this, _GuildBet_instances, updateInternals_fn5).call(this, response);
1999
2168
  }
2000
2169
  async addPlayer(player, queue_type) {
2001
2170
  if (this.players.length === 2) return this;
@@ -2032,7 +2201,7 @@ var GuildBet = class {
2032
2201
  const payload = data;
2033
2202
  const route = Routes.guilds.bets.update(this.guild.id, this._id);
2034
2203
  const response = await this.rest.request({ method: "patch", url: route, payload });
2035
- return this._updateInternals(response);
2204
+ return __privateMethod(this, _GuildBet_instances, updateInternals_fn5).call(this, response);
2036
2205
  }
2037
2206
  async delete() {
2038
2207
  const route = Routes.guilds.bets.delete(this.manager.guild.id, this._id);
@@ -2044,33 +2213,6 @@ var GuildBet = class {
2044
2213
  this.manager.cache.delete(this._id);
2045
2214
  return response;
2046
2215
  }
2047
- _updateInternals(data) {
2048
- for (let key in data) {
2049
- if (key === "_id" || key === "createdAt") continue;
2050
- if (key === "messages") {
2051
- this.messages.set(data[key]);
2052
- continue;
2053
- }
2054
- if (key === "players") {
2055
- this.players._set(data[key]);
2056
- continue;
2057
- }
2058
- if (key in this) {
2059
- this[key] = data[key];
2060
- }
2061
- }
2062
- if (data?.messages?.length !== 0) {
2063
- if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
2064
- else {
2065
- this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
2066
- this.messages.set(data.messages);
2067
- }
2068
- }
2069
- this.updatedAt = /* @__PURE__ */ new Date();
2070
- this.createdAt = new Date(data.createdAt);
2071
- this.manager.set(this);
2072
- return this;
2073
- }
2074
2216
  toJSON() {
2075
2217
  let json = {};
2076
2218
  for (const [key, value] of Object.entries(this)) {
@@ -2087,10 +2229,40 @@ var GuildBet = class {
2087
2229
  };
2088
2230
  }
2089
2231
  };
2232
+ _GuildBet_instances = new WeakSet();
2233
+ updateInternals_fn5 = function(data) {
2234
+ for (let key in data) {
2235
+ if (key === "_id" || key === "createdAt") continue;
2236
+ if (key === "messages") {
2237
+ this.messages.set(data[key]);
2238
+ continue;
2239
+ }
2240
+ if (key === "players") {
2241
+ this.players._set(data[key]);
2242
+ continue;
2243
+ }
2244
+ if (key in this) {
2245
+ this[key] = data[key];
2246
+ }
2247
+ }
2248
+ if (data?.messages?.length !== 0) {
2249
+ if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
2250
+ else {
2251
+ this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
2252
+ this.messages.set(data.messages);
2253
+ }
2254
+ }
2255
+ this.updatedAt = /* @__PURE__ */ new Date();
2256
+ this.createdAt = new Date(data.createdAt);
2257
+ this.manager.set(this);
2258
+ return this;
2259
+ };
2090
2260
 
2091
2261
  // src/structures/logentry/LogEntry.ts
2262
+ var _LogEntry_instances, updateInternals_fn6;
2092
2263
  var LogEntry = class {
2093
2264
  constructor(data, manager) {
2265
+ __privateAdd(this, _LogEntry_instances);
2094
2266
  __publicField(this, "_id");
2095
2267
  __publicField(this, "guild_id");
2096
2268
  __publicField(this, "user_id");
@@ -2126,9 +2298,9 @@ var LogEntry = class {
2126
2298
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
2127
2299
  }
2128
2300
  async fetch() {
2129
- const route = Routes.guilds.resources(this.guild.id, "logs", this._id);
2301
+ const route = Routes.fields("guilds", this.guild.id, "logentries", this._id);
2130
2302
  const response = await this.rest.request({ url: route, method: "GET" });
2131
- return this._updateInternals(response);
2303
+ return __privateMethod(this, _LogEntry_instances, updateInternals_fn6).call(this, response);
2132
2304
  }
2133
2305
  toJSON() {
2134
2306
  const json = {};
@@ -2139,21 +2311,23 @@ var LogEntry = class {
2139
2311
  }
2140
2312
  return json;
2141
2313
  }
2142
- _updateInternals(data) {
2143
- for (let key in data) {
2144
- if (key === "id" || key === "createdAt") continue;
2145
- if (key in this) {
2146
- this[key] = data[key];
2147
- }
2314
+ };
2315
+ _LogEntry_instances = new WeakSet();
2316
+ updateInternals_fn6 = function(data) {
2317
+ for (let key in data) {
2318
+ if (key === "id" || key === "createdAt") continue;
2319
+ if (key in this) {
2320
+ this[key] = data[key];
2148
2321
  }
2149
- this.updatedAt = /* @__PURE__ */ new Date();
2150
- this.manager.set(this);
2151
- return this;
2152
2322
  }
2323
+ this.updatedAt = /* @__PURE__ */ new Date();
2324
+ this.manager.set(this);
2325
+ return this;
2153
2326
  };
2154
2327
 
2155
2328
  // src/structures/match/GuildMatch.ts
2156
- var GuildMatch = class _GuildMatch {
2329
+ var _GuildMatch_instances, updateInternals_fn7;
2330
+ var _GuildMatch = class _GuildMatch {
2157
2331
  /**
2158
2332
  * GuildMatch match
2159
2333
  * @param data The match's data
@@ -2161,6 +2335,7 @@ var GuildMatch = class _GuildMatch {
2161
2335
  * @param rest The rest client
2162
2336
  */
2163
2337
  constructor(data, manager) {
2338
+ __privateAdd(this, _GuildMatch_instances);
2164
2339
  __publicField(this, "_id");
2165
2340
  __publicField(this, "selections");
2166
2341
  /** Match's type */
@@ -2244,7 +2419,7 @@ var GuildMatch = class _GuildMatch {
2244
2419
  method: "get",
2245
2420
  url: route
2246
2421
  });
2247
- return await this._updateInternals(response);
2422
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2248
2423
  }
2249
2424
  async addConfirmed(type, id) {
2250
2425
  const confirmed = this.confirmed.find((c) => c.type === type);
@@ -2266,7 +2441,7 @@ var GuildMatch = class _GuildMatch {
2266
2441
  url: route,
2267
2442
  payload: set
2268
2443
  });
2269
- return await this._updateInternals(response);
2444
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2270
2445
  }
2271
2446
  async setStatus(status) {
2272
2447
  Assertion.assertString(status);
@@ -2277,7 +2452,7 @@ var GuildMatch = class _GuildMatch {
2277
2452
  url: route,
2278
2453
  payload
2279
2454
  });
2280
- return await this._updateInternals(response);
2455
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2281
2456
  }
2282
2457
  async setWinners(players) {
2283
2458
  if (!Array.isArray(players)) players = [players];
@@ -2288,7 +2463,7 @@ var GuildMatch = class _GuildMatch {
2288
2463
  url: route,
2289
2464
  payload
2290
2465
  });
2291
- return await this._updateInternals(response);
2466
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2292
2467
  }
2293
2468
  async setLoser(players) {
2294
2469
  if (!Array.isArray(players)) players = [players];
@@ -2299,7 +2474,7 @@ var GuildMatch = class _GuildMatch {
2299
2474
  url: route,
2300
2475
  payload
2301
2476
  });
2302
- return await this._updateInternals(response);
2477
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2303
2478
  }
2304
2479
  async setMvps(...usersId) {
2305
2480
  const payload = { set: usersId };
@@ -2309,7 +2484,7 @@ var GuildMatch = class _GuildMatch {
2309
2484
  url: route,
2310
2485
  payload
2311
2486
  });
2312
- return await this._updateInternals(response);
2487
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2313
2488
  }
2314
2489
  async setRoomCreatorId(userId) {
2315
2490
  Assertion.assertString(userId);
@@ -2320,7 +2495,7 @@ var GuildMatch = class _GuildMatch {
2320
2495
  url: route,
2321
2496
  payload
2322
2497
  });
2323
- return await this._updateInternals(response);
2498
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2324
2499
  }
2325
2500
  async setRoomAdminId(userId) {
2326
2501
  Assertion.assertString(userId);
@@ -2331,7 +2506,7 @@ var GuildMatch = class _GuildMatch {
2331
2506
  url: route,
2332
2507
  payload
2333
2508
  });
2334
- return await this._updateInternals(response);
2509
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2335
2510
  }
2336
2511
  async kick(player) {
2337
2512
  this.players = this.players.filter((p) => p.id !== player.id);
@@ -2355,7 +2530,7 @@ var GuildMatch = class _GuildMatch {
2355
2530
  payload: data
2356
2531
  });
2357
2532
  this.rest.emit("matchUpdate", this, new _GuildMatch(response, this.manager));
2358
- return await this._updateInternals(response);
2533
+ return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
2359
2534
  }
2360
2535
  async delete() {
2361
2536
  const route = Routes.guilds.matches.resource(this.guild.id, this._id);
@@ -2381,35 +2556,38 @@ var GuildMatch = class _GuildMatch {
2381
2556
  messages: this?.messages instanceof MessagesManager ? this.messages?.cache?.toArray() : []
2382
2557
  };
2383
2558
  }
2384
- async _updateInternals(data) {
2385
- if (!data) return;
2386
- for (let key in data) {
2387
- if (key === "id" || key === "createdAt" || key === "messages") continue;
2388
- if (key in this) {
2389
- this[key] = data[key];
2390
- }
2391
- if (key === "bet") {
2392
- this.bet = this.guild.bets.set(data.bet);
2393
- }
2559
+ };
2560
+ _GuildMatch_instances = new WeakSet();
2561
+ updateInternals_fn7 = async function(data) {
2562
+ if (!data) return;
2563
+ for (let key in data) {
2564
+ if (key === "id" || key === "createdAt" || key === "messages") continue;
2565
+ if (key in this) {
2566
+ this[key] = data[key];
2394
2567
  }
2395
- if (data?.messages?.length !== 0) {
2396
- if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
2397
- else {
2398
- this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
2399
- this.messages.set(data.messages);
2400
- }
2568
+ if (key === "bet") {
2569
+ this.bet = this.guild.bets.set(data.bet);
2401
2570
  }
2402
- if (!(this.bet instanceof GuildBet) && data?.bet) {
2403
- this.bet = this.guild.bets.cache.get(data._id) ?? await this.guild.bets.fetch({ betId: data?.bet?._id });
2571
+ }
2572
+ if (data?.messages?.length !== 0) {
2573
+ if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
2574
+ else {
2575
+ this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
2576
+ this.messages.set(data.messages);
2404
2577
  }
2405
- this.updatedAt = /* @__PURE__ */ new Date();
2406
- this.manager.set(this);
2407
- return this;
2408
2578
  }
2579
+ if (!(this.bet instanceof GuildBet) && data?.bet) {
2580
+ this.bet = this.guild.bets.cache.get(data._id) ?? await this.guild.bets.fetch({ betId: data?.bet?._id });
2581
+ }
2582
+ this.updatedAt = /* @__PURE__ */ new Date();
2583
+ this.manager.set(this);
2584
+ return this;
2409
2585
  };
2586
+ var GuildMatch = _GuildMatch;
2410
2587
 
2411
2588
  // src/structures/user/GuildUser.ts
2412
- var GuildUser = class _GuildUser {
2589
+ var _GuildUser_instances, updateInternals_fn8;
2590
+ var _GuildUser = class _GuildUser {
2413
2591
  /**
2414
2592
  * Bet user
2415
2593
  * @param data The user's data
@@ -2417,6 +2595,7 @@ var GuildUser = class _GuildUser {
2417
2595
  * @param rest The rest client
2418
2596
  */
2419
2597
  constructor(data, manager) {
2598
+ __privateAdd(this, _GuildUser_instances);
2420
2599
  /** User's id */
2421
2600
  __publicField(this, "id");
2422
2601
  __publicField(this, "guild_id");
@@ -2529,7 +2708,7 @@ var GuildUser = class _GuildUser {
2529
2708
  url: route,
2530
2709
  payload
2531
2710
  });
2532
- this._updateInternals(response);
2711
+ __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
2533
2712
  return this;
2534
2713
  }
2535
2714
  async updateProfile(data) {
@@ -2550,43 +2729,14 @@ var GuildUser = class _GuildUser {
2550
2729
  url: route,
2551
2730
  payload: _data
2552
2731
  });
2553
- this._updateInternals(response);
2554
- return this;
2555
- }
2556
- _updateInternals(data) {
2557
- for (let key in data) {
2558
- if (key === "id" || key === "createdAt") continue;
2559
- if (key in this) {
2560
- this[key] = data[key];
2561
- }
2562
- if (key === "adverts") {
2563
- this.adverts = [];
2564
- for (let _adv of data.adverts) {
2565
- this.adverts.push({
2566
- _id: _adv._id,
2567
- admin_id: _adv.admin_id,
2568
- role_id: _adv.role_id,
2569
- reason: _adv.reason,
2570
- points_removed: _adv.points_removed,
2571
- proof: _adv.proof,
2572
- proof_ext: _adv.proof_ext,
2573
- createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
2574
- updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
2575
- });
2576
- }
2577
- }
2578
- }
2579
- this.updatedAt = /* @__PURE__ */ new Date();
2580
- this.createdAt = new Date(data.createdAt);
2581
- this.manager.set(this);
2582
- this.rest.emit("userUpdate", this);
2732
+ __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
2583
2733
  return this;
2584
2734
  }
2585
2735
  async addAdvert(data) {
2586
2736
  const route = Routes.guilds.users.resource(this.manager.guild.id, this.id, "adverts");
2587
2737
  const payload = data;
2588
2738
  const response = await this.rest.request({ method: "POST", url: route, payload });
2589
- return this._updateInternals(response);
2739
+ return __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
2590
2740
  }
2591
2741
  async removeAdvert(advertId) {
2592
2742
  let advs = this.adverts;
@@ -2595,7 +2745,7 @@ var GuildUser = class _GuildUser {
2595
2745
  const payload = { adverts: advs };
2596
2746
  const route = Routes.guilds.users.update(this.manager.guild.id, this.id);
2597
2747
  const response = await this.rest.request({ method: "PATCH", url: route, payload });
2598
- return this._updateInternals(response);
2748
+ return __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
2599
2749
  }
2600
2750
  /**
2601
2751
  * Update certain property
@@ -2646,7 +2796,7 @@ var GuildUser = class _GuildUser {
2646
2796
  url: route,
2647
2797
  payload
2648
2798
  });
2649
- this._updateInternals(response);
2799
+ __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
2650
2800
  return this;
2651
2801
  }
2652
2802
  async delete() {
@@ -2671,6 +2821,37 @@ var GuildUser = class _GuildUser {
2671
2821
  return json;
2672
2822
  }
2673
2823
  };
2824
+ _GuildUser_instances = new WeakSet();
2825
+ updateInternals_fn8 = function(data) {
2826
+ for (let key in data) {
2827
+ if (key === "id" || key === "createdAt") continue;
2828
+ if (key in this) {
2829
+ this[key] = data[key];
2830
+ }
2831
+ if (key === "adverts") {
2832
+ this.adverts = [];
2833
+ for (let _adv of data.adverts) {
2834
+ this.adverts.push({
2835
+ _id: _adv._id,
2836
+ admin_id: _adv.admin_id,
2837
+ role_id: _adv.role_id,
2838
+ reason: _adv.reason,
2839
+ points_removed: _adv.points_removed,
2840
+ proof: _adv.proof,
2841
+ proof_ext: _adv.proof_ext,
2842
+ createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
2843
+ updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
2844
+ });
2845
+ }
2846
+ }
2847
+ }
2848
+ this.updatedAt = /* @__PURE__ */ new Date();
2849
+ this.createdAt = new Date(data.createdAt);
2850
+ this.manager.set(this);
2851
+ this.rest.emit("userUpdate", this);
2852
+ return this;
2853
+ };
2854
+ var GuildUser = _GuildUser;
2674
2855
 
2675
2856
  // src/structures/vipmember/VipMember.ts
2676
2857
  var _VipMember_instances, updateData_fn;
@@ -2809,8 +2990,10 @@ updateData_fn = function(data) {
2809
2990
  var VipMember = _VipMember;
2810
2991
 
2811
2992
  // src/structures/ticket/Ticket.ts
2993
+ var _GuildTicket_instances, updateInternals_fn9;
2812
2994
  var GuildTicket = class {
2813
2995
  constructor(data, manager) {
2996
+ __privateAdd(this, _GuildTicket_instances);
2814
2997
  __publicField(this, "_id");
2815
2998
  __publicField(this, "guild_id");
2816
2999
  __publicField(this, "type");
@@ -2847,7 +3030,7 @@ var GuildTicket = class {
2847
3030
  method: "GET",
2848
3031
  url: route
2849
3032
  });
2850
- return this._updateInternals(response);
3033
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2851
3034
  }
2852
3035
  async setCustomerRating(rating) {
2853
3036
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "customer_rating");
@@ -2857,7 +3040,7 @@ var GuildTicket = class {
2857
3040
  url: route,
2858
3041
  payload
2859
3042
  });
2860
- return this._updateInternals(response);
3043
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2861
3044
  }
2862
3045
  async setAdminId(id) {
2863
3046
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "admin_id");
@@ -2867,7 +3050,7 @@ var GuildTicket = class {
2867
3050
  url: route,
2868
3051
  payload
2869
3052
  });
2870
- return this._updateInternals(response);
3053
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2871
3054
  }
2872
3055
  async setChannelId(id) {
2873
3056
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "channel_id");
@@ -2877,7 +3060,7 @@ var GuildTicket = class {
2877
3060
  url: route,
2878
3061
  payload
2879
3062
  });
2880
- return this._updateInternals(response);
3063
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2881
3064
  }
2882
3065
  async setClosedById(id) {
2883
3066
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "closed_by_id");
@@ -2887,7 +3070,7 @@ var GuildTicket = class {
2887
3070
  url: route,
2888
3071
  payload
2889
3072
  });
2890
- return this._updateInternals(response);
3073
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2891
3074
  }
2892
3075
  async setStatus(status) {
2893
3076
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "status");
@@ -2897,7 +3080,7 @@ var GuildTicket = class {
2897
3080
  url: route,
2898
3081
  payload
2899
3082
  });
2900
- return this._updateInternals(response);
3083
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2901
3084
  }
2902
3085
  async addMessage(message) {
2903
3086
  const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "messages");
@@ -2907,25 +3090,28 @@ var GuildTicket = class {
2907
3090
  url: route,
2908
3091
  payload
2909
3092
  });
2910
- return this._updateInternals(response);
3093
+ return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
2911
3094
  }
2912
- _updateInternals(data) {
2913
- for (let key in data) {
2914
- if (key === "id" || key === "createdAt") continue;
2915
- if (key in this) {
2916
- this[key] = data[key];
2917
- }
3095
+ };
3096
+ _GuildTicket_instances = new WeakSet();
3097
+ updateInternals_fn9 = function(data) {
3098
+ for (let key in data) {
3099
+ if (key === "id" || key === "createdAt") continue;
3100
+ if (key in this) {
3101
+ this[key] = data[key];
2918
3102
  }
2919
- this.updatedAt = /* @__PURE__ */ new Date();
2920
- this.createdAt = new Date(data.createdAt);
2921
- this.manager.set(this);
2922
- return this;
2923
3103
  }
3104
+ this.updatedAt = /* @__PURE__ */ new Date();
3105
+ this.createdAt = new Date(data.createdAt);
3106
+ this.manager.set(this);
3107
+ return this;
2924
3108
  };
2925
3109
 
2926
3110
  // src/structures/minesgame/MinesGame.ts
3111
+ var _MinesGame_instances, updateInternals_fn10;
2927
3112
  var MinesGame = class {
2928
3113
  constructor(data, manager) {
3114
+ __privateAdd(this, _MinesGame_instances);
2929
3115
  __publicField(this, "guild_id");
2930
3116
  __publicField(this, "_id");
2931
3117
  __publicField(this, "creatorId");
@@ -2959,7 +3145,7 @@ var MinesGame = class {
2959
3145
  method: "GET",
2960
3146
  url: route
2961
3147
  });
2962
- return this._updateInternals(response);
3148
+ return __privateMethod(this, _MinesGame_instances, updateInternals_fn10).call(this, response);
2963
3149
  }
2964
3150
  async delete() {
2965
3151
  const route = `/${Routes.fields("minesgames", this._id)}`;
@@ -2967,7 +3153,7 @@ var MinesGame = class {
2967
3153
  method: "delete",
2968
3154
  url: route
2969
3155
  });
2970
- return this._updateInternals(response);
3156
+ return __privateMethod(this, _MinesGame_instances, updateInternals_fn10).call(this, response);
2971
3157
  }
2972
3158
  async update(data) {
2973
3159
  const route = `/${Routes.fields("minesgames", this._id)}`;
@@ -2976,25 +3162,27 @@ var MinesGame = class {
2976
3162
  url: route,
2977
3163
  payload: data
2978
3164
  });
2979
- return this._updateInternals(response);
3165
+ return __privateMethod(this, _MinesGame_instances, updateInternals_fn10).call(this, response);
2980
3166
  }
2981
- _updateInternals(data) {
2982
- for (let key in data) {
2983
- if (key === "id" || key === "createdAt") continue;
2984
- if (key in this) {
2985
- this[key] = data[key];
2986
- }
3167
+ };
3168
+ _MinesGame_instances = new WeakSet();
3169
+ updateInternals_fn10 = function(data) {
3170
+ for (let key in data) {
3171
+ if (key === "id" || key === "createdAt") continue;
3172
+ if (key in this) {
3173
+ this[key] = data[key];
2987
3174
  }
2988
- this.updatedAt = /* @__PURE__ */ new Date();
2989
- this.manager.set(this);
2990
- return this;
2991
3175
  }
3176
+ this.updatedAt = /* @__PURE__ */ new Date();
3177
+ this.manager.set(this);
3178
+ return this;
2992
3179
  };
2993
3180
 
2994
3181
  // src/structures/automaticmessage/AutomaticMessage.ts
3182
+ var _AutomaticMessage_instances, updateInternals_fn11;
2995
3183
  var AutomaticMessage = class {
2996
3184
  constructor(data, manager) {
2997
- __publicField(this, "_id");
3185
+ __privateAdd(this, _AutomaticMessage_instances);
2998
3186
  __publicField(this, "id");
2999
3187
  __publicField(this, "type");
3000
3188
  __publicField(this, "admin_id");
@@ -3013,7 +3201,6 @@ var AutomaticMessage = class {
3013
3201
  this.manager = manager;
3014
3202
  this.guild = manager.guild;
3015
3203
  this.rest = manager.rest;
3016
- this._id = data?._id;
3017
3204
  this.id = data?.id;
3018
3205
  this.type = data?.type;
3019
3206
  this.admin_id = data?.admin_id;
@@ -3028,12 +3215,7 @@ var AutomaticMessage = class {
3028
3215
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
3029
3216
  }
3030
3217
  async fetch() {
3031
- const route = Routes.guilds.resource(this.guild.id, "automatic_messages", this._id);
3032
- const response = await this.rest.request({
3033
- method: "get",
3034
- url: route
3035
- });
3036
- return this._updateInternals(response);
3218
+ return this.manager.fetch(this.id);
3037
3219
  }
3038
3220
  async addChannelId(...id) {
3039
3221
  const ids = [.../* @__PURE__ */ new Set([...this.channel_ids, ...id])];
@@ -3045,39 +3227,28 @@ var AutomaticMessage = class {
3045
3227
  return this.update({ channel_ids: ids });
3046
3228
  }
3047
3229
  async update(data) {
3230
+ this.manager.cache.set(this.id, { ...this, ...data, id: this.id });
3048
3231
  const route = Routes.guilds.get(this.guild.id);
3049
3232
  const response = await this.rest.request({
3050
3233
  method: "patch",
3051
3234
  url: route,
3052
- payload: { automatic_messages: this.manager.cache.toArray() }
3235
+ payload: { automatic_messages: this.manager.toJSON() }
3053
3236
  });
3054
- return this._updateInternals(response);
3237
+ return __privateMethod(this, _AutomaticMessage_instances, updateInternals_fn11).call(this, response);
3055
3238
  }
3056
3239
  async delete() {
3057
- this.manager.cache.delete(this._id);
3240
+ this.manager.cache.delete(this.id);
3241
+ this.guild.automatic_messages = this.manager.cache.toArray();
3058
3242
  const route = Routes.guilds.get(this.guild.id);
3059
3243
  const response = await this.rest.request({
3060
3244
  method: "patch",
3061
3245
  url: route,
3062
- payload: { automatic_messages: this.manager.cache.toArray() }
3246
+ payload: { automatic_messages: this.manager.toJSON() }
3063
3247
  });
3064
3248
  return this.manager.set(response.automatic_messages);
3065
3249
  }
3066
- _updateInternals(data) {
3067
- for (let key in data) {
3068
- if (key === "_id" || key === "createdAt") continue;
3069
- if (key in this) {
3070
- this[key] = data[key];
3071
- }
3072
- }
3073
- this.updatedAt = /* @__PURE__ */ new Date();
3074
- this.createdAt = new Date(data.createdAt);
3075
- this.manager._add(this);
3076
- return this;
3077
- }
3078
3250
  toJSON() {
3079
3251
  return {
3080
- _id: this._id,
3081
3252
  id: this.id,
3082
3253
  type: this.type,
3083
3254
  admin_id: this.admin_id,
@@ -3093,6 +3264,20 @@ var AutomaticMessage = class {
3093
3264
  };
3094
3265
  }
3095
3266
  };
3267
+ _AutomaticMessage_instances = new WeakSet();
3268
+ updateInternals_fn11 = function(data) {
3269
+ const _this = data?.automatic_messages?.find((m) => m.id === this.id);
3270
+ for (let key in _this) {
3271
+ if (key === "id" || key === "createdAt") continue;
3272
+ if (key in this) {
3273
+ this[key] = _this[key];
3274
+ }
3275
+ }
3276
+ this.updatedAt = /* @__PURE__ */ new Date();
3277
+ this.createdAt = new Date(data.createdAt);
3278
+ this.manager._add(data.automatic_messages);
3279
+ return this;
3280
+ };
3096
3281
 
3097
3282
  // src/utils/randomKeyGenerator.ts
3098
3283
  var import_crypto = require("crypto");
@@ -3106,25 +3291,19 @@ var AutomaticMessageManager = class extends BaseManager {
3106
3291
  super(guild);
3107
3292
  this.guild = guild;
3108
3293
  this.rest = guild.rest;
3109
- this.base_url = Routes.guilds.resource(guild.id, "automatic_messages");
3294
+ this.base_url = Routes.guilds.resource(guild.id);
3110
3295
  this.cache = new Collection();
3111
3296
  if (guild.automatic_messages && guild.automatic_messages.length !== 0) this.set(guild.automatic_messages);
3112
3297
  else this.guild.automatic_messages = [];
3113
3298
  }
3114
3299
  async fetch(messageId) {
3115
3300
  const route = this.base_url;
3116
- if (messageId) {
3117
- const response2 = await this.rest.request({
3118
- method: "get",
3119
- url: `${route}`
3120
- });
3121
- return this._add(response2).find((m) => m.id === messageId);
3122
- }
3123
3301
  const response = await this.rest.request({
3124
3302
  method: "get",
3125
3303
  url: route
3126
3304
  });
3127
- return this._add(response.automatic_messages);
3305
+ this._add(response.automatic_messages);
3306
+ return this.cache;
3128
3307
  }
3129
3308
  async create(data) {
3130
3309
  if (!data.type) throw new Error(`Missing message's type.`);
@@ -3151,6 +3330,7 @@ var AutomaticMessageManager = class extends BaseManager {
3151
3330
  if (data instanceof AutomaticMessage) this.cache.set(data.id, data);
3152
3331
  else this.cache.set(data.id, new AutomaticMessage(data, this));
3153
3332
  }
3333
+ this.guild.automatic_messages = this.cache.toArray();
3154
3334
  return this.cache;
3155
3335
  }
3156
3336
  set(data) {
@@ -3179,6 +3359,10 @@ var AutomaticMessageManager = class extends BaseManager {
3179
3359
  });
3180
3360
  return response;
3181
3361
  }
3362
+ toJSON() {
3363
+ [...this.cache.values()].map((m) => console.log(m instanceof AutomaticMessage));
3364
+ return this.cache.toArray();
3365
+ }
3182
3366
  };
3183
3367
 
3184
3368
  // src/managers/bet/GuildBetManager.ts
@@ -3599,15 +3783,14 @@ var GuildTicketManager = class {
3599
3783
  } else {
3600
3784
  categories.push(data);
3601
3785
  }
3602
- const payload = { tickets_configuration: { categories } };
3603
- const route = Routes.guilds.get(this.guild.id);
3604
- const response = await this.rest.request({
3605
- method: "PATCH",
3606
- url: route,
3607
- payload
3786
+ return this.guild.update({
3787
+ tickets_configuration: {
3788
+ categories,
3789
+ creationCategory: this.guild.tickets_configuration.creationCategory,
3790
+ deletionCategory: this.guild.tickets_configuration.deletionCategory,
3791
+ rating_channel_id: this.guild.tickets_configuration.rating_channel_id
3792
+ }
3608
3793
  });
3609
- this.guild._updateInternals(response);
3610
- return response;
3611
3794
  }
3612
3795
  async deleteTicketCategory(data) {
3613
3796
  let categories = this.guild.tickets_configuration.categories;
@@ -3621,8 +3804,14 @@ var GuildTicketManager = class {
3621
3804
  url: route,
3622
3805
  payload
3623
3806
  });
3624
- this.guild._updateInternals(response);
3625
- return response;
3807
+ return this.guild.update({
3808
+ tickets_configuration: {
3809
+ categories,
3810
+ creationCategory: this.guild.tickets_configuration.creationCategory,
3811
+ deletionCategory: this.guild.tickets_configuration.deletionCategory,
3812
+ rating_channel_id: this.guild.tickets_configuration.rating_channel_id
3813
+ }
3814
+ });
3626
3815
  }
3627
3816
  async fetch(options) {
3628
3817
  if (options && options.cache) return this.cache;