@duque.edits/sdk 1.1.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (350) hide show
  1. package/dist/{index-BPxglVSk.d.ts → index-0BFrnm6S.d.ts} +437 -193
  2. package/dist/index.d.ts +2 -1
  3. package/dist/index.js +10 -4225
  4. package/dist/index.js.map +1 -0
  5. package/dist/managers/automaticmessage/AutomaticMessageManager.d.ts +2 -1
  6. package/dist/managers/automaticmessage/AutomaticMessageManager.js +42 -739
  7. package/dist/managers/automaticmessage/AutomaticMessageManager.js.map +1 -0
  8. package/dist/managers/base.d.ts +2 -1
  9. package/dist/managers/base.js +8 -89
  10. package/dist/managers/base.js.map +1 -0
  11. package/dist/managers/bet/GuildBetManager.d.ts +2 -1
  12. package/dist/managers/bet/GuildBetManager.js +21 -901
  13. package/dist/managers/bet/GuildBetManager.js.map +1 -0
  14. package/dist/managers/betuser/GuildBetUserManager.d.ts +2 -1
  15. package/dist/managers/betuser/GuildBetUserManager.js +22 -444
  16. package/dist/managers/betuser/GuildBetUserManager.js.map +1 -0
  17. package/dist/managers/buffer/BufferManager.d.ts +2 -1
  18. package/dist/managers/buffer/BufferManager.js +8 -192
  19. package/dist/managers/buffer/BufferManager.js.map +1 -0
  20. package/dist/managers/guild/GuildManager.d.ts +2 -1
  21. package/dist/managers/guild/GuildManager.js +38 -3704
  22. package/dist/managers/guild/GuildManager.js.map +1 -0
  23. package/dist/managers/index.d.ts +2 -1
  24. package/dist/managers/index.js +40 -3937
  25. package/dist/managers/index.js.map +1 -0
  26. package/dist/managers/logs/LogManager.d.ts +2 -1
  27. package/dist/managers/logs/LogManager.js +16 -673
  28. package/dist/managers/logs/LogManager.js.map +1 -0
  29. package/dist/managers/match/GuildMatchManager.d.ts +2 -1
  30. package/dist/managers/match/GuildMatchManager.js +26 -1225
  31. package/dist/managers/match/GuildMatchManager.js.map +1 -0
  32. package/dist/managers/mediator/GuildMediatorManager.d.ts +2 -1
  33. package/dist/managers/mediator/GuildMediatorManager.js +23 -365
  34. package/dist/managers/mediator/GuildMediatorManager.js.map +1 -0
  35. package/dist/managers/message/MessagesManager.d.ts +2 -1
  36. package/dist/managers/message/MessagesManager.js +5 -88
  37. package/dist/managers/message/MessagesManager.js.map +1 -0
  38. package/dist/managers/minesgame/MinesGameManager.d.ts +2 -1
  39. package/dist/managers/minesgame/MinesGameManager.js +16 -655
  40. package/dist/managers/minesgame/MinesGameManager.js.map +1 -0
  41. package/dist/managers/permission/GuildPermissionManager.d.ts +2 -1
  42. package/dist/managers/permission/GuildPermissionManager.js +22 -212
  43. package/dist/managers/permission/GuildPermissionManager.js.map +1 -0
  44. package/dist/managers/player/PlayerManager.d.ts +2 -1
  45. package/dist/managers/player/PlayerManager.js +4 -87
  46. package/dist/managers/player/PlayerManager.js.map +1 -0
  47. package/dist/managers/product/ProductManager.d.ts +22 -0
  48. package/dist/managers/product/ProductManager.js +101 -0
  49. package/dist/managers/product/ProductManager.js.map +1 -0
  50. package/dist/managers/shop/ShopManager.d.ts +22 -0
  51. package/dist/managers/shop/ShopManager.js +99 -0
  52. package/dist/managers/shop/ShopManager.js.map +1 -0
  53. package/dist/managers/ticket/TicketManager.d.ts +2 -1
  54. package/dist/managers/ticket/TicketManager.js +25 -707
  55. package/dist/managers/ticket/TicketManager.js.map +1 -0
  56. package/dist/managers/ticketpanel/TicketPanelManager.d.ts +22 -0
  57. package/dist/managers/ticketpanel/TicketPanelManager.js +82 -0
  58. package/dist/managers/ticketpanel/TicketPanelManager.js.map +1 -0
  59. package/dist/managers/tournament/TournamentManager.d.ts +2 -1
  60. package/dist/managers/tournament/TournamentManager.js +33 -686
  61. package/dist/managers/tournament/TournamentManager.js.map +1 -0
  62. package/dist/managers/user/GuildUserManager.d.ts +2 -1
  63. package/dist/managers/user/GuildUserManager.js +24 -502
  64. package/dist/managers/user/GuildUserManager.js.map +1 -0
  65. package/dist/managers/vipmember/VipMemberManager.d.ts +2 -1
  66. package/dist/managers/vipmember/VipMemberManager.js +30 -425
  67. package/dist/managers/vipmember/VipMemberManager.js.map +1 -0
  68. package/dist/rest/APIEndpoints.js +4 -5
  69. package/dist/rest/APIEndpoints.js.map +1 -0
  70. package/dist/rest/REST.d.ts +2 -1
  71. package/dist/rest/REST.js +57 -3932
  72. package/dist/rest/REST.js.map +1 -0
  73. package/dist/rest/Routes.d.ts +79 -87
  74. package/dist/rest/Routes.js +9 -18
  75. package/dist/rest/Routes.js.map +1 -0
  76. package/dist/rest/index.d.ts +2 -1
  77. package/dist/rest/index.js +8 -4027
  78. package/dist/rest/index.js.map +1 -0
  79. package/dist/structures/Collection.js +6 -7
  80. package/dist/structures/Collection.js.map +1 -0
  81. package/dist/structures/automaticmessage/AutomaticMessage.d.ts +3 -2
  82. package/dist/structures/automaticmessage/AutomaticMessage.js +51 -531
  83. package/dist/structures/automaticmessage/AutomaticMessage.js.map +1 -0
  84. package/dist/structures/bet/GuildBet.d.ts +2 -1
  85. package/dist/structures/bet/GuildBet.js +21 -696
  86. package/dist/structures/bet/GuildBet.js.map +1 -0
  87. package/dist/structures/betuser/GuildBetUser.d.ts +2 -1
  88. package/dist/structures/betuser/GuildBetUser.js +32 -130
  89. package/dist/structures/betuser/GuildBetUser.js.map +1 -0
  90. package/dist/structures/guild/Guild.d.ts +5 -4
  91. package/dist/structures/guild/Guild.js +195 -3321
  92. package/dist/structures/guild/Guild.js.map +1 -0
  93. package/dist/structures/index.d.ts +2 -1
  94. package/dist/structures/index.js +34 -3772
  95. package/dist/structures/index.js.map +1 -0
  96. package/dist/structures/logentry/LogEntry.d.ts +2 -1
  97. package/dist/structures/logentry/LogEntry.js +24 -497
  98. package/dist/structures/logentry/LogEntry.js.map +1 -0
  99. package/dist/structures/match/GuildMatch.d.ts +2 -1
  100. package/dist/structures/match/GuildMatch.js +56 -950
  101. package/dist/structures/match/GuildMatch.js.map +1 -0
  102. package/dist/structures/mediator/GuildMediator.d.ts +2 -1
  103. package/dist/structures/mediator/GuildMediator.js +19 -123
  104. package/dist/structures/mediator/GuildMediator.js.map +1 -0
  105. package/dist/structures/minesgame/MinesGame.d.ts +2 -1
  106. package/dist/structures/minesgame/MinesGame.js +15 -496
  107. package/dist/structures/minesgame/MinesGame.js.map +1 -0
  108. package/dist/structures/product/Product.d.ts +22 -0
  109. package/dist/structures/product/Product.js +120 -0
  110. package/dist/structures/product/Product.js.map +1 -0
  111. package/dist/structures/shop/Shop.d.ts +22 -0
  112. package/dist/structures/shop/Shop.js +125 -0
  113. package/dist/structures/shop/Shop.js.map +1 -0
  114. package/dist/structures/ticket/Ticket.d.ts +3 -2
  115. package/dist/structures/ticket/Ticket.js +30 -517
  116. package/dist/structures/ticket/Ticket.js.map +1 -0
  117. package/dist/structures/ticketpanel/TicketPanel.d.ts +22 -0
  118. package/dist/structures/ticketpanel/TicketPanel.js +177 -0
  119. package/dist/structures/ticketpanel/TicketPanel.js.map +1 -0
  120. package/dist/structures/tournament/Tournament.d.ts +2 -1
  121. package/dist/structures/tournament/Tournament.js +14 -493
  122. package/dist/structures/tournament/Tournament.js.map +1 -0
  123. package/dist/structures/user/GuildUser.d.ts +2 -1
  124. package/dist/structures/user/GuildUser.js +148 -136
  125. package/dist/structures/user/GuildUser.js.map +1 -0
  126. package/dist/structures/vipmember/VipMember.d.ts +2 -1
  127. package/dist/structures/vipmember/VipMember.js +12 -116
  128. package/dist/structures/vipmember/VipMember.js.map +1 -0
  129. package/dist/types/RestTypes.d.ts +2 -1
  130. package/dist/types/RestTypes.js +1 -2
  131. package/dist/types/RestTypes.js.map +1 -0
  132. package/dist/types/api/APIAdvert.js +1 -2
  133. package/dist/types/api/APIAdvert.js.map +1 -0
  134. package/dist/types/api/APIAutomaticMessage.d.ts +2 -1
  135. package/dist/types/api/APIAutomaticMessage.js +1 -2
  136. package/dist/types/api/APIAutomaticMessage.js.map +1 -0
  137. package/dist/types/api/APIBaseChannel.js +1 -2
  138. package/dist/types/api/APIBaseChannel.js.map +1 -0
  139. package/dist/types/api/APIBetChannel.js +1 -2
  140. package/dist/types/api/APIBetChannel.js.map +1 -0
  141. package/dist/types/api/APICode.js +1 -2
  142. package/dist/types/api/APICode.js.map +1 -0
  143. package/dist/types/api/APIGiveaway.js +1 -2
  144. package/dist/types/api/APIGiveaway.js.map +1 -0
  145. package/dist/types/api/APIGuild.d.ts +5 -4
  146. package/dist/types/api/APIGuild.js +2 -2
  147. package/dist/types/api/APIGuild.js.map +1 -0
  148. package/dist/types/api/APIGuildAdvert.js +1 -2
  149. package/dist/types/api/APIGuildAdvert.js.map +1 -0
  150. package/dist/types/api/APIGuildBet.d.ts +2 -1
  151. package/dist/types/api/APIGuildBet.js +1 -2
  152. package/dist/types/api/APIGuildBet.js.map +1 -0
  153. package/dist/types/api/APIGuildBetUser.d.ts +2 -1
  154. package/dist/types/api/APIGuildBetUser.js +1 -2
  155. package/dist/types/api/APIGuildBetUser.js.map +1 -0
  156. package/dist/types/api/APIGuildChannel.js +1 -2
  157. package/dist/types/api/APIGuildChannel.js.map +1 -0
  158. package/dist/types/api/APIGuildGroupedChannel.d.ts +2 -1
  159. package/dist/types/api/APIGuildGroupedChannel.js +1 -2
  160. package/dist/types/api/APIGuildGroupedChannel.js.map +1 -0
  161. package/dist/types/api/APIGuildMatch.d.ts +2 -1
  162. package/dist/types/api/APIGuildMatch.js +1 -2
  163. package/dist/types/api/APIGuildMatch.js.map +1 -0
  164. package/dist/types/api/APIGuildMediator.js +1 -2
  165. package/dist/types/api/APIGuildMediator.js.map +1 -0
  166. package/dist/types/api/APIGuildPermissions.d.ts +18 -2
  167. package/dist/types/api/APIGuildPermissions.js +18 -3
  168. package/dist/types/api/APIGuildPermissions.js.map +1 -0
  169. package/dist/types/api/APIGuildShop.d.ts +6 -1
  170. package/dist/types/api/APIGuildShop.js +1 -2
  171. package/dist/types/api/APIGuildShop.js.map +1 -0
  172. package/dist/types/api/APIGuildTicket.js +1 -2
  173. package/dist/types/api/APIGuildTicket.js.map +1 -0
  174. package/dist/types/api/APIGuildUser.d.ts +2 -1
  175. package/dist/types/api/APIGuildUser.js +1 -2
  176. package/dist/types/api/APIGuildUser.js.map +1 -0
  177. package/dist/types/api/APILogEntry.d.ts +4 -2
  178. package/dist/types/api/APILogEntry.js +4 -3
  179. package/dist/types/api/APILogEntry.js.map +1 -0
  180. package/dist/types/api/APIMessage.d.ts +2 -0
  181. package/dist/types/api/APIMessage.js +1 -2
  182. package/dist/types/api/APIMessage.js.map +1 -0
  183. package/dist/types/api/APIMinesGame.js +1 -2
  184. package/dist/types/api/APIMinesGame.js.map +1 -0
  185. package/dist/types/api/APIPlayer.js +1 -2
  186. package/dist/types/api/APIPlayer.js.map +1 -0
  187. package/dist/types/api/APIProduct.d.ts +1 -1
  188. package/dist/types/api/APIProduct.js +2 -2
  189. package/dist/types/api/APIProduct.js.map +1 -0
  190. package/dist/types/api/APITicketPanel.d.ts +22 -0
  191. package/dist/types/api/APITicketPanel.js +17 -0
  192. package/dist/types/api/APITicketPanel.js.map +1 -0
  193. package/dist/types/api/APITournament.d.ts +6 -1
  194. package/dist/types/api/APITournament.js +1 -2
  195. package/dist/types/api/APITournament.js.map +1 -0
  196. package/dist/types/api/APIVipMember.js +1 -2
  197. package/dist/types/api/APIVipMember.js.map +1 -0
  198. package/dist/types/api/index.d.ts +2 -1
  199. package/dist/types/api/index.js +63 -110
  200. package/dist/types/api/index.js.map +1 -0
  201. package/dist/types/index.d.ts +2 -1
  202. package/dist/types/index.js +6 -154
  203. package/dist/types/index.js.map +1 -0
  204. package/dist/utils/Assertion.js +3 -4
  205. package/dist/utils/Assertion.js.map +1 -0
  206. package/dist/utils/getRandomNumber.js +1 -2
  207. package/dist/utils/getRandomNumber.js.map +1 -0
  208. package/dist/utils/isSameDayUTC.d.ts +3 -0
  209. package/dist/utils/isSameDayUTC.js +34 -0
  210. package/dist/utils/isSameDayUTC.js.map +1 -0
  211. package/dist/utils/randomKeyGenerator.js +1 -2
  212. package/dist/utils/randomKeyGenerator.js.map +1 -0
  213. package/package.json +4 -5
  214. package/dist/index-DjHimKUy.d.mts +0 -1431
  215. package/dist/index.d.mts +0 -23
  216. package/dist/index.mjs +0 -4196
  217. package/dist/managers/automaticmessage/AutomaticMessageManager.d.mts +0 -21
  218. package/dist/managers/automaticmessage/AutomaticMessageManager.mjs +0 -796
  219. package/dist/managers/base.d.mts +0 -21
  220. package/dist/managers/base.mjs +0 -107
  221. package/dist/managers/bet/GuildBetManager.d.mts +0 -21
  222. package/dist/managers/bet/GuildBetManager.mjs +0 -958
  223. package/dist/managers/betuser/GuildBetUserManager.d.mts +0 -21
  224. package/dist/managers/betuser/GuildBetUserManager.mjs +0 -502
  225. package/dist/managers/buffer/BufferManager.d.mts +0 -21
  226. package/dist/managers/buffer/BufferManager.mjs +0 -223
  227. package/dist/managers/guild/GuildManager.d.mts +0 -21
  228. package/dist/managers/guild/GuildManager.mjs +0 -3786
  229. package/dist/managers/index.d.mts +0 -21
  230. package/dist/managers/index.mjs +0 -3934
  231. package/dist/managers/logs/LogManager.d.mts +0 -21
  232. package/dist/managers/logs/LogManager.mjs +0 -738
  233. package/dist/managers/match/GuildMatchManager.d.mts +0 -21
  234. package/dist/managers/match/GuildMatchManager.mjs +0 -1305
  235. package/dist/managers/mediator/GuildMediatorManager.d.mts +0 -21
  236. package/dist/managers/mediator/GuildMediatorManager.mjs +0 -430
  237. package/dist/managers/message/MessagesManager.d.mts +0 -21
  238. package/dist/managers/message/MessagesManager.mjs +0 -134
  239. package/dist/managers/minesgame/MinesGameManager.d.mts +0 -21
  240. package/dist/managers/minesgame/MinesGameManager.mjs +0 -721
  241. package/dist/managers/permission/GuildPermissionManager.d.mts +0 -21
  242. package/dist/managers/permission/GuildPermissionManager.mjs +0 -256
  243. package/dist/managers/player/PlayerManager.d.mts +0 -21
  244. package/dist/managers/player/PlayerManager.mjs +0 -155
  245. package/dist/managers/ticket/TicketManager.d.mts +0 -21
  246. package/dist/managers/ticket/TicketManager.mjs +0 -827
  247. package/dist/managers/tournament/TournamentManager.d.mts +0 -21
  248. package/dist/managers/tournament/TournamentManager.mjs +0 -745
  249. package/dist/managers/user/GuildUserManager.d.mts +0 -21
  250. package/dist/managers/user/GuildUserManager.mjs +0 -567
  251. package/dist/managers/vipmember/VipMemberManager.d.mts +0 -21
  252. package/dist/managers/vipmember/VipMemberManager.mjs +0 -513
  253. package/dist/rest/APIEndpoints.d.mts +0 -12
  254. package/dist/rest/APIEndpoints.mjs +0 -19
  255. package/dist/rest/REST.d.mts +0 -21
  256. package/dist/rest/REST.mjs +0 -4021
  257. package/dist/rest/Routes.d.mts +0 -104
  258. package/dist/rest/Routes.mjs +0 -104
  259. package/dist/rest/index.d.mts +0 -23
  260. package/dist/rest/index.mjs +0 -4036
  261. package/dist/structures/Collection.d.mts +0 -19
  262. package/dist/structures/Collection.mjs +0 -87
  263. package/dist/structures/automaticmessage/AutomaticMessage.d.mts +0 -21
  264. package/dist/structures/automaticmessage/AutomaticMessage.mjs +0 -609
  265. package/dist/structures/bet/GuildBet.d.mts +0 -21
  266. package/dist/structures/bet/GuildBet.mjs +0 -881
  267. package/dist/structures/betuser/GuildBetUser.d.mts +0 -21
  268. package/dist/structures/betuser/GuildBetUser.mjs +0 -326
  269. package/dist/structures/guild/Guild.d.mts +0 -21
  270. package/dist/structures/guild/Guild.mjs +0 -3690
  271. package/dist/structures/index.d.mts +0 -21
  272. package/dist/structures/index.mjs +0 -3773
  273. package/dist/structures/logentry/LogEntry.d.mts +0 -21
  274. package/dist/structures/logentry/LogEntry.mjs +0 -575
  275. package/dist/structures/match/GuildMatch.d.mts +0 -21
  276. package/dist/structures/match/GuildMatch.mjs +0 -1191
  277. package/dist/structures/mediator/GuildMediator.d.mts +0 -21
  278. package/dist/structures/mediator/GuildMediator.mjs +0 -246
  279. package/dist/structures/minesgame/MinesGame.d.mts +0 -21
  280. package/dist/structures/minesgame/MinesGame.mjs +0 -579
  281. package/dist/structures/ticket/Ticket.d.mts +0 -21
  282. package/dist/structures/ticket/Ticket.mjs +0 -626
  283. package/dist/structures/tournament/Tournament.d.mts +0 -21
  284. package/dist/structures/tournament/Tournament.mjs +0 -585
  285. package/dist/structures/user/GuildUser.d.mts +0 -21
  286. package/dist/structures/user/GuildUser.mjs +0 -382
  287. package/dist/structures/vipmember/VipMember.d.mts +0 -21
  288. package/dist/structures/vipmember/VipMember.mjs +0 -250
  289. package/dist/types/RestTypes.d.mts +0 -21
  290. package/dist/types/RestTypes.mjs +0 -0
  291. package/dist/types/api/APIAdvert.d.mts +0 -13
  292. package/dist/types/api/APIAdvert.mjs +0 -0
  293. package/dist/types/api/APIAutomaticMessage.d.mts +0 -21
  294. package/dist/types/api/APIAutomaticMessage.mjs +0 -0
  295. package/dist/types/api/APIBaseChannel.d.mts +0 -12
  296. package/dist/types/api/APIBaseChannel.mjs +0 -0
  297. package/dist/types/api/APIBetChannel.d.mts +0 -12
  298. package/dist/types/api/APIBetChannel.mjs +0 -0
  299. package/dist/types/api/APICode.d.mts +0 -12
  300. package/dist/types/api/APICode.mjs +0 -0
  301. package/dist/types/api/APIGiveaway.d.mts +0 -29
  302. package/dist/types/api/APIGiveaway.mjs +0 -0
  303. package/dist/types/api/APIGuild.d.mts +0 -21
  304. package/dist/types/api/APIGuild.mjs +0 -46
  305. package/dist/types/api/APIGuildAdvert.d.mts +0 -10
  306. package/dist/types/api/APIGuildAdvert.mjs +0 -0
  307. package/dist/types/api/APIGuildBet.d.mts +0 -21
  308. package/dist/types/api/APIGuildBet.mjs +0 -8
  309. package/dist/types/api/APIGuildBetUser.d.mts +0 -21
  310. package/dist/types/api/APIGuildBetUser.mjs +0 -0
  311. package/dist/types/api/APIGuildChannel.d.mts +0 -12
  312. package/dist/types/api/APIGuildChannel.mjs +0 -0
  313. package/dist/types/api/APIGuildGroupedChannel.d.mts +0 -21
  314. package/dist/types/api/APIGuildGroupedChannel.mjs +0 -0
  315. package/dist/types/api/APIGuildMatch.d.mts +0 -21
  316. package/dist/types/api/APIGuildMatch.mjs +0 -14
  317. package/dist/types/api/APIGuildMediator.d.mts +0 -16
  318. package/dist/types/api/APIGuildMediator.mjs +0 -0
  319. package/dist/types/api/APIGuildPermissions.d.mts +0 -15
  320. package/dist/types/api/APIGuildPermissions.mjs +0 -13
  321. package/dist/types/api/APIGuildShop.d.mts +0 -15
  322. package/dist/types/api/APIGuildShop.mjs +0 -0
  323. package/dist/types/api/APIGuildTicket.d.mts +0 -19
  324. package/dist/types/api/APIGuildTicket.mjs +0 -0
  325. package/dist/types/api/APIGuildUser.d.mts +0 -21
  326. package/dist/types/api/APIGuildUser.mjs +0 -0
  327. package/dist/types/api/APILogEntry.d.mts +0 -32
  328. package/dist/types/api/APILogEntry.mjs +0 -20
  329. package/dist/types/api/APIMessage.d.mts +0 -13
  330. package/dist/types/api/APIMessage.mjs +0 -0
  331. package/dist/types/api/APIMinesGame.d.mts +0 -15
  332. package/dist/types/api/APIMinesGame.mjs +0 -0
  333. package/dist/types/api/APIPlayer.d.mts +0 -10
  334. package/dist/types/api/APIPlayer.mjs +0 -0
  335. package/dist/types/api/APIProduct.d.mts +0 -22
  336. package/dist/types/api/APIProduct.mjs +0 -0
  337. package/dist/types/api/APITournament.d.mts +0 -16
  338. package/dist/types/api/APITournament.mjs +0 -0
  339. package/dist/types/api/APIVipMember.d.mts +0 -22
  340. package/dist/types/api/APIVipMember.mjs +0 -0
  341. package/dist/types/api/index.d.mts +0 -21
  342. package/dist/types/api/index.mjs +0 -135
  343. package/dist/types/index.d.mts +0 -21
  344. package/dist/types/index.mjs +0 -135
  345. package/dist/utils/Assertion.d.mts +0 -34
  346. package/dist/utils/Assertion.mjs +0 -52
  347. package/dist/utils/getRandomNumber.d.mts +0 -3
  348. package/dist/utils/getRandomNumber.mjs +0 -7
  349. package/dist/utils/randomKeyGenerator.d.mts +0 -3
  350. package/dist/utils/randomKeyGenerator.mjs +0 -8
@@ -1,17 +1,8 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __typeError = (msg) => {
9
- throw TypeError(msg);
10
- };
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __commonJS = (cb, mod) => function __require() {
13
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
- };
15
6
  var __export = (target, all) => {
16
7
  for (var name in all)
17
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -24,1198 +15,18 @@ var __copyProps = (to, from, except, desc) => {
24
15
  }
25
16
  return to;
26
17
  };
27
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
- // If the importer is in node compatibility mode or this is not an ESM
29
- // file that has been converted to a CommonJS file using a Babel-
30
- // compatible transform (i.e. "__esModule" has not been set), then set
31
- // "default" to the CommonJS "module.exports" for node compatibility.
32
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
33
- mod
34
- ));
35
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
37
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
38
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
39
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
40
-
41
- // node_modules/dotenv/package.json
42
- var require_package = __commonJS({
43
- "node_modules/dotenv/package.json"(exports2, module2) {
44
- module2.exports = {
45
- name: "dotenv",
46
- version: "16.6.1",
47
- description: "Loads environment variables from .env file",
48
- main: "lib/main.js",
49
- types: "lib/main.d.ts",
50
- exports: {
51
- ".": {
52
- types: "./lib/main.d.ts",
53
- require: "./lib/main.js",
54
- default: "./lib/main.js"
55
- },
56
- "./config": "./config.js",
57
- "./config.js": "./config.js",
58
- "./lib/env-options": "./lib/env-options.js",
59
- "./lib/env-options.js": "./lib/env-options.js",
60
- "./lib/cli-options": "./lib/cli-options.js",
61
- "./lib/cli-options.js": "./lib/cli-options.js",
62
- "./package.json": "./package.json"
63
- },
64
- scripts: {
65
- "dts-check": "tsc --project tests/types/tsconfig.json",
66
- lint: "standard",
67
- pretest: "npm run lint && npm run dts-check",
68
- test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
69
- "test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
70
- prerelease: "npm test",
71
- release: "standard-version"
72
- },
73
- repository: {
74
- type: "git",
75
- url: "git://github.com/motdotla/dotenv.git"
76
- },
77
- homepage: "https://github.com/motdotla/dotenv#readme",
78
- funding: "https://dotenvx.com",
79
- keywords: [
80
- "dotenv",
81
- "env",
82
- ".env",
83
- "environment",
84
- "variables",
85
- "config",
86
- "settings"
87
- ],
88
- readmeFilename: "README.md",
89
- license: "BSD-2-Clause",
90
- devDependencies: {
91
- "@types/node": "^18.11.3",
92
- decache: "^4.6.2",
93
- sinon: "^14.0.1",
94
- standard: "^17.0.0",
95
- "standard-version": "^9.5.0",
96
- tap: "^19.2.0",
97
- typescript: "^4.8.4"
98
- },
99
- engines: {
100
- node: ">=12"
101
- },
102
- browser: {
103
- fs: false
104
- }
105
- };
106
- }
107
- });
108
-
109
- // node_modules/dotenv/lib/main.js
110
- var require_main = __commonJS({
111
- "node_modules/dotenv/lib/main.js"(exports2, module2) {
112
- "use strict";
113
- var fs = require("fs");
114
- var path = require("path");
115
- var os = require("os");
116
- var crypto = require("crypto");
117
- var packageJson = require_package();
118
- var version = packageJson.version;
119
- var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
120
- function parse(src) {
121
- const obj = {};
122
- let lines = src.toString();
123
- lines = lines.replace(/\r\n?/mg, "\n");
124
- let match;
125
- while ((match = LINE.exec(lines)) != null) {
126
- const key = match[1];
127
- let value = match[2] || "";
128
- value = value.trim();
129
- const maybeQuote = value[0];
130
- value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
131
- if (maybeQuote === '"') {
132
- value = value.replace(/\\n/g, "\n");
133
- value = value.replace(/\\r/g, "\r");
134
- }
135
- obj[key] = value;
136
- }
137
- return obj;
138
- }
139
- function _parseVault(options) {
140
- options = options || {};
141
- const vaultPath = _vaultPath(options);
142
- options.path = vaultPath;
143
- const result = DotenvModule.configDotenv(options);
144
- if (!result.parsed) {
145
- const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
146
- err.code = "MISSING_DATA";
147
- throw err;
148
- }
149
- const keys = _dotenvKey(options).split(",");
150
- const length = keys.length;
151
- let decrypted;
152
- for (let i = 0; i < length; i++) {
153
- try {
154
- const key = keys[i].trim();
155
- const attrs = _instructions(result, key);
156
- decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
157
- break;
158
- } catch (error) {
159
- if (i + 1 >= length) {
160
- throw error;
161
- }
162
- }
163
- }
164
- return DotenvModule.parse(decrypted);
165
- }
166
- function _warn(message) {
167
- console.log(`[dotenv@${version}][WARN] ${message}`);
168
- }
169
- function _debug(message) {
170
- console.log(`[dotenv@${version}][DEBUG] ${message}`);
171
- }
172
- function _log(message) {
173
- console.log(`[dotenv@${version}] ${message}`);
174
- }
175
- function _dotenvKey(options) {
176
- if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
177
- return options.DOTENV_KEY;
178
- }
179
- if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
180
- return process.env.DOTENV_KEY;
181
- }
182
- return "";
183
- }
184
- function _instructions(result, dotenvKey) {
185
- let uri;
186
- try {
187
- uri = new URL(dotenvKey);
188
- } catch (error) {
189
- if (error.code === "ERR_INVALID_URL") {
190
- const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
191
- err.code = "INVALID_DOTENV_KEY";
192
- throw err;
193
- }
194
- throw error;
195
- }
196
- const key = uri.password;
197
- if (!key) {
198
- const err = new Error("INVALID_DOTENV_KEY: Missing key part");
199
- err.code = "INVALID_DOTENV_KEY";
200
- throw err;
201
- }
202
- const environment = uri.searchParams.get("environment");
203
- if (!environment) {
204
- const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
205
- err.code = "INVALID_DOTENV_KEY";
206
- throw err;
207
- }
208
- const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
209
- const ciphertext = result.parsed[environmentKey];
210
- if (!ciphertext) {
211
- const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
212
- err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
213
- throw err;
214
- }
215
- return { ciphertext, key };
216
- }
217
- function _vaultPath(options) {
218
- let possibleVaultPath = null;
219
- if (options && options.path && options.path.length > 0) {
220
- if (Array.isArray(options.path)) {
221
- for (const filepath of options.path) {
222
- if (fs.existsSync(filepath)) {
223
- possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
224
- }
225
- }
226
- } else {
227
- possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
228
- }
229
- } else {
230
- possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
231
- }
232
- if (fs.existsSync(possibleVaultPath)) {
233
- return possibleVaultPath;
234
- }
235
- return null;
236
- }
237
- function _resolveHome(envPath) {
238
- return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
239
- }
240
- function _configVault(options) {
241
- const debug = Boolean(options && options.debug);
242
- const quiet = options && "quiet" in options ? options.quiet : true;
243
- if (debug || !quiet) {
244
- _log("Loading env from encrypted .env.vault");
245
- }
246
- const parsed = DotenvModule._parseVault(options);
247
- let processEnv = process.env;
248
- if (options && options.processEnv != null) {
249
- processEnv = options.processEnv;
250
- }
251
- DotenvModule.populate(processEnv, parsed, options);
252
- return { parsed };
253
- }
254
- function configDotenv(options) {
255
- const dotenvPath = path.resolve(process.cwd(), ".env");
256
- let encoding = "utf8";
257
- const debug = Boolean(options && options.debug);
258
- const quiet = options && "quiet" in options ? options.quiet : true;
259
- if (options && options.encoding) {
260
- encoding = options.encoding;
261
- } else {
262
- if (debug) {
263
- _debug("No encoding is specified. UTF-8 is used by default");
264
- }
265
- }
266
- let optionPaths = [dotenvPath];
267
- if (options && options.path) {
268
- if (!Array.isArray(options.path)) {
269
- optionPaths = [_resolveHome(options.path)];
270
- } else {
271
- optionPaths = [];
272
- for (const filepath of options.path) {
273
- optionPaths.push(_resolveHome(filepath));
274
- }
275
- }
276
- }
277
- let lastError;
278
- const parsedAll = {};
279
- for (const path2 of optionPaths) {
280
- try {
281
- const parsed = DotenvModule.parse(fs.readFileSync(path2, { encoding }));
282
- DotenvModule.populate(parsedAll, parsed, options);
283
- } catch (e) {
284
- if (debug) {
285
- _debug(`Failed to load ${path2} ${e.message}`);
286
- }
287
- lastError = e;
288
- }
289
- }
290
- let processEnv = process.env;
291
- if (options && options.processEnv != null) {
292
- processEnv = options.processEnv;
293
- }
294
- DotenvModule.populate(processEnv, parsedAll, options);
295
- if (debug || !quiet) {
296
- const keysCount = Object.keys(parsedAll).length;
297
- const shortPaths = [];
298
- for (const filePath of optionPaths) {
299
- try {
300
- const relative = path.relative(process.cwd(), filePath);
301
- shortPaths.push(relative);
302
- } catch (e) {
303
- if (debug) {
304
- _debug(`Failed to load ${filePath} ${e.message}`);
305
- }
306
- lastError = e;
307
- }
308
- }
309
- _log(`injecting env (${keysCount}) from ${shortPaths.join(",")}`);
310
- }
311
- if (lastError) {
312
- return { parsed: parsedAll, error: lastError };
313
- } else {
314
- return { parsed: parsedAll };
315
- }
316
- }
317
- function config(options) {
318
- if (_dotenvKey(options).length === 0) {
319
- return DotenvModule.configDotenv(options);
320
- }
321
- const vaultPath = _vaultPath(options);
322
- if (!vaultPath) {
323
- _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
324
- return DotenvModule.configDotenv(options);
325
- }
326
- return DotenvModule._configVault(options);
327
- }
328
- function decrypt(encrypted, keyStr) {
329
- const key = Buffer.from(keyStr.slice(-64), "hex");
330
- let ciphertext = Buffer.from(encrypted, "base64");
331
- const nonce = ciphertext.subarray(0, 12);
332
- const authTag = ciphertext.subarray(-16);
333
- ciphertext = ciphertext.subarray(12, -16);
334
- try {
335
- const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
336
- aesgcm.setAuthTag(authTag);
337
- return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
338
- } catch (error) {
339
- const isRange = error instanceof RangeError;
340
- const invalidKeyLength = error.message === "Invalid key length";
341
- const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
342
- if (isRange || invalidKeyLength) {
343
- const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
344
- err.code = "INVALID_DOTENV_KEY";
345
- throw err;
346
- } else if (decryptionFailed) {
347
- const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
348
- err.code = "DECRYPTION_FAILED";
349
- throw err;
350
- } else {
351
- throw error;
352
- }
353
- }
354
- }
355
- function populate(processEnv, parsed, options = {}) {
356
- const debug = Boolean(options && options.debug);
357
- const override = Boolean(options && options.override);
358
- if (typeof parsed !== "object") {
359
- const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
360
- err.code = "OBJECT_REQUIRED";
361
- throw err;
362
- }
363
- for (const key of Object.keys(parsed)) {
364
- if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
365
- if (override === true) {
366
- processEnv[key] = parsed[key];
367
- }
368
- if (debug) {
369
- if (override === true) {
370
- _debug(`"${key}" is already defined and WAS overwritten`);
371
- } else {
372
- _debug(`"${key}" is already defined and was NOT overwritten`);
373
- }
374
- }
375
- } else {
376
- processEnv[key] = parsed[key];
377
- }
378
- }
379
- }
380
- var DotenvModule = {
381
- configDotenv,
382
- _configVault,
383
- _parseVault,
384
- config,
385
- decrypt,
386
- parse,
387
- populate
388
- };
389
- module2.exports.configDotenv = DotenvModule.configDotenv;
390
- module2.exports._configVault = DotenvModule._configVault;
391
- module2.exports._parseVault = DotenvModule._parseVault;
392
- module2.exports.config = DotenvModule.config;
393
- module2.exports.decrypt = DotenvModule.decrypt;
394
- module2.exports.parse = DotenvModule.parse;
395
- module2.exports.populate = DotenvModule.populate;
396
- module2.exports = DotenvModule;
397
- }
398
- });
399
-
400
- // src/managers/match/GuildMatchManager.ts
401
19
  var GuildMatchManager_exports = {};
402
20
  __export(GuildMatchManager_exports, {
403
21
  GuildMatchManager: () => GuildMatchManager
404
22
  });
405
23
  module.exports = __toCommonJS(GuildMatchManager_exports);
406
-
407
- // src/rest/Routes.ts
408
- var Routes = {
409
- base: "http://localhost:80/api/v1",
410
- //base: "https://duqueapi.shardweb.app/api/v1",
411
- field: (field) => `/${field}`,
412
- fields: (...fields) => `${fields.join("/")}`,
413
- guilds: {
414
- create: () => `/guilds`,
415
- get: (guildId) => `/guilds/${guildId}`,
416
- getAll: () => `/guilds`,
417
- delete: (guildId) => `/guilds/${guildId}`,
418
- deleteAll: () => `/guilds`,
419
- resource: (guildId, ...resources) => `/guilds/${guildId}/manage/${resources.join("/")}`,
420
- resources: (guildId, ...resources) => `/guilds/${guildId}/manage/${resources.join("/")}`,
421
- users: {
422
- create: (guildId) => `/guilds/${guildId}/users`,
423
- update: (guildId, userId) => `/guilds/${guildId}/users/${userId}`,
424
- getAll: (guildId) => `/guilds/${guildId}/users`,
425
- get: (guildId, userId) => `/guilds/${guildId}/users/${userId}`,
426
- delete: (guildId, userId) => `/guilds/${guildId}/users/${userId}`,
427
- deleteAll: (guildId) => `/guilds/${guildId}/users`,
428
- resource: (guildId, userId, ...resource) => `/guilds/${guildId}/users/${userId}/${resource.join("/")}`
429
- },
430
- betusers: {
431
- getAll: (guildId) => `/guilds/${guildId}/betusers`,
432
- get: (guildId, userId) => `/guilds/${guildId}/betusers/${userId}`,
433
- create: (guildId) => `/guilds/${guildId}/betusers`,
434
- update: (guildId, userId) => `/guilds/${guildId}/betusers/${userId}`,
435
- delete: (guildId, userId) => `/guilds/${guildId}/betusers/${userId}`,
436
- deleteAll: (guildId) => `/guilds/${guildId}/betusers`,
437
- resource: (guildId, userId, resourceName) => `/guilds/${guildId}/betusers/${userId}/${resourceName}`
438
- },
439
- matches: {
440
- getAll: (guildId) => `/guilds/${guildId}/matches`,
441
- get: (guildId, matchId) => `/guilds/${guildId}/matches/${matchId}`,
442
- create: (guildId) => `/guilds/${guildId}/matches`,
443
- update: (guildId, matchId) => `/guilds/${guildId}/matches/${matchId}`,
444
- delete: (guildId, matchId) => `/guilds/${guildId}/matches/${matchId}`,
445
- deleteAll: (guildId) => `/guilds/${guildId}/matches`,
446
- resource: (guildId, matchId, ...resources) => `/guilds/${guildId}/matches/${matchId}/${resources.join("/")}`
447
- },
448
- bets: {
449
- getAll: (guildId) => `/guilds/${guildId}/bets`,
450
- get: (guildId, betId) => `/guilds/${guildId}/bets/${betId}`,
451
- create: (guildId) => `/guilds/${guildId}/bets`,
452
- update: (guildId, betId) => `/guilds/${guildId}/bets/${betId}`,
453
- delete: (guildId, betId) => `/guilds/${guildId}/bets/${betId}`,
454
- deleteAll: (guildId) => `/guilds/${guildId}/bets`,
455
- resource: (guildId, betId, ...resources) => `/guilds/${guildId}/bets/${betId}/${resources.join("/")}`
456
- },
457
- tickets: {
458
- getAll: (guildId) => `/guilds/${guildId}/tickets`,
459
- get: (guildId, ticketId) => `/guilds/${guildId}/tickets/${ticketId}`,
460
- create: (guildId) => `/guilds/${guildId}/tickets`,
461
- update: (guildId, ticketId) => `/guilds/${guildId}/tickets/${ticketId}`,
462
- delete: (guildId, ticketId) => `/guilds/${guildId}/tickets/${ticketId}`,
463
- deleteAll: (guildId) => `/guilds/${guildId}/tickets`,
464
- resource: (guildId, ticketId, ...resources) => `/guilds/${guildId}/tickets/${ticketId}/${resources.join("/")}`
465
- },
466
- mediators: {
467
- getAll: (guildId) => `/guilds/${guildId}/mediators`,
468
- get: (guildId, mediatorId) => `/guilds/${guildId}/mediators/${mediatorId}`,
469
- create: (guildId) => `/guilds/${guildId}/mediators`,
470
- update: (guildId, mediatorId) => `/guilds/${guildId}/mediators/${mediatorId}`,
471
- delete: (guildId, mediatorId) => `/guilds/${guildId}/mediators/${mediatorId}`,
472
- deleteAll: (guildId) => `/guilds/${guildId}/mediators`,
473
- resource: (guildId, mediatorId, ...resources) => `/guilds/${guildId}/mediators/${mediatorId}/${resources.join("/")}`
474
- },
475
- shop: {
476
- get: (guildId) => `/guilds/${guildId}/manage/shop`,
477
- update: (guildId) => `/guilds/${guildId}/manage/shop`,
478
- delete: (guildId) => `/guilds/${guildId}/manage/shop/ `,
479
- resource: (guildId, ...resources) => `/guilds/${guildId}/manage/shop/${resources.join("/")}`,
480
- products: {
481
- getAll: (guildId) => `/guilds/${guildId}/manage/shop/products`,
482
- get: (guildId, productId) => `/guilds/${guildId}/manage/shop/${productId}/products`,
483
- create: (guildId) => `/guilds/${guildId}/manage/shop/products`,
484
- update: (guildId, productId) => `/guilds/${guildId}/manage/shop/products/${productId}`,
485
- delete: (guildId, productId) => `/guilds/${guildId}/manage/shop/products/${productId}`,
486
- deleteAll: (guildId) => `/guilds/${guildId}/products/shop`,
487
- resource: (guildId, productId, ...resources) => `/guilds/${guildId}/manage/shop/products/${productId}/${resources.join("/")}`
488
- }
489
- }
490
- },
491
- vipmembers: {
492
- get: (guildId, memberId) => `/guilds/${guildId}/vipmembers/${memberId}`,
493
- getAll: (guildId) => `/guilds/${guildId}/vipmembers`,
494
- deleteAll: (guildId) => `/guilds/${guildId}/vipmembers`,
495
- create: (guildId) => `/guilds/${guildId}/vipmembers`,
496
- update: (guildId, memberId) => `/guilds/${guildId}/vipmembers/${memberId}`,
497
- delete: (guildId, memberId) => `/guilds/${guildId}/vipmembers/${memberId}`
498
- },
499
- giveaways: {
500
- get: (giveawayId) => `/giveaways/${giveawayId}`,
501
- getAll: () => `/giveaways`,
502
- deleteAll: () => `/giveaways`,
503
- create: () => `/giveaways`,
504
- update: (giveawayId) => `/giveaways/${giveawayId}`,
505
- delete: (giveawayId) => `/giveaways/${giveawayId}`
506
- }
507
- };
508
-
509
- // src/utils/Assertion.ts
510
- var Assertion = class {
511
- constructor() {
512
- }
513
- /**
514
- * Tests if given key is a string
515
- * @param key Key to test
516
- */
517
- static assertString(key) {
518
- if (typeof key !== "string") throw new Error(`${key} must be a string`);
519
- if (!key || key === "") throw new Error(`${key} must be a string`);
520
- return true;
521
- }
522
- /**
523
- * Tests if given key is a number
524
- * @param key Key to test
525
- */
526
- static assertNumber(key) {
527
- if (typeof key !== "number") throw new Error(`${key} must be a number`);
528
- return true;
529
- }
530
- /**
531
- * Tests if given key is a boolean
532
- * @param key Key to test
533
- */
534
- static assertBoolean(key) {
535
- if (typeof key !== "boolean") throw new Error(`${key} must be a boolean`);
536
- return true;
537
- }
538
- /**
539
- * Tests if given key is an array
540
- * @param key Key to test
541
- */
542
- static assertArray(key) {
543
- if (!Array.isArray(key)) throw new Error(`${key} must be an array`);
544
- return true;
545
- }
546
- /**
547
- * Tests if given key is an object
548
- * @param key Key to test
549
- */
550
- static assertObject(key) {
551
- if (typeof key !== "object") throw new Error(`${key} must be an object`);
552
- return true;
553
- }
554
- toString() {
555
- return "string, number, boolean, array, object";
556
- }
557
- };
558
-
559
- // src/structures/Collection.ts
560
- var Collection = class _Collection extends Map {
561
- constructor(key, data) {
562
- super();
563
- __publicField(this, "key");
564
- this.key = key;
565
- if (data && Array.isArray(data) && key) {
566
- if (data.length > 0) return;
567
- for (let v of data) this.set(key, v);
568
- }
569
- }
570
- at(index) {
571
- if (index < 0 || index >= this.size) {
572
- return void 0;
573
- }
574
- let i = 0;
575
- for (let [, value] of this) {
576
- if (i === index) {
577
- return value;
578
- }
579
- i++;
580
- }
581
- }
582
- has(key) {
583
- return this.get(key) !== void 0 ? true : false;
584
- }
585
- get first() {
586
- return this.values().next().value;
587
- }
588
- get last() {
589
- return [...this.values()].at(-1);
590
- }
591
- get length() {
592
- return this.toArray().length;
593
- }
594
- find(predicate) {
595
- for (const [key, value] of this) {
596
- if (predicate(value, key, this)) return value;
597
- }
598
- return void 0;
599
- }
600
- filter(predicate) {
601
- const results = new _Collection(this.key, []);
602
- for (const [key, value] of this) {
603
- if (predicate(value, key, this)) results.set(key, value);
604
- }
605
- return results;
606
- }
607
- some(predicate) {
608
- const results = new _Collection(this.key, []);
609
- for (const [key, value] of this) {
610
- if (predicate(value, key, this)) results.set(key, value);
611
- }
612
- return results;
613
- }
614
- map(callback) {
615
- return [...this].map(([key, val]) => callback(val, key, this));
616
- }
617
- toArray() {
618
- return [...this.values()];
619
- }
620
- toJSON() {
621
- let obj = {};
622
- for (let [k, v] of this.entries()) {
623
- obj[`${k}`] = v;
624
- }
625
- return obj;
626
- }
627
- sort(compareFunction) {
628
- const sortedEntries = [...this.entries()].sort((ab, ba) => {
629
- return compareFunction(ab[1], ba[1], this);
630
- });
631
- const coll = new _Collection();
632
- for (let [k, v] of sortedEntries) coll.set(k, v);
633
- return coll;
634
- }
635
- toString() {
636
- return `${this.size}`;
637
- }
638
- };
639
-
640
- // src/managers/base.ts
641
- var BaseManager = class {
642
- constructor(guild) {
643
- /** This url of the manager */
644
- __publicField(this, "base_url");
645
- /** The rest client */
646
- __publicField(this, "rest");
647
- /** The guild of the manager */
648
- __publicField(this, "guild");
649
- /** Cache */
650
- __publicField(this, "cache");
651
- this.guild = guild;
652
- this.rest = guild.rest;
653
- this.cache = new Collection();
654
- }
655
- toJSON() {
656
- return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
657
- }
658
- };
659
-
660
- // src/managers/player/PlayerManager.ts
661
- var PlayerManager = class extends Collection {
662
- constructor(structure, base_url) {
663
- super("players");
664
- __publicField(this, "base_url");
665
- __publicField(this, "rest");
666
- __publicField(this, "guild");
667
- this.base_url = base_url;
668
- this.guild = structure.guild;
669
- this.rest = structure.rest;
670
- }
671
- _set(data) {
672
- this.clear();
673
- if (Array.isArray(data)) {
674
- for (let p of data) {
675
- if (!p.id) continue;
676
- this.set(p.id, {
677
- id: p.id,
678
- createdAt: p.createdAt ? new Date(p.createdAt) : /* @__PURE__ */ new Date(),
679
- updateAt: p.updateAt ? new Date(p.updateAt) : /* @__PURE__ */ new Date()
680
- });
681
- }
682
- } else {
683
- if (!data.id) return;
684
- this.set(data.id, {
685
- id: data.id,
686
- createdAt: data.createdAt ? new Date(data.createdAt) : /* @__PURE__ */ new Date(),
687
- updateAt: data.updateAt ? new Date(data.updateAt) : /* @__PURE__ */ new Date()
688
- });
689
- }
690
- return this;
691
- }
692
- /**
693
- * Adds a player or an array of players to the structure.
694
- * @param player A player or an array of players to be added
695
- * @returns returns a collection of players
696
- */
697
- async add(player) {
698
- let players = [];
699
- if (Array.isArray(player)) {
700
- for (let p of player) this.has(p.id) ? null : players.push(p);
701
- } else this.has(player.id) ? null : players.push(player);
702
- const payload = { set: players };
703
- const response = await this.rest.request({
704
- method: "PATCH",
705
- payload,
706
- url: this.base_url
707
- });
708
- return this._set(response.players);
709
- }
710
- /**
711
- * Remover a player or an array of players.
712
- * @param player The player or an array of players to be removed
713
- * @returns Player manager
714
- */
715
- async remove(player) {
716
- const ids = new Set(Array.isArray(player) ? player.map((p) => p.id) : [player.id]);
717
- const players = this.toArray().filter((p) => !ids.has(p.id));
718
- const payload = { set: players };
719
- const response = await this.rest.request({
720
- method: "PATCH",
721
- payload,
722
- url: this.base_url
723
- });
724
- return this._set(response.players);
725
- }
726
- };
727
-
728
- // src/rest/REST.ts
729
- var import_dotenv = __toESM(require_main());
730
- var import_undici = require("undici");
731
- import_dotenv.default.config();
732
-
733
- // src/structures/bet/GuildBet.ts
734
- var _GuildBet_instances, updateInternals_fn;
735
- var GuildBet = class {
736
- constructor(data, manager) {
737
- __privateAdd(this, _GuildBet_instances);
738
- /** The bet's type */
739
- __publicField(this, "type");
740
- /** The bet's mode */
741
- __publicField(this, "mode");
742
- /** The bet's status */
743
- __publicField(this, "status");
744
- /** The bet's maximum size */
745
- __publicField(this, "maximumSize");
746
- /** The bet's price */
747
- __publicField(this, "price");
748
- /** The bet's players */
749
- __publicField(this, "players");
750
- __publicField(this, "teams");
751
- /** The bet's channel */
752
- __publicField(this, "channels");
753
- /** The bet's messages */
754
- __publicField(this, "messages");
755
- /** The id of the winner */
756
- __publicField(this, "winners");
757
- /** The id of the loser */
758
- __publicField(this, "losers");
759
- /** The bet's creator id */
760
- __publicField(this, "creatorId");
761
- /** The bet's mediator */
762
- __publicField(this, "mediatorId");
763
- /** The bet's confirmers */
764
- __publicField(this, "confirmed");
765
- /** Creation Date */
766
- __publicField(this, "createdAt");
767
- /** Updated Date */
768
- __publicField(this, "updatedAt");
769
- /** Bet's id */
770
- __publicField(this, "_id");
771
- __publicField(this, "queues");
772
- __publicField(this, "guild_id");
773
- __publicField(this, "rest");
774
- __publicField(this, "guild");
775
- __publicField(this, "manager");
776
- this.manager = manager;
777
- this.guild = manager.guild;
778
- this.rest = manager.rest;
779
- this._id = data?._id;
780
- this.guild_id = data?.guild_id;
781
- this.type = data?.type;
782
- this.mode = data?.mode;
783
- this.status = data?.status;
784
- this.maximumSize = data?.maximumSize;
785
- this.price = data?.price;
786
- this.teams = data?.teams;
787
- this.channels = data?.channels;
788
- this.players = new PlayerManager(this, Routes.guilds.bets.resource(this.guild_id, this._id, "players"));
789
- this.messages = new MessagesManager(this, Routes.guilds.bets.resource(this.guild_id, this._id, "messages"));
790
- this.winners = data?.winners;
791
- this.losers = data?.losers;
792
- this.creatorId = data?.creatorId;
793
- this.mediatorId = data?.mediatorId;
794
- this.confirmed = data?.confirmed;
795
- this.createdAt = data?.createdAt ? new Date(data?.createdAt) : /* @__PURE__ */ new Date();
796
- this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
797
- this.queues = [];
798
- for (let queue of data.queues ?? []) {
799
- this.queues.push({
800
- _id: queue?._id,
801
- type: queue?.type,
802
- players: queue?.players,
803
- updatedAt: queue?.updatedAt ? new Date(queue?.updatedAt) : /* @__PURE__ */ new Date(),
804
- createdAt: queue?.createdAt ? new Date(queue?.createdAt) : /* @__PURE__ */ new Date()
805
- });
806
- }
807
- if (data?.messages?.length !== 0) this.messages.set(data.messages);
808
- if (data?.players.length !== 0) this.players._set(data.players);
809
- }
810
- toString() {
811
- return this._id;
812
- }
813
- async fetch() {
814
- const route = Routes.guilds.bets.get(this.guild.id, this._id);
815
- const response = await this.rest.request({ url: route, method: "GET" });
816
- return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
817
- }
818
- async addPlayer(player, queue_type) {
819
- if (this.players.length === 2) return this;
820
- if (this.players.has(player.id)) return this;
821
- this.players.set(player.id, player);
822
- if (queue_type) {
823
- const queue = this.queues.find((q) => q.type === queue_type);
824
- if (!queue) return this;
825
- for (const q of this.queues) {
826
- q.players = q.players.filter((p) => p.id !== player.id);
827
- }
828
- if (!queue.players.some((p) => p.id === player.id)) {
829
- queue.players.push({ id: player.id });
830
- }
831
- }
832
- return await this.update({
833
- players: this.players.toArray(),
834
- queues: this.queues
835
- });
836
- }
837
- async removePlayer(player) {
838
- if (!this.players.some((p) => p.id === player.id)) return this;
839
- let players = this.players.toArray();
840
- players = this.players.filter((p) => p.id !== player.id).toArray();
841
- for (const q of this.queues) {
842
- q.players = q.players.filter((p) => p.id !== player.id);
843
- }
844
- return await this.update({
845
- players,
846
- queues: this.queues
847
- });
848
- }
849
- async update(data) {
850
- const payload = data;
851
- const route = Routes.guilds.bets.update(this.guild.id, this._id);
852
- const response = await this.rest.request({ method: "patch", url: route, payload });
853
- return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
854
- }
855
- async delete() {
856
- const route = Routes.guilds.bets.delete(this.manager.guild.id, this._id);
857
- const response = await this.rest.request({
858
- method: "DELETE",
859
- url: route
860
- });
861
- this.rest.emit("betDelete", this);
862
- this.manager.cache.delete(this._id);
863
- return response;
864
- }
865
- toJSON() {
866
- let json = {};
867
- for (const [key, value] of Object.entries(this)) {
868
- const exclude = ["rest", "guild", "manager"];
869
- if (exclude.includes(key)) continue;
870
- if (typeof value !== "function") {
871
- json[key] = value;
872
- }
873
- }
874
- return {
875
- ...json,
876
- messages: this?.messages instanceof MessagesManager ? this.messages?.cache?.toArray() : [],
877
- players: this.players.toArray()
878
- };
879
- }
880
- };
881
- _GuildBet_instances = new WeakSet();
882
- updateInternals_fn = function(data) {
883
- for (let key in data) {
884
- if (key === "_id" || key === "createdAt") continue;
885
- if (key === "messages") {
886
- this.messages.set(data[key]);
887
- continue;
888
- }
889
- if (key === "players") {
890
- this.players._set(data[key]);
891
- continue;
892
- }
893
- if (key in this) {
894
- this[key] = data[key];
895
- }
896
- }
897
- if (data?.messages?.length !== 0) {
898
- if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
899
- else {
900
- this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
901
- this.messages.set(data.messages);
902
- }
903
- }
904
- this.updatedAt = /* @__PURE__ */ new Date();
905
- this.createdAt = new Date(data.createdAt);
906
- this.manager.set(this);
907
- return this;
908
- };
909
-
910
- // src/managers/message/MessagesManager.ts
911
- var MessagesManager = class {
912
- constructor(structure, base_url) {
913
- __publicField(this, "cache");
914
- __publicField(this, "base_url");
915
- __publicField(this, "rest");
916
- __publicField(this, "guild");
917
- this.rest = structure.rest;
918
- this.guild = structure.guild;
919
- this.cache = new Collection("messages");
920
- this.base_url = base_url;
921
- }
922
- async fetch() {
923
- const response = await this.rest.request({
924
- method: "GET",
925
- url: this.base_url,
926
- payload: {}
927
- });
928
- this.cache.set(response._id, response);
929
- return response;
930
- }
931
- async create(data) {
932
- const messages = [...this.cache.toArray()];
933
- if (Array.isArray(data)) messages.push(...data);
934
- else messages.push(data);
935
- const response = await this.rest.request({
936
- method: "PATCH",
937
- url: this.base_url,
938
- payload: { set: messages }
939
- });
940
- return this.set(response.messages);
941
- }
942
- set(data) {
943
- if (!data) return this.cache;
944
- if (Array.isArray(data)) {
945
- for (let message of data) {
946
- if (message && !message._id) continue;
947
- this.cache.set(message._id, message);
948
- }
949
- } else {
950
- if (data && !data._id) return this.cache;
951
- this.cache.set(data._id, data);
952
- }
953
- return this.cache;
954
- }
955
- };
956
-
957
- // src/structures/match/GuildMatch.ts
958
- var _GuildMatch_instances, updateInternals_fn2;
959
- var _GuildMatch = class _GuildMatch {
960
- /**
961
- * GuildMatch match
962
- * @param data The match's data
963
- * @param guild The guild
964
- * @param rest The rest client
965
- */
966
- constructor(data, manager) {
967
- __privateAdd(this, _GuildMatch_instances);
968
- __publicField(this, "_id");
969
- __publicField(this, "selections");
970
- /** Match's type */
971
- __publicField(this, "type");
972
- __publicField(this, "channels");
973
- __publicField(this, "guild_id");
974
- /** Match's status */
975
- __publicField(this, "status");
976
- /** Match's challenge */
977
- __publicField(this, "challenge");
978
- /** Match's players */
979
- __publicField(this, "players");
980
- __publicField(this, "teams");
981
- /** Match's winners */
982
- __publicField(this, "winners");
983
- /** Match's losers */
984
- __publicField(this, "losers");
985
- /** Match's maximum size */
986
- __publicField(this, "maximumSize");
987
- /** Match's kicked out */
988
- __publicField(this, "kickedOut");
989
- /** Match's confirmed */
990
- __publicField(this, "confirmed");
991
- /** Match's leaders */
992
- __publicField(this, "leaders");
993
- /** Match's creator id */
994
- __publicField(this, "creatorId");
995
- /** Match's room creator id */
996
- __publicField(this, "roomCreatorId");
997
- /** Creation Date */
998
- __publicField(this, "createdAt");
999
- /** Updated Date */
1000
- __publicField(this, "updatedAt");
1001
- __publicField(this, "messages");
1002
- /** Match's id */
1003
- __publicField(this, "mvps");
1004
- __publicField(this, "manager");
1005
- __publicField(this, "bet");
1006
- __publicField(this, "admin_id");
1007
- /** The given guild */
1008
- __publicField(this, "guild");
1009
- /** The rest client */
1010
- __publicField(this, "rest");
1011
- __publicField(this, "key");
1012
- this._id = data?._id;
1013
- this.guild_id = data?.guild_id;
1014
- this.manager = manager;
1015
- this.guild = manager.guild;
1016
- this.rest = manager.rest;
1017
- this.admin_id = data?.admin_id;
1018
- this.challenge = data?.challenge;
1019
- this.players = data?.players;
1020
- this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
1021
- this.channels = data?.channels;
1022
- this.type = data?.type;
1023
- this.status = data?.status;
1024
- this.bet = this.guild.bets.cache.get(data?.bet?._id);
1025
- this.mvps = data?.mvps;
1026
- this.winners = data?.winners;
1027
- this.losers = data?.losers;
1028
- this.maximumSize = data?.maximumSize;
1029
- this.kickedOut = data?.kickedOut;
1030
- this.confirmed = data?.confirmed;
1031
- this.teams = data?.teams;
1032
- this.leaders = data?.leaders;
1033
- this.creatorId = data?.creatorId;
1034
- this.roomCreatorId = data?.roomCreatorId;
1035
- this.selections = data?.selections;
1036
- this.key = "matches";
1037
- this.createdAt = data?.createdAt ? new Date(data?.createdAt) : /* @__PURE__ */ new Date();
1038
- this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
1039
- if (data?.messages?.length !== 0) this.messages.set(data.messages);
1040
- }
1041
- /**
1042
- * Fetches the match
1043
- * @returns New Instance of the match
1044
- */
1045
- async fetch() {
1046
- const route = Routes.guilds.matches.get(this.guild.id, this._id);
1047
- const response = await this.rest.request({
1048
- method: "get",
1049
- url: route
1050
- });
1051
- return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn2).call(this, response);
1052
- }
1053
- async addConfirmed(type, id) {
1054
- const confirmed = this.confirmed.find((c) => c.type === type);
1055
- const idsToAdd = Array.isArray(id) ? id : [id];
1056
- if (!confirmed) {
1057
- this.confirmed.push({ type, ids: [...idsToAdd], count: idsToAdd.length });
1058
- } else {
1059
- const chIndex = this.confirmed.findIndex((ch) => ch.type === type);
1060
- const mergedIds = [.../* @__PURE__ */ new Set([...confirmed.ids || [], ...idsToAdd])];
1061
- this.confirmed[chIndex] = { ...confirmed, ids: mergedIds, count: mergedIds.length };
1062
- }
1063
- return this.update({ confirmed: this.confirmed });
1064
- }
1065
- async setConfirmed(set) {
1066
- Assertion.assertObject(set);
1067
- const route = Routes.guilds.matches.resource(this.guild.id, this._id, "confirmed");
1068
- const response = await this.rest.request({
1069
- method: "PATCH",
1070
- url: route,
1071
- payload: set
1072
- });
1073
- return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn2).call(this, response);
1074
- }
1075
- async setStatus(status) {
1076
- Assertion.assertString(status);
1077
- const payload = { set: status.toLowerCase() };
1078
- const route = Routes.guilds.matches.resource(this.guild.id, this._id, "status");
1079
- const response = await this.rest.request({
1080
- method: "PATCH",
1081
- url: route,
1082
- payload
1083
- });
1084
- return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn2).call(this, response);
1085
- }
1086
- async setWinners(players) {
1087
- if (!Array.isArray(players)) players = [players];
1088
- const payload = { set: players };
1089
- const route = Routes.guilds.matches.resource(this.guild.id, this._id, "winners");
1090
- const response = await this.rest.request({
1091
- method: "PATCH",
1092
- url: route,
1093
- payload
1094
- });
1095
- return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn2).call(this, response);
1096
- }
1097
- async setLoser(players) {
1098
- if (!Array.isArray(players)) players = [players];
1099
- const payload = { set: players };
1100
- const route = Routes.guilds.matches.resource(this.guild.id, this._id, "losers");
1101
- const response = await this.rest.request({
1102
- method: "PATCH",
1103
- url: route,
1104
- payload
1105
- });
1106
- return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn2).call(this, response);
1107
- }
1108
- async setMvps(...usersId) {
1109
- const payload = { set: usersId };
1110
- const route = Routes.guilds.matches.resource(this.guild.id, this._id, "mvps");
1111
- const response = await this.rest.request({
1112
- method: "PATCH",
1113
- url: route,
1114
- payload
1115
- });
1116
- return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn2).call(this, response);
1117
- }
1118
- async setRoomCreatorId(userId) {
1119
- Assertion.assertString(userId);
1120
- const payload = { set: userId };
1121
- const route = Routes.guilds.matches.resource(this.guild.id, this._id, "roomCreatorId");
1122
- const response = await this.rest.request({
1123
- method: "PATCH",
1124
- url: route,
1125
- payload
1126
- });
1127
- return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn2).call(this, response);
1128
- }
1129
- async setRoomAdminId(userId) {
1130
- Assertion.assertString(userId);
1131
- const payload = { set: userId };
1132
- const route = Routes.guilds.matches.resource(this.guild.id, this._id, "admin_id");
1133
- const response = await this.rest.request({
1134
- method: "PATCH",
1135
- url: route,
1136
- payload
1137
- });
1138
- return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn2).call(this, response);
1139
- }
1140
- async kick(player) {
1141
- this.players = this.players.filter((p) => p.id !== player.id);
1142
- this.leaders = this.leaders.filter((p) => p.id !== player.id);
1143
- const teamIndex = this.teams.findIndex((t) => t.some((p) => p.id === player.id));
1144
- if (teamIndex !== -1) {
1145
- let team = this.teams.find((t) => t.some((p) => p.id === player.id));
1146
- team = team.filter((p) => p.id === player.id);
1147
- this.teams[teamIndex] = team;
1148
- }
1149
- return await this.update(this.toJSON());
1150
- }
1151
- async update(data) {
1152
- const route = Routes.guilds.matches.get(this.guild.id, this._id);
1153
- if (data?.bet && data?.bet instanceof GuildBet) {
1154
- data.bet = data.bet.toJSON();
1155
- }
1156
- const response = await this.rest.request({
1157
- method: "patch",
1158
- url: route,
1159
- payload: data
1160
- });
1161
- this.rest.emit("matchUpdate", this, new _GuildMatch(response, this.manager));
1162
- return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn2).call(this, response);
1163
- }
1164
- async delete() {
1165
- const route = Routes.guilds.matches.resource(this.guild.id, this._id);
1166
- const response = await this.rest.request({
1167
- method: "DELETE",
1168
- url: route
1169
- });
1170
- this.manager.cache.delete(this?._id);
1171
- this.rest.matches.delete(this?._id);
1172
- return response;
1173
- }
1174
- toJSON() {
1175
- let json = {};
1176
- for (const [key, value] of Object.entries(this)) {
1177
- const exclude = ["rest", "guilds", "guild", "manager"];
1178
- if (exclude.includes(key)) continue;
1179
- if (typeof value !== "function") {
1180
- json[key] = value;
1181
- }
1182
- }
1183
- return {
1184
- ...json,
1185
- messages: this?.messages instanceof MessagesManager ? this.messages?.cache?.toArray() : []
1186
- };
1187
- }
1188
- };
1189
- _GuildMatch_instances = new WeakSet();
1190
- updateInternals_fn2 = async function(data) {
1191
- if (!data) return;
1192
- for (let key in data) {
1193
- if (key === "id" || key === "createdAt" || key === "messages") continue;
1194
- if (key in this) {
1195
- this[key] = data[key];
1196
- }
1197
- if (key === "bet") {
1198
- this.bet = this.guild.bets.set(data.bet);
1199
- }
1200
- }
1201
- if (data?.messages?.length !== 0) {
1202
- if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
1203
- else {
1204
- this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
1205
- this.messages.set(data.messages);
1206
- }
1207
- }
1208
- if (!(this.bet instanceof GuildBet) && data?.bet) {
1209
- this.bet = this.guild.bets.cache.get(data._id) ?? await this.guild.bets.fetch({ betId: data?.bet?._id });
1210
- }
1211
- this.updatedAt = /* @__PURE__ */ new Date();
1212
- this.manager.set(this);
1213
- return this;
1214
- };
1215
- var GuildMatch = _GuildMatch;
1216
-
1217
- // src/managers/match/GuildMatchManager.ts
1218
- var GuildMatchManager = class extends BaseManager {
24
+ var import_Routes = require("../../rest/Routes");
25
+ var import_GuildMatch = require("../../structures/match/GuildMatch");
26
+ var import_Collection = require("../../structures/Collection");
27
+ var import_Assertion = require("../../utils/Assertion");
28
+ var import_base = require("../base");
29
+ class GuildMatchManager extends import_base.BaseManager {
1219
30
  /**
1220
31
  * Manage users with the given client
1221
32
  * @param users An array of users
@@ -1225,8 +36,8 @@ var GuildMatchManager = class extends BaseManager {
1225
36
  super(guild);
1226
37
  this.guild = guild;
1227
38
  this.rest = guild.rest;
1228
- this.base_url = Routes.guilds.matches.getAll(guild.id);
1229
- this.cache = new Collection("matches");
39
+ this.base_url = import_Routes.Routes.guilds.matches.getAll(guild.id);
40
+ this.cache = new import_Collection.Collection("matches");
1230
41
  }
1231
42
  /**
1232
43
  * Fetch a match
@@ -1236,78 +47,68 @@ var GuildMatchManager = class extends BaseManager {
1236
47
  async fetch(options) {
1237
48
  if (options && options.cache) return this.cache;
1238
49
  if (options && options.matchId) {
1239
- const route2 = Routes.guilds.matches.get(this.guild.id, options.matchId);
50
+ const url2 = import_Routes.Routes.guilds.matches.get(this.guild.id, options.matchId);
1240
51
  const response2 = await this.rest.request({
1241
52
  method: "get",
1242
- url: route2
53
+ url: url2
1243
54
  });
1244
55
  return this.set(response2);
1245
56
  }
1246
- const route = Routes.guilds.matches.getAll(this.guild.id);
57
+ const url = import_Routes.Routes.guilds.matches.getAll(this.guild.id);
1247
58
  const response = await this.rest.request({
1248
59
  method: "get",
1249
- url: route
60
+ url
1250
61
  });
1251
62
  if (!response) return this.cache;
1252
- const coll = new Collection("matches");
63
+ const coll = new import_Collection.Collection("matches");
1253
64
  for (let match of response ?? []) {
1254
- const guildMatch = new GuildMatch(match, this);
65
+ const guildMatch = new import_GuildMatch.GuildMatch(match, this);
1255
66
  coll.set(match._id, guildMatch);
1256
67
  this.rest.matches.set(match._id, guildMatch);
1257
68
  }
1258
69
  this.cache = coll;
70
+ if (this.guild.match_count !== response.length) await this.guild.update({ match_count: response.length });
1259
71
  return coll;
1260
72
  }
1261
- async fetchAll() {
1262
- const route = Routes.guilds.matches.getAll(this.guild.id);
1263
- const response = await this.rest.request({
1264
- method: "get",
1265
- url: route
1266
- });
1267
- if (Array.isArray(response) && response.length === 0) {
1268
- this.cache.clear();
1269
- return this.cache;
1270
- }
1271
- this.set(response);
1272
- return this.cache;
1273
- }
1274
73
  set(data) {
1275
74
  if (!data) return this.cache;
1276
75
  if (Array.isArray(data)) {
1277
76
  for (let _match of data) {
1278
77
  if (!_match._id) continue;
1279
- const match = new GuildMatch(_match, this);
78
+ const match = new import_GuildMatch.GuildMatch(_match, this);
1280
79
  this.cache.set(match._id, match);
1281
80
  }
1282
81
  return this.cache;
1283
82
  } else {
1284
83
  if (!data._id) return this.cache;
1285
- if (data instanceof GuildMatch) {
84
+ if (data instanceof import_GuildMatch.GuildMatch) {
1286
85
  this.cache.set(data._id, data);
1287
86
  return data;
1288
87
  }
1289
- const match = new GuildMatch(data, this);
88
+ const match = new import_GuildMatch.GuildMatch(data, this);
1290
89
  this.cache.set(match._id, match);
1291
90
  return match;
1292
91
  }
1293
92
  }
1294
93
  async create(payload) {
1295
- Assertion.assertObject(payload);
1296
- const route = Routes.guilds.matches.create(this.guild.id);
94
+ import_Assertion.Assertion.assertObject(payload);
95
+ const url = import_Routes.Routes.guilds.matches.create(this.guild.id);
1297
96
  const response = await this.rest.request({
1298
97
  method: "POST",
1299
- url: route,
98
+ url,
1300
99
  payload
1301
100
  });
101
+ if (this.guild.match_count !== this.cache.size + 1) await this.guild.update({ match_count: this.cache.size + 1 });
1302
102
  return this.set(response);
1303
103
  }
1304
104
  async delete(id) {
1305
- const route = Routes.fields(this.base_url, id);
1306
- const response = await this.rest.request({ url: route, method: "DELETE" });
105
+ const url = import_Routes.Routes.fields(this.base_url, id);
106
+ const response = await this.rest.request({ url, method: "DELETE" });
1307
107
  return this.set(response);
1308
108
  }
1309
- };
109
+ }
1310
110
  // Annotate the CommonJS export names for ESM import in node:
1311
111
  0 && (module.exports = {
1312
112
  GuildMatchManager
1313
113
  });
114
+ //# sourceMappingURL=GuildMatchManager.js.map