revbot.js 0.0.13 → 0.0.15-build-test

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 (523) hide show
  1. package/dist/chunk-35BYGFDX.js +25 -0
  2. package/dist/chunk-35BYGFDX.js.map +1 -0
  3. package/dist/chunk-3ANNOYXY.js +30 -0
  4. package/dist/chunk-3ANNOYXY.js.map +1 -0
  5. package/dist/chunk-3GLQHMWL.js +39 -0
  6. package/dist/chunk-3GLQHMWL.js.map +1 -0
  7. package/dist/chunk-43CUB3NP.js +30 -0
  8. package/dist/chunk-43CUB3NP.js.map +1 -0
  9. package/dist/chunk-55PAATU6.js +101 -0
  10. package/dist/chunk-55PAATU6.js.map +1 -0
  11. package/dist/chunk-5RK7FEID.js +47 -0
  12. package/dist/chunk-5RK7FEID.js.map +1 -0
  13. package/dist/chunk-6V6HPZ33.js +27 -0
  14. package/dist/chunk-6V6HPZ33.js.map +1 -0
  15. package/dist/chunk-6WJXGICC.js +25 -0
  16. package/dist/chunk-6WJXGICC.js.map +1 -0
  17. package/dist/chunk-7PA5MDKS.js +157 -0
  18. package/dist/chunk-7PA5MDKS.js.map +1 -0
  19. package/dist/chunk-7XUN3OQT.js +1 -0
  20. package/dist/chunk-7XUN3OQT.js.map +1 -0
  21. package/dist/chunk-AOKM5TCP.js +37 -0
  22. package/dist/chunk-AOKM5TCP.js.map +1 -0
  23. package/dist/chunk-BQS6ZLNY.js +80 -0
  24. package/dist/chunk-BQS6ZLNY.js.map +1 -0
  25. package/dist/chunk-CQ4AJZQD.js +51 -0
  26. package/dist/chunk-CQ4AJZQD.js.map +1 -0
  27. package/dist/chunk-DSM44DGO.js +156 -0
  28. package/dist/chunk-DSM44DGO.js.map +1 -0
  29. package/dist/chunk-E2P4PIDH.js +35 -0
  30. package/dist/chunk-E2P4PIDH.js.map +1 -0
  31. package/dist/chunk-EOZ7QHOH.js +151 -0
  32. package/dist/chunk-EOZ7QHOH.js.map +1 -0
  33. package/dist/chunk-FKNQEJE7.js +20 -0
  34. package/dist/chunk-FKNQEJE7.js.map +1 -0
  35. package/dist/chunk-G7DLVJKH.js +34 -0
  36. package/dist/chunk-G7DLVJKH.js.map +1 -0
  37. package/dist/chunk-GCIV7PRI.js +30 -0
  38. package/dist/chunk-GCIV7PRI.js.map +1 -0
  39. package/dist/chunk-GNQQG7EP.js +88 -0
  40. package/dist/chunk-GNQQG7EP.js.map +1 -0
  41. package/dist/chunk-H4SZEZP2.js +38 -0
  42. package/dist/chunk-H4SZEZP2.js.map +1 -0
  43. package/dist/chunk-HETUKFLM.js +7 -0
  44. package/dist/chunk-HETUKFLM.js.map +1 -0
  45. package/dist/chunk-HKLTWZSB.js +112 -0
  46. package/dist/chunk-HKLTWZSB.js.map +1 -0
  47. package/dist/chunk-ICANLKGX.js +97 -0
  48. package/dist/chunk-ICANLKGX.js.map +1 -0
  49. package/dist/chunk-J2RF7D67.js +105 -0
  50. package/dist/chunk-J2RF7D67.js.map +1 -0
  51. package/dist/chunk-K4VAG5ZU.js +16 -0
  52. package/dist/chunk-K4VAG5ZU.js.map +1 -0
  53. package/dist/chunk-LAL23AQK.js +105 -0
  54. package/dist/chunk-LAL23AQK.js.map +1 -0
  55. package/dist/chunk-LQUZ7Q7D.js +29 -0
  56. package/dist/chunk-LQUZ7Q7D.js.map +1 -0
  57. package/dist/chunk-LUDTY3LL.js +103 -0
  58. package/dist/chunk-LUDTY3LL.js.map +1 -0
  59. package/dist/chunk-LY7OFI25.js +26 -0
  60. package/dist/chunk-LY7OFI25.js.map +1 -0
  61. package/dist/chunk-MLKHJGSQ.js +68 -0
  62. package/dist/chunk-MLKHJGSQ.js.map +1 -0
  63. package/dist/chunk-MSJCRRXO.js +32 -0
  64. package/dist/chunk-MSJCRRXO.js.map +1 -0
  65. package/dist/chunk-O2IN5OZI.js +27 -0
  66. package/dist/chunk-O2IN5OZI.js.map +1 -0
  67. package/dist/chunk-OETI5C5L.js +30 -0
  68. package/dist/chunk-OETI5C5L.js.map +1 -0
  69. package/dist/chunk-OK227BBS.js +38 -0
  70. package/dist/chunk-OK227BBS.js.map +1 -0
  71. package/dist/chunk-R2PF552K.js +67 -0
  72. package/dist/chunk-R2PF552K.js.map +1 -0
  73. package/dist/chunk-RMACMP4R.js +26 -0
  74. package/dist/chunk-RMACMP4R.js.map +1 -0
  75. package/dist/chunk-SYXHGCHU.js +26 -0
  76. package/dist/chunk-SYXHGCHU.js.map +1 -0
  77. package/dist/chunk-VELIOWTX.js +25 -0
  78. package/dist/chunk-VELIOWTX.js.map +1 -0
  79. package/dist/chunk-VU3XNPDE.js +37 -0
  80. package/dist/chunk-VU3XNPDE.js.map +1 -0
  81. package/dist/chunk-W4XDXSOK.js +32 -0
  82. package/dist/chunk-W4XDXSOK.js.map +1 -0
  83. package/dist/chunk-WMWOEYVA.js +26 -0
  84. package/dist/chunk-WMWOEYVA.js.map +1 -0
  85. package/dist/chunk-X7VEORVS.js +43 -0
  86. package/dist/chunk-X7VEORVS.js.map +1 -0
  87. package/dist/chunk-XMS4UTPG.js +49 -0
  88. package/dist/chunk-XMS4UTPG.js.map +1 -0
  89. package/dist/chunk-XQEYCTYC.js +2601 -0
  90. package/dist/chunk-XQEYCTYC.js.map +1 -0
  91. package/dist/chunk-YLSAAPO4.js +79 -0
  92. package/dist/chunk-YLSAAPO4.js.map +1 -0
  93. package/dist/chunk-YXX4DJB3.js +27 -0
  94. package/dist/chunk-YXX4DJB3.js.map +1 -0
  95. package/dist/client/baseClient.cjs +799 -0
  96. package/dist/client/baseClient.cjs.map +1 -0
  97. package/dist/client/baseClient.d.cts +10 -0
  98. package/dist/client/baseClient.d.ts +10 -0
  99. package/dist/client/baseClient.js +18 -0
  100. package/dist/client/baseClient.js.map +1 -0
  101. package/dist/client/client.cjs +4286 -0
  102. package/dist/client/client.cjs.map +1 -0
  103. package/dist/client/client.d.cts +10 -0
  104. package/dist/client/client.d.ts +10 -0
  105. package/dist/client/client.js +53 -0
  106. package/dist/client/client.js.map +1 -0
  107. package/dist/client/events/bulkMessageDelete.cjs +104 -0
  108. package/dist/client/events/bulkMessageDelete.cjs.map +1 -0
  109. package/dist/client/events/bulkMessageDelete.d.cts +28 -0
  110. package/dist/client/events/bulkMessageDelete.d.ts +28 -0
  111. package/dist/client/events/bulkMessageDelete.js +11 -0
  112. package/dist/client/events/bulkMessageDelete.js.map +1 -0
  113. package/dist/client/events/channelCreate.cjs +136 -0
  114. package/dist/client/events/channelCreate.cjs.map +1 -0
  115. package/dist/client/events/channelCreate.d.cts +27 -0
  116. package/dist/client/events/channelCreate.d.ts +27 -0
  117. package/dist/client/events/channelCreate.js +11 -0
  118. package/dist/client/events/channelCreate.js.map +1 -0
  119. package/dist/client/events/channelDelete.cjs +113 -0
  120. package/dist/client/events/channelDelete.cjs.map +1 -0
  121. package/dist/client/events/channelDelete.d.cts +29 -0
  122. package/dist/client/events/channelDelete.d.ts +29 -0
  123. package/dist/client/events/channelDelete.js +11 -0
  124. package/dist/client/events/channelDelete.js.map +1 -0
  125. package/dist/client/events/channelGroupJoin.cjs +133 -0
  126. package/dist/client/events/channelGroupJoin.cjs.map +1 -0
  127. package/dist/client/events/channelGroupJoin.d.cts +30 -0
  128. package/dist/client/events/channelGroupJoin.d.ts +30 -0
  129. package/dist/client/events/channelGroupJoin.js +11 -0
  130. package/dist/client/events/channelGroupJoin.js.map +1 -0
  131. package/dist/client/events/channelGroupLeave.cjs +133 -0
  132. package/dist/client/events/channelGroupLeave.cjs.map +1 -0
  133. package/dist/client/events/channelGroupLeave.d.cts +30 -0
  134. package/dist/client/events/channelGroupLeave.d.ts +30 -0
  135. package/dist/client/events/channelGroupLeave.js +11 -0
  136. package/dist/client/events/channelGroupLeave.js.map +1 -0
  137. package/dist/client/events/channelStarttyping.cjs +110 -0
  138. package/dist/client/events/channelStarttyping.cjs.map +1 -0
  139. package/dist/client/events/channelStarttyping.d.cts +30 -0
  140. package/dist/client/events/channelStarttyping.d.ts +30 -0
  141. package/dist/client/events/channelStarttyping.js +11 -0
  142. package/dist/client/events/channelStarttyping.js.map +1 -0
  143. package/dist/client/events/channelStopTyping.cjs +110 -0
  144. package/dist/client/events/channelStopTyping.cjs.map +1 -0
  145. package/dist/client/events/channelStopTyping.d.cts +30 -0
  146. package/dist/client/events/channelStopTyping.d.ts +30 -0
  147. package/dist/client/events/channelStopTyping.js +11 -0
  148. package/dist/client/events/channelStopTyping.js.map +1 -0
  149. package/dist/client/events/channelUpdate.cjs +109 -0
  150. package/dist/client/events/channelUpdate.cjs.map +1 -0
  151. package/dist/client/events/channelUpdate.d.cts +31 -0
  152. package/dist/client/events/channelUpdate.d.ts +31 -0
  153. package/dist/client/events/channelUpdate.js +11 -0
  154. package/dist/client/events/channelUpdate.js.map +1 -0
  155. package/dist/client/events/event.cjs +124 -0
  156. package/dist/client/events/event.cjs.map +1 -0
  157. package/dist/client/events/event.d.cts +11 -0
  158. package/dist/client/events/event.d.ts +11 -0
  159. package/dist/client/events/event.js +13 -0
  160. package/dist/client/events/event.js.map +1 -0
  161. package/dist/client/events/eventManager.cjs +657 -0
  162. package/dist/client/events/eventManager.cjs.map +1 -0
  163. package/dist/client/events/eventManager.d.cts +10 -0
  164. package/dist/client/events/eventManager.d.ts +10 -0
  165. package/dist/client/events/eventManager.js +34 -0
  166. package/dist/client/events/eventManager.js.map +1 -0
  167. package/dist/client/events/index.cjs +629 -0
  168. package/dist/client/events/index.cjs.map +1 -0
  169. package/dist/client/events/index.d.cts +32 -0
  170. package/dist/client/events/index.d.ts +32 -0
  171. package/dist/client/events/index.js +96 -0
  172. package/dist/client/events/index.js.map +1 -0
  173. package/dist/client/events/message.cjs +136 -0
  174. package/dist/client/events/message.cjs.map +1 -0
  175. package/dist/client/events/message.d.cts +27 -0
  176. package/dist/client/events/message.d.ts +27 -0
  177. package/dist/client/events/message.js +11 -0
  178. package/dist/client/events/message.js.map +1 -0
  179. package/dist/client/events/messageDelete.cjs +114 -0
  180. package/dist/client/events/messageDelete.cjs.map +1 -0
  181. package/dist/client/events/messageDelete.d.cts +30 -0
  182. package/dist/client/events/messageDelete.d.ts +30 -0
  183. package/dist/client/events/messageDelete.js +11 -0
  184. package/dist/client/events/messageDelete.js.map +1 -0
  185. package/dist/client/events/messageReact.cjs +138 -0
  186. package/dist/client/events/messageReact.cjs.map +1 -0
  187. package/dist/client/events/messageReact.d.cts +40 -0
  188. package/dist/client/events/messageReact.d.ts +40 -0
  189. package/dist/client/events/messageReact.js +11 -0
  190. package/dist/client/events/messageReact.js.map +1 -0
  191. package/dist/client/events/messageUnreact.cjs +144 -0
  192. package/dist/client/events/messageUnreact.cjs.map +1 -0
  193. package/dist/client/events/messageUnreact.d.cts +28 -0
  194. package/dist/client/events/messageUnreact.d.ts +28 -0
  195. package/dist/client/events/messageUnreact.js +11 -0
  196. package/dist/client/events/messageUnreact.js.map +1 -0
  197. package/dist/client/events/messageUpdate.cjs +111 -0
  198. package/dist/client/events/messageUpdate.cjs.map +1 -0
  199. package/dist/client/events/messageUpdate.d.cts +31 -0
  200. package/dist/client/events/messageUpdate.d.ts +31 -0
  201. package/dist/client/events/messageUpdate.js +11 -0
  202. package/dist/client/events/messageUpdate.js.map +1 -0
  203. package/dist/client/events/serverCreate.cjs +131 -0
  204. package/dist/client/events/serverCreate.cjs.map +1 -0
  205. package/dist/client/events/serverCreate.d.cts +27 -0
  206. package/dist/client/events/serverCreate.d.ts +27 -0
  207. package/dist/client/events/serverCreate.js +11 -0
  208. package/dist/client/events/serverCreate.js.map +1 -0
  209. package/dist/client/events/serverDelete.cjs +110 -0
  210. package/dist/client/events/serverDelete.cjs.map +1 -0
  211. package/dist/client/events/serverDelete.d.cts +27 -0
  212. package/dist/client/events/serverDelete.d.ts +27 -0
  213. package/dist/client/events/serverDelete.js +11 -0
  214. package/dist/client/events/serverDelete.js.map +1 -0
  215. package/dist/client/events/serverMemberJoin.cjs +135 -0
  216. package/dist/client/events/serverMemberJoin.cjs.map +1 -0
  217. package/dist/client/events/serverMemberJoin.d.cts +30 -0
  218. package/dist/client/events/serverMemberJoin.d.ts +30 -0
  219. package/dist/client/events/serverMemberJoin.js +11 -0
  220. package/dist/client/events/serverMemberJoin.js.map +1 -0
  221. package/dist/client/events/serverMemberLeave.cjs +114 -0
  222. package/dist/client/events/serverMemberLeave.cjs.map +1 -0
  223. package/dist/client/events/serverMemberLeave.d.cts +30 -0
  224. package/dist/client/events/serverMemberLeave.d.ts +30 -0
  225. package/dist/client/events/serverMemberLeave.js +11 -0
  226. package/dist/client/events/serverMemberLeave.js.map +1 -0
  227. package/dist/client/events/serverMemberUpdate.cjs +135 -0
  228. package/dist/client/events/serverMemberUpdate.cjs.map +1 -0
  229. package/dist/client/events/serverMemberUpdate.d.cts +33 -0
  230. package/dist/client/events/serverMemberUpdate.d.ts +33 -0
  231. package/dist/client/events/serverMemberUpdate.js +11 -0
  232. package/dist/client/events/serverMemberUpdate.js.map +1 -0
  233. package/dist/client/events/serverRoleDelete.cjs +114 -0
  234. package/dist/client/events/serverRoleDelete.cjs.map +1 -0
  235. package/dist/client/events/serverRoleDelete.d.cts +30 -0
  236. package/dist/client/events/serverRoleDelete.d.ts +30 -0
  237. package/dist/client/events/serverRoleDelete.js +11 -0
  238. package/dist/client/events/serverRoleDelete.js.map +1 -0
  239. package/dist/client/events/serverRoleUpdate.cjs +111 -0
  240. package/dist/client/events/serverRoleUpdate.cjs.map +1 -0
  241. package/dist/client/events/serverRoleUpdate.d.cts +34 -0
  242. package/dist/client/events/serverRoleUpdate.d.ts +34 -0
  243. package/dist/client/events/serverRoleUpdate.js +11 -0
  244. package/dist/client/events/serverRoleUpdate.js.map +1 -0
  245. package/dist/client/events/serverupdate.cjs +109 -0
  246. package/dist/client/events/serverupdate.cjs.map +1 -0
  247. package/dist/client/events/serverupdate.d.cts +31 -0
  248. package/dist/client/events/serverupdate.d.ts +31 -0
  249. package/dist/client/events/serverupdate.js +11 -0
  250. package/dist/client/events/serverupdate.js.map +1 -0
  251. package/dist/client/events/userUpdate.cjs +109 -0
  252. package/dist/client/events/userUpdate.cjs.map +1 -0
  253. package/dist/client/events/userUpdate.d.cts +31 -0
  254. package/dist/client/events/userUpdate.d.ts +31 -0
  255. package/dist/client/events/userUpdate.js +11 -0
  256. package/dist/client/events/userUpdate.js.map +1 -0
  257. package/dist/client/webSocket.cjs +1018 -0
  258. package/dist/client/webSocket.cjs.map +1 -0
  259. package/dist/client/webSocket.d.cts +10 -0
  260. package/dist/client/webSocket.d.ts +10 -0
  261. package/dist/client/webSocket.js +53 -0
  262. package/dist/client/webSocket.js.map +1 -0
  263. package/dist/{index.d.mts → index-D44PqKGb.d.ts} +4 -242
  264. package/dist/index-XkxTx7UU.d.cts +2386 -0
  265. package/dist/{index.mjs → index.cjs} +112 -36
  266. package/dist/index.cjs.map +1 -0
  267. package/dist/index.d.cts +11 -0
  268. package/dist/index.d.ts +11 -2624
  269. package/dist/index.js +111 -4535
  270. package/dist/index.js.map +1 -0
  271. package/dist/managers/baseManager.cjs +63 -0
  272. package/dist/managers/baseManager.cjs.map +1 -0
  273. package/dist/managers/baseManager.d.cts +10 -0
  274. package/dist/managers/baseManager.d.ts +10 -0
  275. package/dist/managers/baseManager.js +8 -0
  276. package/dist/managers/baseManager.js.map +1 -0
  277. package/dist/managers/channelManager.cjs +1978 -0
  278. package/dist/managers/channelManager.cjs.map +1 -0
  279. package/dist/managers/channelManager.d.cts +10 -0
  280. package/dist/managers/channelManager.d.ts +10 -0
  281. package/dist/managers/channelManager.js +53 -0
  282. package/dist/managers/channelManager.js.map +1 -0
  283. package/dist/managers/index.cjs +2992 -0
  284. package/dist/managers/index.cjs.map +1 -0
  285. package/dist/managers/index.d.cts +10 -0
  286. package/dist/managers/index.d.ts +10 -0
  287. package/dist/managers/index.js +68 -0
  288. package/dist/managers/index.js.map +1 -0
  289. package/dist/managers/messageManager.cjs +1153 -0
  290. package/dist/managers/messageManager.cjs.map +1 -0
  291. package/dist/managers/messageManager.d.cts +10 -0
  292. package/dist/managers/messageManager.d.ts +10 -0
  293. package/dist/managers/messageManager.js +53 -0
  294. package/dist/managers/messageManager.js.map +1 -0
  295. package/dist/managers/roleManager.cjs +700 -0
  296. package/dist/managers/roleManager.cjs.map +1 -0
  297. package/dist/managers/roleManager.d.cts +10 -0
  298. package/dist/managers/roleManager.d.ts +10 -0
  299. package/dist/managers/roleManager.js +53 -0
  300. package/dist/managers/roleManager.js.map +1 -0
  301. package/dist/managers/serverChannelManager.cjs +1622 -0
  302. package/dist/managers/serverChannelManager.cjs.map +1 -0
  303. package/dist/managers/serverChannelManager.d.cts +10 -0
  304. package/dist/managers/serverChannelManager.d.ts +10 -0
  305. package/dist/managers/serverChannelManager.js +53 -0
  306. package/dist/managers/serverChannelManager.js.map +1 -0
  307. package/dist/managers/serverManager.cjs +2508 -0
  308. package/dist/managers/serverManager.cjs.map +1 -0
  309. package/dist/managers/serverManager.d.cts +10 -0
  310. package/dist/managers/serverManager.d.ts +10 -0
  311. package/dist/managers/serverManager.js +53 -0
  312. package/dist/managers/serverManager.js.map +1 -0
  313. package/dist/managers/serverMemberManager.cjs +1037 -0
  314. package/dist/managers/serverMemberManager.cjs.map +1 -0
  315. package/dist/managers/serverMemberManager.d.cts +10 -0
  316. package/dist/managers/serverMemberManager.d.ts +10 -0
  317. package/dist/managers/serverMemberManager.js +53 -0
  318. package/dist/managers/serverMemberManager.js.map +1 -0
  319. package/dist/managers/userManager.cjs +1103 -0
  320. package/dist/managers/userManager.cjs.map +1 -0
  321. package/dist/managers/userManager.d.cts +10 -0
  322. package/dist/managers/userManager.d.ts +10 -0
  323. package/dist/managers/userManager.js +53 -0
  324. package/dist/managers/userManager.js.map +1 -0
  325. package/dist/rest/CDNClient.cjs +608 -0
  326. package/dist/rest/CDNClient.cjs.map +1 -0
  327. package/dist/rest/CDNClient.d.cts +10 -0
  328. package/dist/rest/CDNClient.d.ts +10 -0
  329. package/dist/rest/CDNClient.js +16 -0
  330. package/dist/rest/CDNClient.js.map +1 -0
  331. package/dist/rest/restClient.cjs +652 -0
  332. package/dist/rest/restClient.cjs.map +1 -0
  333. package/dist/rest/restClient.d.cts +10 -0
  334. package/dist/rest/restClient.d.ts +10 -0
  335. package/dist/rest/restClient.js +16 -0
  336. package/dist/rest/restClient.js.map +1 -0
  337. package/dist/rest/restUtils/rateLimitQueue.cjs +138 -0
  338. package/dist/rest/restUtils/rateLimitQueue.cjs.map +1 -0
  339. package/dist/rest/restUtils/rateLimitQueue.d.cts +13 -0
  340. package/dist/rest/restUtils/rateLimitQueue.d.ts +13 -0
  341. package/dist/rest/restUtils/rateLimitQueue.js +8 -0
  342. package/dist/rest/restUtils/rateLimitQueue.js.map +1 -0
  343. package/dist/struct/attachment.cjs +263 -0
  344. package/dist/struct/attachment.cjs.map +1 -0
  345. package/dist/struct/attachment.d.cts +10 -0
  346. package/dist/struct/attachment.d.ts +10 -0
  347. package/dist/struct/attachment.js +10 -0
  348. package/dist/struct/attachment.js.map +1 -0
  349. package/dist/struct/base.cjs +234 -0
  350. package/dist/struct/base.cjs.map +1 -0
  351. package/dist/struct/base.d.cts +10 -0
  352. package/dist/struct/base.d.ts +10 -0
  353. package/dist/struct/base.js +9 -0
  354. package/dist/struct/base.js.map +1 -0
  355. package/dist/struct/category.cjs +532 -0
  356. package/dist/struct/category.cjs.map +1 -0
  357. package/dist/struct/category.d.cts +10 -0
  358. package/dist/struct/category.d.ts +10 -0
  359. package/dist/struct/category.js +53 -0
  360. package/dist/struct/category.js.map +1 -0
  361. package/dist/struct/channel.cjs +539 -0
  362. package/dist/struct/channel.cjs.map +1 -0
  363. package/dist/struct/channel.d.cts +10 -0
  364. package/dist/struct/channel.d.ts +10 -0
  365. package/dist/struct/channel.js +15 -0
  366. package/dist/struct/channel.js.map +1 -0
  367. package/dist/struct/clientUser.cjs +741 -0
  368. package/dist/struct/clientUser.cjs.map +1 -0
  369. package/dist/struct/clientUser.d.cts +10 -0
  370. package/dist/struct/clientUser.d.ts +10 -0
  371. package/dist/struct/clientUser.js +53 -0
  372. package/dist/struct/clientUser.js.map +1 -0
  373. package/dist/struct/dmChannel.cjs +1320 -0
  374. package/dist/struct/dmChannel.cjs.map +1 -0
  375. package/dist/struct/dmChannel.d.cts +10 -0
  376. package/dist/struct/dmChannel.d.ts +10 -0
  377. package/dist/struct/dmChannel.js +53 -0
  378. package/dist/struct/dmChannel.js.map +1 -0
  379. package/dist/struct/emoji.cjs +273 -0
  380. package/dist/struct/emoji.cjs.map +1 -0
  381. package/dist/struct/emoji.d.cts +10 -0
  382. package/dist/struct/emoji.d.ts +10 -0
  383. package/dist/struct/emoji.js +10 -0
  384. package/dist/struct/emoji.js.map +1 -0
  385. package/dist/struct/groupChannel.cjs +1519 -0
  386. package/dist/struct/groupChannel.cjs.map +1 -0
  387. package/dist/struct/groupChannel.d.cts +10 -0
  388. package/dist/struct/groupChannel.d.ts +10 -0
  389. package/dist/struct/groupChannel.js +53 -0
  390. package/dist/struct/groupChannel.js.map +1 -0
  391. package/dist/struct/index.cjs +2970 -0
  392. package/dist/struct/index.cjs.map +1 -0
  393. package/dist/struct/index.d.cts +10 -0
  394. package/dist/struct/index.d.ts +10 -0
  395. package/dist/struct/index.js +101 -0
  396. package/dist/struct/index.js.map +1 -0
  397. package/dist/struct/interfaces/baseChannel.cjs +19 -0
  398. package/dist/struct/interfaces/baseChannel.cjs.map +1 -0
  399. package/dist/struct/interfaces/baseChannel.d.cts +10 -0
  400. package/dist/struct/interfaces/baseChannel.d.ts +10 -0
  401. package/dist/struct/interfaces/baseChannel.js +1 -0
  402. package/dist/struct/interfaces/baseChannel.js.map +1 -0
  403. package/dist/struct/invite.cjs +293 -0
  404. package/dist/struct/invite.cjs.map +1 -0
  405. package/dist/struct/invite.d.cts +10 -0
  406. package/dist/struct/invite.d.ts +10 -0
  407. package/dist/struct/invite.js +10 -0
  408. package/dist/struct/invite.js.map +1 -0
  409. package/dist/struct/mentions.cjs +104 -0
  410. package/dist/struct/mentions.cjs.map +1 -0
  411. package/dist/struct/mentions.d.cts +10 -0
  412. package/dist/struct/mentions.d.ts +10 -0
  413. package/dist/struct/mentions.js +8 -0
  414. package/dist/struct/mentions.js.map +1 -0
  415. package/dist/struct/message.cjs +817 -0
  416. package/dist/struct/message.cjs.map +1 -0
  417. package/dist/struct/message.d.cts +10 -0
  418. package/dist/struct/message.d.ts +10 -0
  419. package/dist/struct/message.js +53 -0
  420. package/dist/struct/message.js.map +1 -0
  421. package/dist/struct/messageEmbed.cjs +205 -0
  422. package/dist/struct/messageEmbed.cjs.map +1 -0
  423. package/dist/struct/messageEmbed.d.cts +10 -0
  424. package/dist/struct/messageEmbed.d.ts +10 -0
  425. package/dist/struct/messageEmbed.js +8 -0
  426. package/dist/struct/messageEmbed.js.map +1 -0
  427. package/dist/struct/notesChannel.cjs +1327 -0
  428. package/dist/struct/notesChannel.cjs.map +1 -0
  429. package/dist/struct/notesChannel.d.cts +10 -0
  430. package/dist/struct/notesChannel.d.ts +10 -0
  431. package/dist/struct/notesChannel.js +53 -0
  432. package/dist/struct/notesChannel.js.map +1 -0
  433. package/dist/struct/presence.cjs +254 -0
  434. package/dist/struct/presence.cjs.map +1 -0
  435. package/dist/struct/presence.d.cts +10 -0
  436. package/dist/struct/presence.d.ts +10 -0
  437. package/dist/struct/presence.js +12 -0
  438. package/dist/struct/presence.js.map +1 -0
  439. package/dist/struct/role.cjs +572 -0
  440. package/dist/struct/role.cjs.map +1 -0
  441. package/dist/struct/role.d.cts +10 -0
  442. package/dist/struct/role.d.ts +10 -0
  443. package/dist/struct/role.js +53 -0
  444. package/dist/struct/role.js.map +1 -0
  445. package/dist/struct/server.cjs +2454 -0
  446. package/dist/struct/server.cjs.map +1 -0
  447. package/dist/struct/server.d.cts +10 -0
  448. package/dist/struct/server.d.ts +10 -0
  449. package/dist/struct/server.js +53 -0
  450. package/dist/struct/server.js.map +1 -0
  451. package/dist/struct/serverChannel.cjs +776 -0
  452. package/dist/struct/serverChannel.cjs.map +1 -0
  453. package/dist/struct/serverChannel.d.cts +10 -0
  454. package/dist/struct/serverChannel.d.ts +10 -0
  455. package/dist/struct/serverChannel.js +53 -0
  456. package/dist/struct/serverChannel.js.map +1 -0
  457. package/dist/struct/serverMember.cjs +711 -0
  458. package/dist/struct/serverMember.cjs.map +1 -0
  459. package/dist/struct/serverMember.d.cts +10 -0
  460. package/dist/struct/serverMember.d.ts +10 -0
  461. package/dist/struct/serverMember.js +53 -0
  462. package/dist/struct/serverMember.js.map +1 -0
  463. package/dist/struct/textChannel.cjs +1502 -0
  464. package/dist/struct/textChannel.cjs.map +1 -0
  465. package/dist/struct/textChannel.d.cts +10 -0
  466. package/dist/struct/textChannel.d.ts +10 -0
  467. package/dist/struct/textChannel.js +53 -0
  468. package/dist/struct/textChannel.js.map +1 -0
  469. package/dist/struct/user.cjs +690 -0
  470. package/dist/struct/user.cjs.map +1 -0
  471. package/dist/struct/user.d.cts +10 -0
  472. package/dist/struct/user.d.ts +10 -0
  473. package/dist/struct/user.js +53 -0
  474. package/dist/struct/user.js.map +1 -0
  475. package/dist/struct/voiceChannels.cjs +820 -0
  476. package/dist/struct/voiceChannels.cjs.map +1 -0
  477. package/dist/struct/voiceChannels.d.cts +10 -0
  478. package/dist/struct/voiceChannels.d.ts +10 -0
  479. package/dist/struct/voiceChannels.js +53 -0
  480. package/dist/struct/voiceChannels.js.map +1 -0
  481. package/dist/utils/UUID.cjs +75 -0
  482. package/dist/utils/UUID.cjs.map +1 -0
  483. package/dist/utils/UUID.d.cts +14 -0
  484. package/dist/utils/UUID.d.ts +14 -0
  485. package/dist/utils/UUID.js +8 -0
  486. package/dist/utils/UUID.js.map +1 -0
  487. package/dist/utils/badges.cjs +181 -0
  488. package/dist/utils/badges.cjs.map +1 -0
  489. package/dist/utils/badges.d.cts +25 -0
  490. package/dist/utils/badges.d.ts +25 -0
  491. package/dist/utils/badges.js +9 -0
  492. package/dist/utils/badges.js.map +1 -0
  493. package/dist/utils/bitField.cjs +161 -0
  494. package/dist/utils/bitField.cjs.map +1 -0
  495. package/dist/utils/bitField.d.cts +51 -0
  496. package/dist/utils/bitField.d.ts +51 -0
  497. package/dist/utils/bitField.js +8 -0
  498. package/dist/utils/bitField.js.map +1 -0
  499. package/dist/utils/constants.cjs +179 -0
  500. package/dist/utils/constants.cjs.map +1 -0
  501. package/dist/utils/constants.d.cts +10 -0
  502. package/dist/utils/constants.d.ts +10 -0
  503. package/dist/utils/constants.js +23 -0
  504. package/dist/utils/constants.js.map +1 -0
  505. package/dist/utils/index.cjs +489 -0
  506. package/dist/utils/index.cjs.map +1 -0
  507. package/dist/utils/index.d.cts +11 -0
  508. package/dist/utils/index.d.ts +11 -0
  509. package/dist/utils/index.js +47 -0
  510. package/dist/utils/index.js.map +1 -0
  511. package/dist/utils/permissions.cjs +314 -0
  512. package/dist/utils/permissions.cjs.map +1 -0
  513. package/dist/utils/permissions.d.cts +110 -0
  514. package/dist/utils/permissions.d.ts +110 -0
  515. package/dist/utils/permissions.js +17 -0
  516. package/dist/utils/permissions.js.map +1 -0
  517. package/dist/utils/types.cjs +19 -0
  518. package/dist/utils/types.cjs.map +1 -0
  519. package/dist/utils/types.d.cts +60 -0
  520. package/dist/utils/types.d.ts +60 -0
  521. package/dist/utils/types.js +1 -0
  522. package/dist/utils/types.js.map +1 -0
  523. package/package.json +16 -5
@@ -0,0 +1,2992 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
13
+ var __typeError = (msg) => {
14
+ throw TypeError(msg);
15
+ };
16
+ var __pow = Math.pow;
17
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
+ var __spreadValues = (a, b) => {
19
+ for (var prop in b || (b = {}))
20
+ if (__hasOwnProp.call(b, prop))
21
+ __defNormalProp(a, prop, b[prop]);
22
+ if (__getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(b)) {
24
+ if (__propIsEnum.call(b, prop))
25
+ __defNormalProp(a, prop, b[prop]);
26
+ }
27
+ return a;
28
+ };
29
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
30
+ var __export = (target, all) => {
31
+ for (var name in all)
32
+ __defProp(target, name, { get: all[name], enumerable: true });
33
+ };
34
+ var __copyProps = (to, from, except, desc) => {
35
+ if (from && typeof from === "object" || typeof from === "function") {
36
+ for (let key of __getOwnPropNames(from))
37
+ if (!__hasOwnProp.call(to, key) && key !== except)
38
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
39
+ }
40
+ return to;
41
+ };
42
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
43
+ // If the importer is in node compatibility mode or this is not an ESM
44
+ // file that has been converted to a CommonJS file using a Babel-
45
+ // compatible transform (i.e. "__esModule" has not been set), then set
46
+ // "default" to the CommonJS "module.exports" for node compatibility.
47
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
48
+ mod
49
+ ));
50
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
51
+ var __async = (__this, __arguments, generator) => {
52
+ return new Promise((resolve, reject) => {
53
+ var fulfilled = (value) => {
54
+ try {
55
+ step(generator.next(value));
56
+ } catch (e) {
57
+ reject(e);
58
+ }
59
+ };
60
+ var rejected = (value) => {
61
+ try {
62
+ step(generator.throw(value));
63
+ } catch (e) {
64
+ reject(e);
65
+ }
66
+ };
67
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
68
+ step((generator = generator.apply(__this, __arguments)).next());
69
+ });
70
+ };
71
+ var __await = function(promise, isYieldStar) {
72
+ this[0] = promise;
73
+ this[1] = isYieldStar;
74
+ };
75
+ var __yieldStar = (value) => {
76
+ var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
77
+ if (obj == null) {
78
+ obj = value[__knownSymbol("iterator")]();
79
+ method = (k) => it[k] = (x) => obj[k](x);
80
+ } else {
81
+ obj = obj.call(value);
82
+ method = (k) => it[k] = (v) => {
83
+ if (isAwait) {
84
+ isAwait = false;
85
+ if (k === "throw") throw v;
86
+ return v;
87
+ }
88
+ isAwait = true;
89
+ return {
90
+ done: false,
91
+ value: new __await(new Promise((resolve) => {
92
+ var x = obj[k](v);
93
+ if (!(x instanceof Object)) __typeError("Object expected");
94
+ resolve(x);
95
+ }), 1)
96
+ };
97
+ };
98
+ }
99
+ return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
100
+ throw x;
101
+ }, "return" in obj && method("return"), it;
102
+ };
103
+
104
+ // src/managers/index.ts
105
+ var managers_exports = {};
106
+ __export(managers_exports, {
107
+ BaseManager: () => BaseManager,
108
+ ChannelManager: () => ChannelManager,
109
+ MessageManager: () => MessageManager,
110
+ RoleManager: () => RoleManager,
111
+ ServerChannelManager: () => ServerChannelManager,
112
+ ServerManager: () => ServerManager,
113
+ ServerMemberManager: () => ServerMemberManager,
114
+ UserManager: () => UserManager
115
+ });
116
+ module.exports = __toCommonJS(managers_exports);
117
+
118
+ // src/managers/baseManager.ts
119
+ var BaseManager = class {
120
+ constructor(client3) {
121
+ this.client = client3;
122
+ this.cache = /* @__PURE__ */ new Map();
123
+ }
124
+ _add(raw) {
125
+ if (!this.holds) throw new Error("Holds is not defined");
126
+ const obj = new this.holds(this.client, raw);
127
+ this.cache.set(obj.id, obj);
128
+ return obj;
129
+ }
130
+ _remove(id) {
131
+ this.cache.delete(id);
132
+ }
133
+ resolve(resolvable) {
134
+ var _a;
135
+ const id = this.resolveId(resolvable);
136
+ if (id) return (_a = this.cache.get(id)) != null ? _a : null;
137
+ return null;
138
+ }
139
+ resolveId(resolvable) {
140
+ var _a;
141
+ if (resolvable == null) return null;
142
+ if (typeof resolvable === "string") return resolvable;
143
+ if (this.holds && resolvable instanceof this.holds) return resolvable.id;
144
+ const raw = resolvable;
145
+ if (typeof raw === "object" && "_id" in raw) (_a = raw._id) != null ? _a : null;
146
+ return null;
147
+ }
148
+ valueOf() {
149
+ return this.cache;
150
+ }
151
+ };
152
+
153
+ // src/utils/bitField.ts
154
+ var DEFAULT_BIT = 0;
155
+ var _BitField = class _BitField {
156
+ constructor(bits = DEFAULT_BIT) {
157
+ this.bitfield = DEFAULT_BIT;
158
+ this.bitfield = this.self.resolve(bits);
159
+ }
160
+ /**
161
+ * Resolves a bitfield or an array of bitfields into a single number.
162
+ * @param bit The bitfield or array of bitfields to resolve.
163
+ * @returns The resolved bitfield as a number.
164
+ */
165
+ static resolve(bit) {
166
+ if (bit instanceof _BitField) return bit.bitfield;
167
+ if (typeof bit === "number" && bit >= DEFAULT_BIT) return bit;
168
+ if (Array.isArray(bit)) {
169
+ return bit.map((p) => this.resolve(p)).reduce((prev, p) => prev | p, DEFAULT_BIT);
170
+ }
171
+ if (typeof this.FLAGS[bit] !== "undefined") return this.FLAGS[bit];
172
+ throw new Error("BITFIELD_INVALID");
173
+ }
174
+ /**
175
+ * Returns the class that this instance belongs to.
176
+ * @returns The class of the bitfield.
177
+ */
178
+ get self() {
179
+ return this.constructor;
180
+ }
181
+ /**
182
+ * Checks if any of the bits in the bitfield are set.
183
+ * @param bit The bitfield or array of bitfields to check.
184
+ * @returns True if any bits are set, false otherwise.
185
+ */
186
+ any(bit) {
187
+ bit = this.self.resolve(bit);
188
+ return (this.bitfield & bit) !== DEFAULT_BIT;
189
+ }
190
+ /**
191
+ * checks if a specific permission is set.
192
+ */
193
+ has(bit) {
194
+ bit = this.self.resolve(bit);
195
+ return (this.bitfield & bit) === bit;
196
+ }
197
+ /**
198
+ * Returns an array of all the Permissions that are set in the bitfield.
199
+ * @returns An array of flag names.
200
+ */
201
+ toArray() {
202
+ return Object.keys(this.self.FLAGS).filter((bit) => this.has(bit));
203
+ }
204
+ add(...bits) {
205
+ let total = 0;
206
+ for (const bit of bits) {
207
+ total |= this.self.resolve(bit);
208
+ }
209
+ if (Object.isFrozen(this)) {
210
+ return new this.self(this.bitfield | total);
211
+ }
212
+ this.bitfield |= total;
213
+ return this;
214
+ }
215
+ remove(...bits) {
216
+ let total = 0;
217
+ for (const bit of bits) {
218
+ total |= this.self.resolve(bit);
219
+ }
220
+ if (Object.isFrozen(this)) {
221
+ return new this.self(this.bitfield & ~total);
222
+ }
223
+ this.bitfield &= ~total;
224
+ return this;
225
+ }
226
+ freeze() {
227
+ return Object.freeze(this);
228
+ }
229
+ valueOf() {
230
+ return this.bitfield;
231
+ }
232
+ /**
233
+ *
234
+ * @returns A record of all flags and their boolean values indicating whether they are set.
235
+ */
236
+ serialize() {
237
+ const serialized = {};
238
+ for (const [flag, bit] of Object.entries(this.self.FLAGS)) {
239
+ serialized[flag] = this.has(bit);
240
+ }
241
+ return serialized;
242
+ }
243
+ *[Symbol.iterator]() {
244
+ yield* __yieldStar(this.toArray());
245
+ }
246
+ };
247
+ _BitField.FLAGS = {};
248
+ var BitField = _BitField;
249
+
250
+ // src/struct/base.ts
251
+ var Base = class _Base {
252
+ /**
253
+ * Creates a new Base instance.
254
+ *
255
+ * @param {client} client - The client instance.
256
+ */
257
+ constructor(client3) {
258
+ this.client = client3;
259
+ }
260
+ /**
261
+ * Compares this object with another to determine if they are equal.
262
+ *
263
+ * @param {this | null} [obj] - The object to compare with.
264
+ * @returns {boolean} `true` if the objects are equal, otherwise `false`.
265
+ */
266
+ equals(obj) {
267
+ if (!obj) return false;
268
+ for (const key in obj) {
269
+ const a = obj[key], b = this[key];
270
+ if (a instanceof _Base && !a.equals(b)) return false;
271
+ if (a instanceof BitField && a.bitfield !== b.bitfield)
272
+ return false;
273
+ if (typeof a === "object" && a !== null) continue;
274
+ if (a !== b) return false;
275
+ }
276
+ return true;
277
+ }
278
+ /**
279
+ * Updates the object with new data and returns a clone of the object.
280
+ *
281
+ * @param {PartialObject} data - The data to update the object with.
282
+ * @param {string[]} [clear] - Fields to clear in the object.
283
+ * @returns {this} A clone of the updated object.
284
+ */
285
+ _update(data, clear) {
286
+ const clone = this._clone();
287
+ this._patch(data, clear);
288
+ return clone;
289
+ }
290
+ /**
291
+ * Patches the object with new data.
292
+ *
293
+ * @param {PartialObject} data - The data to patch the object with.
294
+ * @param {string[]} [_clear] - Fields to clear in the object.
295
+ * @returns {this} The updated object.
296
+ * @protected
297
+ */
298
+ _patch(data, _clear) {
299
+ if ("id" in data) this.id = data.id;
300
+ if ("_id" in data) {
301
+ if (typeof data._id === "string") this.id = data._id;
302
+ if (typeof data._id === "object") this.id = data._id.user;
303
+ }
304
+ return this;
305
+ }
306
+ /**
307
+ * Creates a deep clone of the object.
308
+ *
309
+ * @returns {this} A clone of the object.
310
+ */
311
+ _clone() {
312
+ const clone = Object.assign(Object.create(this), this);
313
+ for (const key in clone) {
314
+ const prop = clone[key];
315
+ if (prop instanceof _Base) clone[key] = prop._clone();
316
+ }
317
+ return clone;
318
+ }
319
+ };
320
+
321
+ // src/utils/UUID.ts
322
+ var import_crypto = require("crypto");
323
+ var _UUID = class _UUID extends null {
324
+ static get PROG() {
325
+ return (0, import_crypto.randomBytes)(1).readUInt8() / 255;
326
+ }
327
+ static time(now = Date.now()) {
328
+ let mod, result = "";
329
+ for (let i = this.TIME_LENGTH; i > 0; i--) {
330
+ mod = now % this.ENCODING_LENGTH;
331
+ result = this.ENCODING.charAt(mod) + result;
332
+ now = (now - mod) / this.ENCODING_LENGTH;
333
+ }
334
+ return result;
335
+ }
336
+ static hash() {
337
+ let result = "";
338
+ for (let i = this.RANDOM_LENGTH; i > 0; i--) {
339
+ let random = Math.floor(this.PROG * this.ENCODING_LENGTH);
340
+ if (random === this.ENCODING_LENGTH) {
341
+ random = this.ENCODING_LENGTH - 1;
342
+ }
343
+ result = this.ENCODING.charAt(random) + result;
344
+ }
345
+ return result;
346
+ }
347
+ static generate(timestamp = Date.now()) {
348
+ return this.time(timestamp) + this.hash();
349
+ }
350
+ static timestampOf(id) {
351
+ const timestamp = id.slice(0, this.TIME_LENGTH).split("").reverse().reduce((carry, char, index) => {
352
+ const encodingIndex = this.ENCODING.indexOf(char);
353
+ if (encodingIndex === -1) {
354
+ throw new Error("invalid character found: " + char);
355
+ }
356
+ return carry += encodingIndex * Math.pow(this.ENCODING_LENGTH, index);
357
+ }, 0);
358
+ return new Date(timestamp);
359
+ }
360
+ };
361
+ _UUID.ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
362
+ _UUID.ENCODING_LENGTH = _UUID.ENCODING.length;
363
+ _UUID.RANDOM_LENGTH = 16;
364
+ _UUID.TIME_LENGTH = 10;
365
+ _UUID.TIME_MAX = Math.pow(2, 48) - 1;
366
+ var UUID = _UUID;
367
+
368
+ // src/utils/constants.ts
369
+ var cdnUrl = "https://cdn.revoltusercontent.com";
370
+ var SYSTEM_USER_ID = "0".repeat(UUID.TIME_LENGTH + UUID.RANDOM_LENGTH);
371
+
372
+ // src/utils/permissions.ts
373
+ var ChannelPermissions = class extends BitField {
374
+ constructor(bits) {
375
+ super(bits);
376
+ }
377
+ static resolve(bit) {
378
+ return super.resolve(bit);
379
+ }
380
+ };
381
+ ChannelPermissions.FLAGS = {
382
+ VIEW_CHANNEL: __pow(1, 0),
383
+ SEND_MESSAGE: __pow(1, 22),
384
+ MANAGE_MESSAGE: __pow(1, 2),
385
+ MANAGE_CHANNEL: __pow(1, 3),
386
+ VOICE_CALL: __pow(1, 4),
387
+ INVITE_OTHERS: __pow(1, 5),
388
+ EMBED_LINKS: __pow(1, 6),
389
+ UPLOAD_FILES: __pow(1, 7)
390
+ };
391
+ var UserPermissions = class extends BitField {
392
+ constructor(bits) {
393
+ super(bits);
394
+ }
395
+ static resolve(bit) {
396
+ return super.resolve(bit);
397
+ }
398
+ };
399
+ UserPermissions.FLAGS = {
400
+ ACCESS: __pow(1, 0),
401
+ VIEW_PROFILE: __pow(1, 1),
402
+ SEND_MESSAGES: __pow(1, 2),
403
+ INVITE: __pow(1, 3)
404
+ };
405
+ var ServerPermissions = class extends BitField {
406
+ constructor(bits) {
407
+ super(bits);
408
+ }
409
+ static resolve(bit) {
410
+ return super.resolve(bit);
411
+ }
412
+ };
413
+ ServerPermissions.FLAGS = {
414
+ VIEW_SERVER: __pow(1, 0),
415
+ MANAGE_ROLES: __pow(1, 1),
416
+ MANAGE_CHANNELS: __pow(1, 2),
417
+ MANAGE_SERVER: __pow(1, 3),
418
+ KICK_MEMBERS: __pow(1, 4),
419
+ BAN_MEMBERS: __pow(1, 5),
420
+ CHANGE_NICKNAME: __pow(1, 12),
421
+ MANAGE_NICKNAMES: __pow(1, 13),
422
+ CHANGE_AVATAR: __pow(1, 14),
423
+ REMOVE_AVATARS: __pow(1, 15)
424
+ };
425
+ var FullPermissions = class extends BitField {
426
+ constructor(bits) {
427
+ super(bits);
428
+ }
429
+ static resolve(bit) {
430
+ return super.resolve(bit);
431
+ }
432
+ };
433
+ FullPermissions.FLAGS = {
434
+ // * Generic permissions
435
+ /// Manage the channel or channels on the server
436
+ ManageChannel: __pow(2, 0),
437
+ /// Manage the server
438
+ ManageServer: __pow(2, 1),
439
+ /// Manage permissions on servers or channels
440
+ ManagePermissions: __pow(2, 2),
441
+ /// Manage roles on server
442
+ ManageRole: __pow(2, 3),
443
+ /// Manage server customisation (includes emoji)
444
+ ManageCustomisation: __pow(2, 4),
445
+ // * Member permissions
446
+ /// Kick other members below their ranking
447
+ KickMembers: __pow(2, 6),
448
+ /// Ban other members below their ranking
449
+ BanMembers: __pow(2, 7),
450
+ /// Timeout other members below their ranking
451
+ TimeoutMembers: __pow(2, 8),
452
+ /// Assign roles to members below their ranking
453
+ AssignRoles: __pow(2, 9),
454
+ /// Change own nickname
455
+ ChangeNickname: __pow(2, 10),
456
+ /// Change or remove other's nicknames below their ranking
457
+ ManageNicknames: __pow(2, 11),
458
+ /// Change own avatar
459
+ ChangeAvatar: __pow(2, 12),
460
+ /// Remove other's avatars below their ranking
461
+ RemoveAvatars: __pow(2, 13),
462
+ // * Channel permissions
463
+ /// View a channel
464
+ ViewChannel: __pow(2, 20),
465
+ /// Read a channel's past message history
466
+ ReadMessageHistory: __pow(2, 21),
467
+ /// Send a message in a channel
468
+ SendMessage: __pow(2, 22),
469
+ /// Delete messages in a channel
470
+ ManageMessages: __pow(2, 23),
471
+ /// Manage webhook entries on a channel
472
+ ManageWebhooks: __pow(2, 24),
473
+ /// Create invites to this channel
474
+ InviteOthers: __pow(2, 25),
475
+ /// Send embedded content in this channel
476
+ SendEmbeds: __pow(2, 26),
477
+ /// Send attachments and media in this channel
478
+ UploadFiles: __pow(2, 27),
479
+ /// Masquerade messages using custom nickname and avatar
480
+ Masquerade: __pow(2, 28),
481
+ /// React to messages with emoji
482
+ React: __pow(2, 29),
483
+ // * Voice permissions
484
+ /// Connect to a voice channel
485
+ Connect: __pow(2, 30),
486
+ /// Speak in a voice call
487
+ Speak: __pow(2, 31),
488
+ /// Share video in a voice call
489
+ Video: __pow(2, 32),
490
+ /// Mute other members with lower ranking in a voice call
491
+ MuteMembers: __pow(2, 33),
492
+ /// Deafen other members with lower ranking in a voice call
493
+ DeafenMembers: __pow(2, 34),
494
+ /// Move members between voice channels
495
+ MoveMembers: __pow(2, 35),
496
+ // * Mention permissions
497
+ /// Mention @everyone or @online
498
+ MentionEveryone: __pow(2, 37),
499
+ /// Mention a role
500
+ MentionRoles: __pow(2, 38),
501
+ // * Grant all permissions
502
+ /// Safely grant all permissions
503
+ GrantAll: 4503599627370495
504
+ };
505
+ var DEFAULT_PERMISSION_DM = new ChannelPermissions([
506
+ "VIEW_CHANNEL",
507
+ "VIEW_CHANNEL",
508
+ "MANAGE_CHANNEL",
509
+ "VOICE_CALL",
510
+ "EMBED_LINKS",
511
+ "UPLOAD_FILES"
512
+ ]).freeze();
513
+
514
+ // src/utils/badges.ts
515
+ var Badges = class extends BitField {
516
+ constructor(bits) {
517
+ super(bits);
518
+ }
519
+ static resolve(bit) {
520
+ return super.resolve(bit);
521
+ }
522
+ };
523
+ Badges.FLAGS = {
524
+ DEVELOPER: 1 << 0,
525
+ TRANSLATOR: 1 << 1,
526
+ SUPPORTER: 1 << 2,
527
+ RESPONSIBLE_DISCLOSURE: 1 << 3,
528
+ REVOLT_TEAM: 1 << 4,
529
+ EARLY_ADOPTER: 1 << 8
530
+ };
531
+
532
+ // src/struct/user.ts
533
+ var User = class extends Base {
534
+ /**
535
+ * Creates a new User instance.
536
+ *
537
+ * @param {client} client - The client instance.
538
+ * @param {APIUser} data - The raw data for the user from the API.
539
+ */
540
+ constructor(client3, data) {
541
+ super(client3);
542
+ /** The avatar of the user, or `null` if none is set. */
543
+ this.avatar = null;
544
+ /** The presence status of the user. */
545
+ this.presence = new Presence(this.client);
546
+ /** Whether the user is a bot. */
547
+ this.bot = false;
548
+ this._patch(data);
549
+ }
550
+ /**
551
+ * Updates the user instance with new data from the API.
552
+ *
553
+ * @param {APIUser} data - The raw data for the user from the API.
554
+ * @param {FieldsUser[]} [clear=[]] - Fields to clear in the user.
555
+ * @returns {this} The updated user instance.
556
+ * @protected
557
+ */
558
+ _patch(data, clear = []) {
559
+ var _a, _b;
560
+ super._patch(data);
561
+ if (data.username) {
562
+ this.username = data.username;
563
+ }
564
+ if (data.bot) {
565
+ this.bot = true;
566
+ }
567
+ if (typeof data.badges === "number") {
568
+ this.badges = new Badges(data.badges).freeze();
569
+ }
570
+ if (data.avatar) {
571
+ this.avatar = new Attachment(this.client, data.avatar);
572
+ }
573
+ if (data.status) {
574
+ this.presence.status = data.status.presence ? (_a = Status[data.status.presence]) != null ? _a : "OFFLINE" /* Invisible */ : "OFFLINE" /* Invisible */;
575
+ this.presence.text = (_b = data.status.text) != null ? _b : null;
576
+ }
577
+ for (const field of clear) {
578
+ if (field === "Avatar") this.avatar = null;
579
+ if (field === "StatusText") this.presence.text = null;
580
+ if (field === "StatusPresence") this.presence.status = "OFFLINE" /* Invisible */;
581
+ }
582
+ return this;
583
+ }
584
+ /**
585
+ * Gets the creation date of the user.
586
+ *
587
+ * @returns {Date} The date when the user was created.
588
+ */
589
+ get createdAt() {
590
+ return UUID.timestampOf(this.id);
591
+ }
592
+ /**
593
+ * Gets the creation timestamp of the user in milliseconds.
594
+ *
595
+ * @returns {number} The timestamp of when the user was created.
596
+ */
597
+ get createdTimestamp() {
598
+ return this.createdAt.getTime();
599
+ }
600
+ /**
601
+ * Blocks the user.
602
+ *
603
+ * @returns {Promise<void>} A promise that resolves when the user is blocked.
604
+ *
605
+ * @example
606
+ * ```typescript
607
+ * await user.block();
608
+ * ```
609
+ */
610
+ block() {
611
+ return __async(this, null, function* () {
612
+ yield this.client.api.put(`/users/${this.id}/block`);
613
+ });
614
+ }
615
+ /**
616
+ * Unblocks the user.
617
+ *
618
+ * @returns {Promise<void>} A promise that resolves when the user is unblocked.
619
+ *
620
+ * @example
621
+ * ```typescript
622
+ * await user.unblock();
623
+ * ```
624
+ */
625
+ unblock() {
626
+ return __async(this, null, function* () {
627
+ yield this.client.api.delete(`/users/${this.id}/block`);
628
+ });
629
+ }
630
+ /**
631
+ * Creates a direct message (DM) channel with the user.
632
+ *
633
+ * @returns {Promise<DMChannel>} A promise that resolves with the created DM channel.
634
+ *
635
+ * @example
636
+ * ```typescript
637
+ * const dmChannel = await user.createDM();
638
+ * ```
639
+ */
640
+ createDM() {
641
+ return __async(this, null, function* () {
642
+ const data = yield this.client.api.get(`/users/${this.id}/dm`);
643
+ return this.client.channels._add(data);
644
+ });
645
+ }
646
+ avatarURL() {
647
+ var _a, _b;
648
+ if (!((_a = this.avatar) == null ? void 0 : _a.id)) return void 0;
649
+ return `${cdnUrl}/avatars/${(_b = this.avatar) == null ? void 0 : _b.id}`;
650
+ }
651
+ displayAvatarURL() {
652
+ return __async(this, null, function* () {
653
+ var _a;
654
+ const defaultAvatar = `${cdnUrl}/users/${this.id}/default_avatar`;
655
+ return (_a = this.avatarURL()) != null ? _a : defaultAvatar;
656
+ });
657
+ }
658
+ /**
659
+ * Fetches the latest data for the user from the API.
660
+ *
661
+ * @param {boolean} [force=false] - Whether to force a fetch even if the user is cached.
662
+ * @returns {Promise<User>} A promise that resolves with the updated user instance.
663
+ */
664
+ fetch(force = false) {
665
+ return this.client.users.fetch(this, { force });
666
+ }
667
+ /**
668
+ * Converts the user to a string representation.
669
+ *
670
+ * @returns {string} A string representation of the user in the format `<@userId>`.
671
+ */
672
+ toString() {
673
+ return `<@${this.id}>`;
674
+ }
675
+ };
676
+
677
+ // src/struct/message.ts
678
+ var Message = class extends Base {
679
+ /**
680
+ * Creates a new Message instance.
681
+ *
682
+ * @param {client} client - The client instance.
683
+ * @param {APIMessage} data - The raw data for the message from the API.
684
+ */
685
+ constructor(client3, data) {
686
+ super(client3);
687
+ /** The type of the message (e.g., TEXT, SYSTEM). */
688
+ this.type = "TEXT";
689
+ /** The content of the message. */
690
+ this.content = "";
691
+ /** The ID of the channel where the message was sent. */
692
+ this.channelId = "";
693
+ /** The ID of the user who authored the message. */
694
+ this.authorId = "";
695
+ /** An array of embeds included in the message. */
696
+ this.embeds = [];
697
+ /** An array of file attachments included in the message. */
698
+ this.attachments = [];
699
+ /** Mentions included in the message. */
700
+ this.mentions = new Mentions(this, []);
701
+ /** The timestamp of when the message was last edited, or `null` if not edited. */
702
+ this.editedTimestamp = null;
703
+ /** the reactions and count on a message */
704
+ this.reactions = /* @__PURE__ */ new Map();
705
+ this._patch(data);
706
+ }
707
+ /**
708
+ * Updates the message instance with new data from the API.
709
+ *
710
+ * @param {APIMessage} data - The raw data for the message from the API.
711
+ * @returns {this} The updated message instance.
712
+ * @protected
713
+ */
714
+ _patch(data) {
715
+ super._patch(data);
716
+ if (Array.isArray(data.embeds)) {
717
+ this.embeds = data.embeds;
718
+ }
719
+ if (Array.isArray(data.attachments)) {
720
+ this.attachments = data.attachments;
721
+ }
722
+ if (Array.isArray(data.mentions)) {
723
+ this.mentions = new Mentions(this, data.mentions);
724
+ }
725
+ if (data.author) {
726
+ this.authorId = data.author;
727
+ }
728
+ if (data.channel) {
729
+ this.channelId = data.channel;
730
+ }
731
+ if (typeof data.content === "string") {
732
+ this.content = data.content;
733
+ }
734
+ if (data.system) {
735
+ this.type = data.system.type.toUpperCase();
736
+ }
737
+ if (data.edited) {
738
+ this.editedTimestamp = Date.parse(data.edited);
739
+ }
740
+ return this;
741
+ }
742
+ /**
743
+ * Gets the creation date of the message.
744
+ *
745
+ * @returns {Date} The date when the message was created.
746
+ */
747
+ get createdAt() {
748
+ return UUID.timestampOf(this.id);
749
+ }
750
+ /**
751
+ * Gets the creation timestamp of the message in milliseconds.
752
+ *
753
+ * @returns {number} The timestamp of when the message was created.
754
+ */
755
+ get createdTimestamp() {
756
+ return this.createdAt.getTime();
757
+ }
758
+ /**
759
+ * Gets the date when the message was last edited.
760
+ *
761
+ * @returns {Date | null} The date of the last edit, or `null` if not edited.
762
+ */
763
+ get editedAt() {
764
+ return this.editedTimestamp ? new Date(this.editedTimestamp) : null;
765
+ }
766
+ /**
767
+ * Checks if the message is a system message.
768
+ *
769
+ * @returns {boolean} `true` if the message is a system message, otherwise `false`.
770
+ */
771
+ get system() {
772
+ return this.type !== "TEXT";
773
+ }
774
+ /**
775
+ * Retrieves the author of the message.
776
+ *
777
+ * @returns {User | null} The user who authored the message, or `null` if not found.
778
+ */
779
+ get author() {
780
+ var _a;
781
+ return (_a = this.client.users.cache.get(this.authorId)) != null ? _a : null;
782
+ }
783
+ /**
784
+ * Retrieves the channel where the message was sent.
785
+ *
786
+ * @returns {TextChannel | DMChannel | GroupChannel} The channel instance.
787
+ */
788
+ get channel() {
789
+ return this.client.channels.cache.get(this.channelId);
790
+ }
791
+ /**
792
+ * Retrieves the server ID associated with the message, if any.
793
+ *
794
+ * @returns {string | null} The server ID, or `null` if the message is not in a server.
795
+ */
796
+ get serverId() {
797
+ const channel = this.channel;
798
+ return channel.inServer() ? channel.serverId : null;
799
+ }
800
+ /**
801
+ * Retrieves the server associated with the message, if any.
802
+ *
803
+ * @returns {Server | null} The server instance, or `null` if not found.
804
+ */
805
+ get server() {
806
+ var _a;
807
+ return (_a = this.client.servers.cache.get(this.serverId)) != null ? _a : null;
808
+ }
809
+ /**
810
+ * Retrieves the server member who authored the message, if any.
811
+ *
812
+ * @returns {ServerMember | null} The server member instance, or `null` if not found.
813
+ */
814
+ get member() {
815
+ var _a, _b;
816
+ return (_b = (_a = this.server) == null ? void 0 : _a.members.cache.get(this.authorId)) != null ? _b : null;
817
+ }
818
+ /**
819
+ * Gets the URL of the message.
820
+ *
821
+ * @returns {string} The URL of the message.
822
+ */
823
+ get url() {
824
+ return `https://app.revolt.chat/${this.serverId ? `server/${this.serverId}` : ""}/channel/${this.channelId}/${this.id}`;
825
+ }
826
+ /**
827
+ * Acknowledges the message.
828
+ *
829
+ * @returns {Promise<void>} A promise that resolves when the message is acknowledged.
830
+ */
831
+ ack() {
832
+ return this.channel.messages.ack(this);
833
+ }
834
+ /**
835
+ * Deletes the message.
836
+ *
837
+ * @returns {Promise<void>} A promise that resolves when the message is deleted.
838
+ */
839
+ delete() {
840
+ return this.channel.messages.delete(this);
841
+ }
842
+ /**
843
+ * Replies to the message.
844
+ *
845
+ * @param {string} content - The content of the reply.
846
+ * @param {boolean} [mention=true] - Whether to mention the original message author.
847
+ * @returns {Promise<Message>} A promise that resolves with the sent reply message.
848
+ */
849
+ reply(content, mention = true) {
850
+ return this.channel.messages.send(__spreadProps(__spreadValues({}, typeof content === "object" ? content : { content }), {
851
+ replies: [{ id: this.id, mention }]
852
+ }));
853
+ }
854
+ /**
855
+ * Edits the message.
856
+ *
857
+ * @param {MessageEditOptions | string} options - The new content or edit options.
858
+ * @returns {Promise<void>} A promise that resolves when the message is edited.
859
+ */
860
+ edit(options) {
861
+ return this.channel.messages.edit(this, options);
862
+ }
863
+ /**
864
+ * Fetches the latest data for the message.
865
+ *
866
+ * @returns {Promise<Message>} A promise that resolves with the updated message instance.
867
+ */
868
+ fetch() {
869
+ return this.channel.messages.fetch(this.id);
870
+ }
871
+ /**
872
+ * Adds a reaction to the message.
873
+ *
874
+ * @param {string} emoji - The emoji to react with.
875
+ * @returns {Promise<void>} A promise that resolves when the reaction is added.
876
+ */
877
+ addReaction(emoji) {
878
+ return this.channel.messages.addReaction(this, emoji);
879
+ }
880
+ /**
881
+ * Removes a reaction from the message.
882
+ *
883
+ * @param {string} emoji - The emoji to remove the reaction for.
884
+ * @param {object} [options] - Options for removing the reaction.
885
+ * @param {string} [options.user_id] - The user ID to remove the reaction for. If not provided, removes the reaction for the current user.
886
+ * @param {boolean} [options.remove_all=false] - Whether to remove all of the specified reaction for the message.
887
+ * @returns {Promise<void>} A promise that resolves when the reaction is removed.
888
+ */
889
+ removeReaction(emoji, options) {
890
+ var _a, _b;
891
+ return this.channel.messages.removeReaction(
892
+ this,
893
+ emoji,
894
+ (_a = options == null ? void 0 : options.user_id) != null ? _a : void 0,
895
+ (_b = options == null ? void 0 : options.remove_all) != null ? _b : false
896
+ );
897
+ }
898
+ /**
899
+ * Removes all reactions from the message.
900
+ *
901
+ * @returns {Promise<void>} A promise that resolves when all reactions are removed.
902
+ */
903
+ removeAllReactions() {
904
+ return this.channel.messages.removeAllReactions(this);
905
+ }
906
+ /**
907
+ * Checks if the message is in a server.
908
+ *
909
+ * @returns {boolean} `true` if the message is in a server, otherwise `false`.
910
+ */
911
+ inServer() {
912
+ return this.channel.inServer();
913
+ }
914
+ /**
915
+ * Converts the message to a string representation.
916
+ *
917
+ * @returns {string} The content of the message.
918
+ */
919
+ toString() {
920
+ return this.content;
921
+ }
922
+ };
923
+
924
+ // src/struct/attachment.ts
925
+ var Attachment = class extends Base {
926
+ /**
927
+ * Creates a new Attachment instance.
928
+ *
929
+ * @param {client} client - The client instance.
930
+ * @param {File} data - The raw data for the attachment from the API.
931
+ */
932
+ constructor(client3, data) {
933
+ super(client3);
934
+ this._patch(data);
935
+ }
936
+ /**
937
+ * Updates the attachment instance with new data from the API.
938
+ *
939
+ * @param {File} data - The raw data for the attachment from the API.
940
+ * @returns {this} The updated attachment instance.
941
+ * @protected
942
+ */
943
+ _patch(data) {
944
+ super._patch(data);
945
+ if (data.filename) this.filename = data.filename;
946
+ if (data.content_type) this.type = data.content_type;
947
+ if (typeof data.size === "number") this.size = data.size;
948
+ if (data.metadata) this.metadata = data.metadata;
949
+ return this;
950
+ }
951
+ };
952
+
953
+ // src/struct/presence.ts
954
+ var Status = /* @__PURE__ */ ((Status3) => {
955
+ Status3["Online"] = "ONLINE";
956
+ Status3["Idle"] = "IDLE";
957
+ Status3["Busy"] = "DND";
958
+ Status3["Invisible"] = "OFFLINE";
959
+ return Status3;
960
+ })(Status || {});
961
+ var Presence = class extends Base {
962
+ constructor() {
963
+ super(...arguments);
964
+ /** The custom status text of the user, or `null` if none is set. */
965
+ this.text = null;
966
+ /** The current status of the user (e.g., Online, Idle, Busy, Invisible). */
967
+ this.status = "OFFLINE" /* Invisible */;
968
+ }
969
+ };
970
+
971
+ // src/struct/server.ts
972
+ var Server2 = class extends Base {
973
+ /**
974
+ * Creates a new Server instance.
975
+ *
976
+ * @param {client} client - The client instance.
977
+ * @param {APIServer} data - The raw data for the server from the API.
978
+ */
979
+ constructor(client3, data) {
980
+ super(client3);
981
+ /** The description of the server, or `null` if none is set. */
982
+ this.description = null;
983
+ /** Manages the members of the server. */
984
+ this.members = new ServerMemberManager(this);
985
+ /** Manages the channels of the server. */
986
+ this.channels = new ServerChannelManager(this);
987
+ /** Manages the roles of the server. */
988
+ this.roles = new RoleManager(this);
989
+ /** The icon of the server, or `null` if none is set. */
990
+ this.icon = null;
991
+ /** The banner of the server, or `null` if none is set. */
992
+ this.banner = null;
993
+ /** Whether analytics are enabled for the server. */
994
+ this.analytics = false;
995
+ /** Whether the server is discoverable. */
996
+ this.discoverable = false;
997
+ /** Whether the server is marked as NSFW (Not Safe For Work). */
998
+ this.nsfw = false;
999
+ /** The categories in the server. */
1000
+ this.categories = /* @__PURE__ */ new Map();
1001
+ /** the emojies associated with the server */
1002
+ this.emojis = /* @__PURE__ */ new Map();
1003
+ this._patch(data);
1004
+ }
1005
+ /**
1006
+ * Updates the server instance with new data from the API.
1007
+ *
1008
+ * @param {APIServer} data - The raw data for the server from the API.
1009
+ * @param {FieldsServer[]} [clear=[]] - Fields to clear in the server.
1010
+ * @returns {this} The updated server instance.
1011
+ * @protected
1012
+ */
1013
+ _patch(data, clear = []) {
1014
+ var _a;
1015
+ super._patch(data);
1016
+ if (Array.isArray(data.categories)) {
1017
+ this.categories.clear();
1018
+ for (const cat of data.categories) {
1019
+ const category = new Category(this, cat);
1020
+ this.categories.set(category.id, category);
1021
+ }
1022
+ }
1023
+ if (data.icon) {
1024
+ this.icon = new Attachment(this.client, data.icon);
1025
+ }
1026
+ if (data.banner) {
1027
+ this.banner = new Attachment(this.client, data.banner);
1028
+ }
1029
+ if (data.owner) {
1030
+ this.ownerId = data.owner;
1031
+ }
1032
+ if (data.name) {
1033
+ this.name = data.name;
1034
+ }
1035
+ if ("description" in data) {
1036
+ this.description = (_a = data.description) != null ? _a : null;
1037
+ }
1038
+ if (Array.isArray(data.channels)) {
1039
+ for (const id of data.channels) {
1040
+ const channel = this.client.channels.cache.get(id);
1041
+ if (channel == null ? void 0 : channel.inServer()) this.channels.cache.set(channel.id, channel);
1042
+ }
1043
+ }
1044
+ if (typeof data.roles === "object") {
1045
+ for (const [id, raw] of Object.entries(data.roles)) {
1046
+ this.roles._add(Object.assign(raw, { id }));
1047
+ }
1048
+ }
1049
+ if (typeof data.default_permissions === "number") {
1050
+ this.permissions = new FullPermissions(data.default_permissions).freeze();
1051
+ }
1052
+ if (typeof data.analytics === "boolean") this.analytics = data.analytics;
1053
+ if (typeof data.discoverable === "boolean") {
1054
+ this.discoverable = data.discoverable;
1055
+ }
1056
+ if (typeof data.nsfw === "boolean") this.nsfw = data.nsfw;
1057
+ for (const field of clear) {
1058
+ if (field === "Icon") this.icon = null;
1059
+ if (field === "Description") this.description = null;
1060
+ if (field === "Banner") this.banner = null;
1061
+ }
1062
+ return this;
1063
+ }
1064
+ /**
1065
+ * Retrieves the current user's member instance in the server.
1066
+ *
1067
+ * @returns {ServerMember | null} The current user's member instance, or `null` if not found.
1068
+ */
1069
+ get me() {
1070
+ var _a, _b;
1071
+ return (_b = this.members.cache.get((_a = this.client.user) == null ? void 0 : _a.id)) != null ? _b : null;
1072
+ }
1073
+ /**
1074
+ * Gets the creation date of the server.
1075
+ *
1076
+ * @returns {Date} The date when the server was created.
1077
+ */
1078
+ get createdAt() {
1079
+ return UUID.timestampOf(this.id);
1080
+ }
1081
+ /**
1082
+ * Gets the creation timestamp of the server in milliseconds.
1083
+ *
1084
+ * @returns {number} The timestamp of when the server was created.
1085
+ */
1086
+ get createdTimestamp() {
1087
+ return this.createdAt.getTime();
1088
+ }
1089
+ /**
1090
+ * Retrieves the owner of the server.
1091
+ *
1092
+ * @returns {User | null} The owner of the server, or `null` if not found.
1093
+ */
1094
+ get owner() {
1095
+ var _a;
1096
+ return (_a = this.client.users.cache.get(this.ownerId)) != null ? _a : null;
1097
+ }
1098
+ // iconURL(options?: { size: number }): string | null {
1099
+ // return this.icon
1100
+ // ? this.client.api.cdn.icon(this.icon.id, options?.size)
1101
+ // : null;
1102
+ // }
1103
+ // bannerURL(options?: { size: number }): string | null {
1104
+ // return this.banner
1105
+ // ? this.client.api.cdn.banner(this.banner.id, options?.size)
1106
+ // : null;
1107
+ // }
1108
+ /**
1109
+ * Converts the server to a string representation.
1110
+ *
1111
+ * @returns {string} The name of the server.
1112
+ */
1113
+ toString() {
1114
+ return this.name;
1115
+ }
1116
+ };
1117
+
1118
+ // src/struct/role.ts
1119
+ var Role = class extends Base {
1120
+ /**
1121
+ * Creates a new Role instance.
1122
+ *
1123
+ * @param {Server} server - The server this role belongs to.
1124
+ * @param {APIRole & { id: string }} data - The raw data for the role from the API.
1125
+ */
1126
+ constructor(server, data) {
1127
+ super(server.client);
1128
+ this.server = server;
1129
+ /** The color of the role, or `null` if no color is set. */
1130
+ this.color = null;
1131
+ /** Whether the role is displayed separately in the member list. */
1132
+ this.hoist = false;
1133
+ this._patch(data);
1134
+ }
1135
+ /**
1136
+ * Updates the role instance with new data from the API.
1137
+ *
1138
+ * @param {APIRole & { _id?: string }} data - The raw data for the role from the API.
1139
+ * @param {FieldsRole[]} [clear=[]] - Fields to clear in the role.
1140
+ * @returns {this} The updated role instance.
1141
+ * @protected
1142
+ */
1143
+ _patch(data, clear = []) {
1144
+ var _a;
1145
+ super._patch(data);
1146
+ if (data.name) this.name = data.name;
1147
+ if (typeof data.hoist === "boolean") this.hoist = data.hoist;
1148
+ if (typeof data.rank === "number") this.rank = data.rank;
1149
+ if ("colour" in data) this.color = (_a = data.colour) != null ? _a : null;
1150
+ if (data.permissions) {
1151
+ const { a, d } = data.permissions;
1152
+ this.overwrite = {
1153
+ allow: new FullPermissions(a),
1154
+ deny: new FullPermissions(d)
1155
+ };
1156
+ }
1157
+ for (const field of clear) {
1158
+ if (field === "Colour") this.color = null;
1159
+ }
1160
+ return this;
1161
+ }
1162
+ /**
1163
+ * Gets the date when the role was created.
1164
+ *
1165
+ * @returns {Date} The creation date of the role.
1166
+ */
1167
+ get createdAt() {
1168
+ return UUID.timestampOf(this.id);
1169
+ }
1170
+ /**
1171
+ * Gets the timestamp of when the role was created.
1172
+ *
1173
+ * @returns {number} The creation timestamp of the role in milliseconds.
1174
+ */
1175
+ get createdTimestamp() {
1176
+ return this.createdAt.getTime();
1177
+ }
1178
+ /**
1179
+ * Gets the permissions overwrite for the role.
1180
+ *
1181
+ * @returns {Overwrite} The permissions overwrite for the role.
1182
+ */
1183
+ get permissions() {
1184
+ return this.overwrite;
1185
+ }
1186
+ /**
1187
+ * Deletes the role from the server.
1188
+ *
1189
+ * @returns {Promise<void>} A promise that resolves when the role is deleted.
1190
+ *
1191
+ * @example
1192
+ * ```typescript
1193
+ * await role.delete();
1194
+ * console.log("Role deleted successfully.");
1195
+ * ```
1196
+ */
1197
+ delete() {
1198
+ return this.server.roles.delete(this);
1199
+ }
1200
+ edit(data) {
1201
+ return this.server.roles.edit(this, data);
1202
+ }
1203
+ /**
1204
+ * Converts the role to a string representation.
1205
+ *
1206
+ * @returns {string} A string representation of the role in the format `<@&roleId>`.
1207
+ */
1208
+ toString() {
1209
+ return `<@&${this.id}>`;
1210
+ }
1211
+ };
1212
+
1213
+ // src/struct/channel.ts
1214
+ var Channel = class extends Base {
1215
+ constructor() {
1216
+ super(...arguments);
1217
+ this.type = "UNKNOWN";
1218
+ }
1219
+ /**
1220
+ * Gets the timestamp (in milliseconds) when the channel was created.
1221
+ *
1222
+ * @returns {number} The timestamp of the channel's creation.
1223
+ */
1224
+ get createdTimestamp() {
1225
+ return this.createdAt.getTime();
1226
+ }
1227
+ /**
1228
+ * Gets the date and time when the channel was created.
1229
+ *
1230
+ * @returns {Date} The creation date of the channel.
1231
+ */
1232
+ get createdAt() {
1233
+ return UUID.timestampOf(this.id);
1234
+ }
1235
+ /**
1236
+ * Deletes the current channel instance from the client's channel collection.
1237
+ *
1238
+ * This method interacts with the client's channel management system to remove
1239
+ * the channel. Once deleted, the channel will no longer be accessible through
1240
+ * the client.
1241
+ *
1242
+ * @returns {Promise<void>} A promise that resolves when the channel has been successfully deleted.
1243
+ *
1244
+ * @example
1245
+ * ```typescript
1246
+ * const channel = client.channels.get('1234567890');
1247
+ * if (channel) {
1248
+ * await channel.delete();
1249
+ * console.log('Channel deleted successfully.');
1250
+ * }
1251
+ * ```
1252
+ */
1253
+ delete() {
1254
+ return this.client.channels.delete(this);
1255
+ }
1256
+ /**
1257
+ * Checks if the channel is a text-based channel.
1258
+ *
1259
+ * @returns {boolean} True if the channel is a text-based channel, otherwise false.
1260
+ */
1261
+ isText() {
1262
+ return "messages" in this;
1263
+ }
1264
+ /**
1265
+ * Checks if the channel is a voice channel.
1266
+ *
1267
+ * @returns {boolean} True if the channel is a voice channel, otherwise false.
1268
+ */
1269
+ isVoice() {
1270
+ return this.type === "VOICE" /* VOICE */;
1271
+ }
1272
+ /**
1273
+ * Checks if the channel is a group channel.
1274
+ *
1275
+ * @returns {boolean} True if the channel is a group channel, otherwise false.
1276
+ */
1277
+ isGroup() {
1278
+ return this.type === "GROUP" /* GROUP */;
1279
+ }
1280
+ /**
1281
+ * Checks if the channel is part of a server.
1282
+ *
1283
+ * @returns {boolean} True if the channel is a server channel, otherwise false.
1284
+ */
1285
+ inServer() {
1286
+ return "serverId" in this;
1287
+ }
1288
+ /**
1289
+ * Converts the channel to a string representation.
1290
+ *
1291
+ * @returns {string} A string representation of the channel in the format `<#channelId>`.
1292
+ */
1293
+ toString() {
1294
+ return `<#${this.id}>`;
1295
+ }
1296
+ /**
1297
+ * Fetches the latest data for the channel from the client's channel collection.
1298
+ *
1299
+ * @param {boolean} [force=true] - Whether to force a fetch even if the channel is cached.
1300
+ * @returns {Promise<Channel>} A promise that resolves with the updated channel instance.
1301
+ */
1302
+ fetch(force = true) {
1303
+ return this.client.channels.fetch(this, { force });
1304
+ }
1305
+ };
1306
+
1307
+ // src/managers/userManager.ts
1308
+ var UserManager = class extends BaseManager {
1309
+ constructor() {
1310
+ super(...arguments);
1311
+ this.holds = User;
1312
+ }
1313
+ /**
1314
+ *
1315
+ * @param user The user to fetch
1316
+ * @returns A promise that resolves when the user is fetched
1317
+ */
1318
+ fetch(_0) {
1319
+ return __async(this, arguments, function* (user, { force = false } = {}) {
1320
+ const id = this.resolveId(user);
1321
+ if (!id) throw new TypeError("INVALID_TYPE");
1322
+ if (!force) {
1323
+ const user2 = this.cache.get(id);
1324
+ if (user2) return user2;
1325
+ }
1326
+ const data = yield this.client.api.get(`/users/${id}`);
1327
+ return this._add(data);
1328
+ });
1329
+ }
1330
+ resolve(resolvable) {
1331
+ if (resolvable instanceof Message) return resolvable.author;
1332
+ return super.resolve(resolvable);
1333
+ }
1334
+ /**
1335
+ * get a user id form cache
1336
+ * @param resolvable The user to resolve
1337
+ * @returns The user id or null if it cannot be resolved
1338
+ */
1339
+ resolveId(resolvable) {
1340
+ if (resolvable instanceof Message) return resolvable.authorId;
1341
+ return super.resolveId(resolvable);
1342
+ }
1343
+ };
1344
+
1345
+ // src/client/baseClient.ts
1346
+ var import_node_events = require("events");
1347
+
1348
+ // src/rest/restClient.ts
1349
+ var import_axios2 = require("axios");
1350
+
1351
+ // src/rest/restUtils/rateLimitQueue.ts
1352
+ var import_axios = __toESM(require("axios"), 1);
1353
+
1354
+ // src/rest/CDNClient.ts
1355
+ var import_axios3 = require("axios");
1356
+
1357
+ // src/struct/dmChannel.ts
1358
+ var DMChannel3 = class extends Channel {
1359
+ /**
1360
+ * Creates a new DMChannel instance.
1361
+ *
1362
+ * @param {client} client - The client instance.
1363
+ * @param {APIDirectChannel} data - The raw data for the DM channel from the API.
1364
+ */
1365
+ constructor(client3, data) {
1366
+ super(client3);
1367
+ /** The type of the channel, which is always `DM` for direct message channels. */
1368
+ this.type = "DM" /* DM */;
1369
+ /** The default permissions for the DM channel. */
1370
+ this.permissions = DEFAULT_PERMISSION_DM;
1371
+ /** Manages the messages in this DM channel. */
1372
+ this.messages = new MessageManager(this);
1373
+ /** The ID of the last message sent in this DM channel, if any. */
1374
+ this.lastMessageId = null;
1375
+ this._patch(data);
1376
+ }
1377
+ /**
1378
+ * Updates the DM channel instance with new data from the API.
1379
+ *
1380
+ * @param {APIDirectChannel} data - The raw data for the DM channel from the API.
1381
+ * @returns {this} The updated DM channel instance.
1382
+ * @protected
1383
+ */
1384
+ _patch(data) {
1385
+ super._patch(data);
1386
+ if (typeof data.active === "boolean") this.active = data.active;
1387
+ if (data.last_message_id) this.lastMessageId = data.last_message_id;
1388
+ return this;
1389
+ }
1390
+ /**
1391
+ * Retrieves the last message sent in this DM channel.
1392
+ *
1393
+ * @returns {Message | null} The last message, or `null` if no message exists.
1394
+ */
1395
+ get lastMessage() {
1396
+ var _a;
1397
+ if (!this.lastMessageId) return null;
1398
+ return (_a = this.messages.cache.get(this.lastMessageId)) != null ? _a : null;
1399
+ }
1400
+ /**
1401
+ * Deletes multiple messages from this DM channel.
1402
+ *
1403
+ * @param {MessageResolvable[] | Map<string, Message> | number} messages - The messages to delete. This can be an array of message resolvables, a map of messages, or a number indicating how many recent messages to delete.
1404
+ * @returns {Promise<void>} A promise that resolves when the messages have been successfully deleted.
1405
+ *
1406
+ * @example
1407
+ * ```typescript
1408
+ * await dmChannel.bulkDelete(10); // Deletes the last 10 messages.
1409
+ * ```
1410
+ */
1411
+ bulkDelete(messages) {
1412
+ return this.messages.bulkDelete(messages);
1413
+ }
1414
+ /**
1415
+ * Sends a message to this DM channel.
1416
+ *
1417
+ * @param {MessageOptions | string} options - The message content or options for the message.
1418
+ * @returns {Promise<Message>} A promise that resolves with the sent message.
1419
+ *
1420
+ * @example
1421
+ * ```typescript
1422
+ * await dmChannel.send("Hello, world!");
1423
+ * ```
1424
+ */
1425
+ send(options) {
1426
+ return this.messages.send(options);
1427
+ }
1428
+ };
1429
+
1430
+ // src/struct/groupChannel.ts
1431
+ var GroupChannel2 = class extends Channel {
1432
+ /**
1433
+ * Creates a new GroupChannel instance.
1434
+ *
1435
+ * @param {client} client - The client instance.
1436
+ * @param {APIGroupChannel} data - The raw data for the group channel from the API.
1437
+ */
1438
+ constructor(client3, data) {
1439
+ super(client3);
1440
+ /** The type of the channel, which is always `GROUP` for group channels. */
1441
+ this.type = "GROUP" /* GROUP */;
1442
+ /** The description of the group channel, if any. */
1443
+ this.description = null;
1444
+ /** The icon of the group channel, if any. */
1445
+ this.icon = null;
1446
+ /** Manages the messages in this group channel. */
1447
+ this.messages = new MessageManager(this);
1448
+ /** The ID of the last message sent in this group channel, if any. */
1449
+ this.lastMessageId = null;
1450
+ /** A map of user IDs to their corresponding `User` instances in the group channel. */
1451
+ this.users = /* @__PURE__ */ new Map();
1452
+ /** Whether the group channel is marked as NSFW (Not Safe For Work). */
1453
+ this.nsfw = false;
1454
+ this._patch(data);
1455
+ }
1456
+ /**
1457
+ * Updates the group channel instance with new data from the API.
1458
+ *
1459
+ * @param {APIGroupChannel} data - The raw data for the group channel from the API.
1460
+ * @returns {this} The updated group channel instance.
1461
+ * @protected
1462
+ */
1463
+ _patch(data) {
1464
+ var _a;
1465
+ super._patch(data);
1466
+ if ("description" in data) {
1467
+ this.description = (_a = data.description) != null ? _a : null;
1468
+ }
1469
+ if (Array.isArray(data.recipients)) {
1470
+ this.users.clear();
1471
+ for (const userId of data.recipients) {
1472
+ const user = this.client.users.cache.get(userId);
1473
+ if (user) this.users.set(user.id, user);
1474
+ }
1475
+ }
1476
+ if (typeof data.permissions === "number") {
1477
+ this.permissions = new ChannelPermissions(data.permissions).freeze();
1478
+ }
1479
+ if (data.owner) {
1480
+ this.ownerId = data.owner;
1481
+ }
1482
+ if (data.icon) {
1483
+ this.icon = new Attachment(this.client, data.icon);
1484
+ }
1485
+ if (data.name) {
1486
+ this.name = data.name;
1487
+ }
1488
+ if (data.last_message_id) this.lastMessageId = data.last_message_id;
1489
+ if (typeof data.nsfw === "boolean") this.nsfw = data.nsfw;
1490
+ return this;
1491
+ }
1492
+ /**
1493
+ * Retrieves the last message sent in this group channel.
1494
+ *
1495
+ * @returns {Message | null} The last message, or `null` if no message exists.
1496
+ */
1497
+ get lastMessage() {
1498
+ var _a;
1499
+ if (!this.lastMessageId) return null;
1500
+ return (_a = this.messages.cache.get(this.lastMessageId)) != null ? _a : null;
1501
+ }
1502
+ /**
1503
+ * Retrieves the owner of the group channel.
1504
+ *
1505
+ * @returns {User | null} The owner of the group channel, or `null` if not found.
1506
+ */
1507
+ get owner() {
1508
+ var _a;
1509
+ return (_a = this.client.users.cache.get(this.ownerId)) != null ? _a : null;
1510
+ }
1511
+ /**
1512
+ * Deletes multiple messages from this group channel.
1513
+ *
1514
+ * @param {MessageResolvable[] | Map<string, Message> | number} messages - The messages to delete. This can be an array of message resolvables, a map of messages, or a number indicating how many recent messages to delete.
1515
+ * @returns {Promise<void>} A promise that resolves when the messages have been successfully deleted.
1516
+ *
1517
+ * @example
1518
+ * ```typescript
1519
+ * await groupChannel.bulkDelete(10); // Deletes the last 10 messages.
1520
+ * ```
1521
+ */
1522
+ bulkDelete(messages) {
1523
+ return this.messages.bulkDelete(messages);
1524
+ }
1525
+ /**
1526
+ * Creates an invite for the group channel.
1527
+ *
1528
+ * @returns {Promise<Invite>} A promise that resolves with the created invite.
1529
+ *
1530
+ * @example
1531
+ * ```typescript
1532
+ * const invite = await groupChannel.createInvite();
1533
+ * console.log(`Invite created: ${invite}`);
1534
+ * ```
1535
+ */
1536
+ createInvite() {
1537
+ return __async(this, null, function* () {
1538
+ const data = yield this.client.api.post(`/channels/${this.id}/invites`, {});
1539
+ return new Invite(
1540
+ this.client,
1541
+ data
1542
+ );
1543
+ });
1544
+ }
1545
+ /**
1546
+ * Adds a user to the group channel.
1547
+ *
1548
+ * @param {UserResolvable} user - The user to add to the group channel.
1549
+ * @returns {Promise<void>} A promise that resolves when the user has been successfully added.
1550
+ *
1551
+ * @example
1552
+ * ```typescript
1553
+ * await groupChannel.add(user);
1554
+ * ```
1555
+ */
1556
+ add(user) {
1557
+ return __async(this, null, function* () {
1558
+ const id = this.client.users.resolveId(user);
1559
+ if (!id) throw new TypeError("INVALID_TYPE");
1560
+ yield this.client.api.put(`/channels/${this.id}/recipients/${id}`);
1561
+ });
1562
+ }
1563
+ /**
1564
+ * Removes a user from the group channel.
1565
+ *
1566
+ * @param {UserResolvable} user - The user to remove from the group channel.
1567
+ * @returns {Promise<void>} A promise that resolves when the user has been successfully removed.
1568
+ *
1569
+ * @example
1570
+ * ```typescript
1571
+ * await groupChannel.remove(user);
1572
+ * ```
1573
+ */
1574
+ remove(user) {
1575
+ return __async(this, null, function* () {
1576
+ const id = this.client.users.resolveId(user);
1577
+ if (!id) throw new TypeError("INVALID_TYPE");
1578
+ yield this.client.api.delete(`/channels/${this.id}/recipients/${id}`);
1579
+ });
1580
+ }
1581
+ /**
1582
+ * Leaves the group channel.
1583
+ *
1584
+ * @returns {Promise<void>} A promise that resolves when the group channel has been successfully left.
1585
+ *
1586
+ * @example
1587
+ * ```typescript
1588
+ * await groupChannel.leave();
1589
+ * ```
1590
+ */
1591
+ leave() {
1592
+ return super.delete();
1593
+ }
1594
+ /**
1595
+ * Sends a message to this group channel.
1596
+ *
1597
+ * @param {MessageOptions | string} options - The message content or options for the message.
1598
+ * @returns {Promise<Message>} A promise that resolves with the sent message.
1599
+ *
1600
+ * @example
1601
+ * ```typescript
1602
+ * await groupChannel.send("Hello, group!");
1603
+ * ```
1604
+ */
1605
+ send(options) {
1606
+ return this.messages.send(options);
1607
+ }
1608
+ // iconURL(options?: { size: number }): string | null {
1609
+ // if (!this.icon) return null;
1610
+ // return this.client.api.cdn.icon(this.icon.id, options?.size);
1611
+ // }
1612
+ };
1613
+
1614
+ // src/struct/invite.ts
1615
+ var Invite = class extends Base {
1616
+ /**
1617
+ * Creates a new Invite instance.
1618
+ *
1619
+ * @param {client} client - The client instance.
1620
+ * @param {APIInvite} data - The raw data for the invite from the API.
1621
+ */
1622
+ constructor(client3, data) {
1623
+ super(client3);
1624
+ /** The ID of the server associated with the invite, if any. */
1625
+ this.serverId = null;
1626
+ this._patch(data);
1627
+ }
1628
+ /**
1629
+ * Updates the invite instance with new data from the API.
1630
+ *
1631
+ * @param {APIInvite} data - The raw data for the invite from the API.
1632
+ * @returns {this} The updated invite instance.
1633
+ * @protected
1634
+ */
1635
+ _patch(data) {
1636
+ super._patch(data);
1637
+ if (data.channel) this.channelId = data.channel;
1638
+ if (data.creator) this.inviterId = data.channel;
1639
+ return this;
1640
+ }
1641
+ /**
1642
+ * Retrieves the server associated with the invite.
1643
+ *
1644
+ * @returns {Server | null} The server associated with the invite, or `null` if not found.
1645
+ */
1646
+ get server() {
1647
+ var _a;
1648
+ return (_a = this.client.servers.cache.get(this.serverId)) != null ? _a : null;
1649
+ }
1650
+ /**
1651
+ * Retrieves the channel associated with the invite.
1652
+ *
1653
+ * @returns {Channel | null} The channel associated with the invite, or `null` if not found.
1654
+ */
1655
+ get channel() {
1656
+ var _a;
1657
+ return (_a = this.client.channels.cache.get(this.channelId)) != null ? _a : null;
1658
+ }
1659
+ /**
1660
+ * Retrieves the user who created the invite.
1661
+ *
1662
+ * @returns {User | null} The user who created the invite, or `null` if not found.
1663
+ */
1664
+ get inviter() {
1665
+ var _a;
1666
+ return (_a = this.client.users.cache.get(this.inviterId)) != null ? _a : null;
1667
+ }
1668
+ // toString(): string {
1669
+ // return this.client.api.cdn.invite(this.id);
1670
+ // }
1671
+ };
1672
+
1673
+ // src/struct/mentions.ts
1674
+ var Mentions = class {
1675
+ /**
1676
+ * Creates a new Mentions instance.
1677
+ *
1678
+ * @param {Message} message - The message associated with the mentions.
1679
+ * @param {string[]} _users - An array of user IDs mentioned in the message.
1680
+ */
1681
+ constructor(message, _users) {
1682
+ this.message = message;
1683
+ this._users = _users;
1684
+ this.client = message.client;
1685
+ }
1686
+ /**
1687
+ * Checks if a specific user is mentioned in the message.
1688
+ *
1689
+ * @param {UserResolvable} user - The user to check.
1690
+ * @returns {boolean} `true` if the user is mentioned, otherwise `false`.
1691
+ * @throws {TypeError} Throws an error if the user cannot be resolved.
1692
+ *
1693
+ * @example
1694
+ * ```typescript
1695
+ * if (mentions.has(someUser)) {
1696
+ * console.log("User is mentioned!");
1697
+ * }
1698
+ * ```
1699
+ */
1700
+ has(user) {
1701
+ const id = this.client.users.resolveId(user);
1702
+ if (!id) throw new TypeError("INVALID_TYPE");
1703
+ return this._users.includes(id);
1704
+ }
1705
+ /**
1706
+ * Retrieves the server members mentioned in the message.
1707
+ *
1708
+ * @returns {Map<string, ServerMember> | null} A map of user IDs to `ServerMember` instances, or `null` if the message is not in a server.
1709
+ *
1710
+ * @example
1711
+ * ```typescript
1712
+ * const members = mentions.members;
1713
+ * if (members) {
1714
+ * members.forEach(member => console.log(member.displayName));
1715
+ * }
1716
+ * ```
1717
+ */
1718
+ get members() {
1719
+ const server = this.message.server;
1720
+ if (!server) return null;
1721
+ const members = /* @__PURE__ */ new Map();
1722
+ for (const userId of this._users) {
1723
+ const member = server.members.cache.get(userId);
1724
+ if (member) members.set(member.id, member);
1725
+ }
1726
+ return members;
1727
+ }
1728
+ /**
1729
+ * Retrieves the users mentioned in the message.
1730
+ *
1731
+ * @returns {Map<string, User>} A map of user IDs to `User` instances.
1732
+ *
1733
+ * @example
1734
+ * ```typescript
1735
+ * const users = mentions.users;
1736
+ * users.forEach(user => console.log(user.username));
1737
+ * ```
1738
+ */
1739
+ get users() {
1740
+ const users = /* @__PURE__ */ new Map();
1741
+ for (const userId of this._users) {
1742
+ const user = this.client.users.cache.get(userId);
1743
+ if (user) users.set(user.id, user);
1744
+ }
1745
+ return users;
1746
+ }
1747
+ };
1748
+
1749
+ // src/struct/messageEmbed.ts
1750
+ var import_axios4 = __toESM(require("axios"), 1);
1751
+ var import_form_data = __toESM(require("form-data"), 1);
1752
+ var import_node_buffer = require("buffer");
1753
+
1754
+ // src/struct/notesChannel.ts
1755
+ var NotesChannel2 = class extends Channel {
1756
+ /**
1757
+ * Creates a new NotesChannel instance.
1758
+ *
1759
+ * @param {client} client - The client instance.
1760
+ * @param {APINotesChannel} data - The raw data for the notes channel from the API.
1761
+ */
1762
+ constructor(client3, data) {
1763
+ super(client3);
1764
+ /** The type of the channel, which is always `NOTES` for notes channels. */
1765
+ this.type = "NOTES" /* NOTES */;
1766
+ /** The ID of the last message sent in this notes channel, if any. */
1767
+ this.lastMessageId = null;
1768
+ /** Manages the messages in this notes channel. */
1769
+ this.messages = new MessageManager(this);
1770
+ this._patch(data);
1771
+ }
1772
+ /**
1773
+ * Updates the notes channel instance with new data from the API.
1774
+ *
1775
+ * @param {APINotesChannel} data - The raw data for the notes channel from the API.
1776
+ * @returns {this} The updated notes channel instance.
1777
+ * @protected
1778
+ */
1779
+ _patch(data) {
1780
+ super._patch(data);
1781
+ if (data.user) {
1782
+ this.userId = data.user;
1783
+ }
1784
+ return this;
1785
+ }
1786
+ /**
1787
+ * Sends a message to this notes channel.
1788
+ *
1789
+ * @param {MessageOptions | string} options - The message content or options for the message.
1790
+ * @returns {Promise<Message>} A promise that resolves with the sent message.
1791
+ *
1792
+ * @example
1793
+ * ```typescript
1794
+ * await notesChannel.send("This is a saved message.");
1795
+ * ```
1796
+ */
1797
+ send(options) {
1798
+ return this.messages.send(options);
1799
+ }
1800
+ /**
1801
+ * Deletes multiple messages from this notes channel.
1802
+ *
1803
+ * @param {MessageResolvable[] | Map<string, Message> | number} messages - The messages to delete. This can be an array of message resolvables, a map of messages, or a number indicating how many recent messages to delete.
1804
+ * @returns {Promise<void>} A promise that resolves when the messages have been successfully deleted.
1805
+ *
1806
+ * @example
1807
+ * ```typescript
1808
+ * await notesChannel.bulkDelete(5); // Deletes the last 5 messages.
1809
+ * ```
1810
+ */
1811
+ bulkDelete(messages) {
1812
+ return this.messages.bulkDelete(messages);
1813
+ }
1814
+ /**
1815
+ * Retrieves the last message sent in this notes channel.
1816
+ *
1817
+ * @returns {Message | null} The last message, or `null` if no message exists.
1818
+ */
1819
+ get lastMessage() {
1820
+ var _a;
1821
+ if (!this.lastMessageId) return null;
1822
+ return (_a = this.messages.cache.get(this.lastMessageId)) != null ? _a : null;
1823
+ }
1824
+ /**
1825
+ * Retrieves the user associated with this notes channel.
1826
+ *
1827
+ * @returns {User} The user associated with the notes channel.
1828
+ */
1829
+ get user() {
1830
+ return this.client.user;
1831
+ }
1832
+ };
1833
+
1834
+ // src/struct/serverChannel.ts
1835
+ var ServerChannel = class extends Channel {
1836
+ /**
1837
+ * Creates a new ServerChannel instance.
1838
+ *
1839
+ * @param {client} client - The client instance.
1840
+ * @param {APIServerChannel} data - The raw data for the server channel from the API.
1841
+ */
1842
+ constructor(client3, data) {
1843
+ super(client3);
1844
+ /** The description of the channel, or `null` if none is set. */
1845
+ this.description = null;
1846
+ /** The icon of the channel, or `null` if none is set. */
1847
+ this.icon = null;
1848
+ /** The permission overwrites for the channel. */
1849
+ this.overwrites = /* @__PURE__ */ new Map();
1850
+ /** Whether the channel is marked as NSFW (Not Safe For Work). */
1851
+ this.nsfw = false;
1852
+ this._patch(data);
1853
+ }
1854
+ /**
1855
+ * Updates the server channel instance with new data from the API.
1856
+ *
1857
+ * @param {APIServerChannel} data - The raw data for the server channel from the API.
1858
+ * @param {FieldsChannel[]} [clear=[]] - Fields to clear in the channel.
1859
+ * @returns {this} The updated server channel instance.
1860
+ * @protected
1861
+ */
1862
+ _patch(data, clear = []) {
1863
+ var _a;
1864
+ super._patch(data);
1865
+ if (data.name) this.name = data.name;
1866
+ if (data.server) this.serverId = data.server;
1867
+ if ("description" in data) this.description = (_a = data.description) != null ? _a : null;
1868
+ if (data.icon) this.icon = new Attachment(this.client, data.icon);
1869
+ if (typeof data.nsfw === "boolean") this.nsfw = data.nsfw;
1870
+ if (data.role_permissions) {
1871
+ this.overwrites.clear();
1872
+ for (const [id, { a, d }] of Object.entries(data.role_permissions)) {
1873
+ this.overwrites.set(id, {
1874
+ allow: new FullPermissions(a),
1875
+ deny: new FullPermissions(d)
1876
+ });
1877
+ }
1878
+ }
1879
+ for (const field of clear) {
1880
+ if (field === "Icon") this.icon = null;
1881
+ if (field === "Description") this.description = null;
1882
+ }
1883
+ return this;
1884
+ }
1885
+ /**
1886
+ * Creates an invite for the server channel.
1887
+ *
1888
+ * @returns {Promise<Invite>} A promise that resolves with the created invite.
1889
+ *
1890
+ * @example
1891
+ * ```typescript
1892
+ * const invite = await serverChannel.createInvite();
1893
+ * console.log(`Invite created: ${invite}`);
1894
+ * ```
1895
+ */
1896
+ createInvite() {
1897
+ return __async(this, null, function* () {
1898
+ const data = yield this.client.api.post(`/channels/${this.id}/invites`, {});
1899
+ return new Invite(
1900
+ this.client,
1901
+ data
1902
+ );
1903
+ });
1904
+ }
1905
+ // iconURL(options?: { size: number }): string | null {
1906
+ // return this.icon
1907
+ // ? this.client.api.cdn.icon(this.icon.id, options?.size)
1908
+ // : null;
1909
+ // }
1910
+ /**
1911
+ * Retrieves the server this channel belongs to.
1912
+ *
1913
+ * @returns {Server} The server instance.
1914
+ */
1915
+ get server() {
1916
+ return this.client.servers.cache.get(this.serverId);
1917
+ }
1918
+ /**
1919
+ * Retrieves the category this channel belongs to, if any.
1920
+ *
1921
+ * @returns {Category | null} The category instance, or `null` if the channel is not in a category.
1922
+ */
1923
+ get category() {
1924
+ var _a;
1925
+ return (_a = Array.from(this.server.categories.values()).find(
1926
+ (cat) => cat.children.has(this.id)
1927
+ )) != null ? _a : null;
1928
+ }
1929
+ };
1930
+
1931
+ // src/struct/serverMember.ts
1932
+ var ServerMember3 = class extends Base {
1933
+ /**
1934
+ * Creates a new ServerMember instance.
1935
+ *
1936
+ * @param {client} client - The client instance.
1937
+ * @param {APIMember} data - The raw data for the server member from the API.
1938
+ */
1939
+ constructor(client3, data) {
1940
+ super(client3);
1941
+ /** The nickname of the member, or `null` if none is set. */
1942
+ this.nickname = null;
1943
+ /** The avatar of the member, or `null` if none is set. */
1944
+ this.avatar = null;
1945
+ /** roles assigned to the member */
1946
+ this.roles = [];
1947
+ this._patch(data);
1948
+ }
1949
+ /**
1950
+ * Updates the server member instance with new data from the API.
1951
+ *
1952
+ * @param {APIMember} data - The raw data for the server member from the API.
1953
+ * @param {FieldsMember[]} [clear=[]] - Fields to clear in the server member.
1954
+ * @returns {this} The updated server member instance.
1955
+ * @protected
1956
+ */
1957
+ _patch(data, clear = []) {
1958
+ var _a;
1959
+ super._patch(data);
1960
+ if ("nickname" in data) {
1961
+ this.nickname = (_a = data.nickname) != null ? _a : null;
1962
+ }
1963
+ if (data.avatar) {
1964
+ this.avatar = new Attachment(this.client, data.avatar);
1965
+ }
1966
+ if (data._id) {
1967
+ this.serverId = data._id.server;
1968
+ this.id = data._id.user;
1969
+ }
1970
+ if (Array.isArray(data.roles)) {
1971
+ if (!data.roles.length) this.roles = [];
1972
+ else {
1973
+ this.roles = data.roles.map((roleId) => {
1974
+ const role = this.server.roles.cache.get(roleId);
1975
+ if (!role) {
1976
+ throw new Error(
1977
+ `Role with ID ${roleId} not found in server ${this.serverId}`
1978
+ );
1979
+ }
1980
+ return role;
1981
+ });
1982
+ }
1983
+ }
1984
+ for (const field of clear) {
1985
+ if (field === "Avatar") this.avatar = null;
1986
+ if (field === "Nickname") this.nickname = null;
1987
+ }
1988
+ return this;
1989
+ }
1990
+ /**
1991
+ * Sets the nickname of the server member.
1992
+ *
1993
+ * @param {string} [nickname] - The new nickname to set, or `undefined` to clear the nickname.
1994
+ * @returns {Promise<this>} A promise that resolves with the updated server member instance.
1995
+ *
1996
+ * @example
1997
+ * ```typescript
1998
+ * await member.setNickname("NewNickname");
1999
+ * ```
2000
+ */
2001
+ setNickname(nickname) {
2002
+ return __async(this, null, function* () {
2003
+ yield this.server.members.edit(this, { nickname });
2004
+ return this;
2005
+ });
2006
+ }
2007
+ /**
2008
+ * adds a role to the server member.
2009
+ * @param roleId - The ID of the role to add to the member.
2010
+ * @returns
2011
+ */
2012
+ addRole(roleId) {
2013
+ return __async(this, null, function* () {
2014
+ const currentRoles = this.roles.map((role) => role.id);
2015
+ if (currentRoles.includes(roleId)) {
2016
+ return this;
2017
+ }
2018
+ yield this.server.members.edit(this, {
2019
+ roles: [...currentRoles, roleId]
2020
+ });
2021
+ return this;
2022
+ });
2023
+ }
2024
+ /**
2025
+ * Removes a role from the server member.
2026
+ *
2027
+ * @param {string} roleId - The ID of the role to remove from the member.
2028
+ * @returns {Promise<this>} A promise that resolves with the updated server member instance.
2029
+ *
2030
+ * @example
2031
+ * ```typescript
2032
+ * await member.removeRole("roleId");
2033
+ * ```
2034
+ */
2035
+ removeRole(roleId) {
2036
+ return __async(this, null, function* () {
2037
+ const currentRoles = this.roles.map((role) => role.id);
2038
+ if (!currentRoles.includes(roleId)) {
2039
+ return this;
2040
+ }
2041
+ yield this.server.members.edit(this, {
2042
+ roles: currentRoles.filter((id) => id !== roleId)
2043
+ });
2044
+ return this;
2045
+ });
2046
+ }
2047
+ /**
2048
+ * Bans the server member.
2049
+ *
2050
+ * @param {string} [reason] - The reason for the ban.
2051
+ * @returns {Promise<void>} A promise that resolves when the member is banned.
2052
+ *
2053
+ * @example
2054
+ * ```typescript
2055
+ * await member.ban("Violation of rules");
2056
+ * ```
2057
+ */
2058
+ ban(reason) {
2059
+ return this.server.members.ban(this, reason);
2060
+ }
2061
+ /**
2062
+ * Kicks the server member.
2063
+ *
2064
+ * @returns {Promise<void>} A promise that resolves when the member is kicked.
2065
+ *
2066
+ * @example
2067
+ * ```typescript
2068
+ * await member.kick();
2069
+ * ```
2070
+ */
2071
+ kick() {
2072
+ return this.server.members.kick(this);
2073
+ }
2074
+ /**
2075
+ * Leaves the server.
2076
+ *
2077
+ * @returns {Promise<void>} A promise that resolves when the member leaves the server.
2078
+ *
2079
+ * @example
2080
+ * ```typescript
2081
+ * await member.leave();
2082
+ * ```
2083
+ */
2084
+ leave() {
2085
+ return this.client.servers.delete(this.serverId);
2086
+ }
2087
+ // async displayAvatarURL(options?: { size: number }): Promise<string> {
2088
+ // return await this.user.displayAvatarURL(options);
2089
+ // }
2090
+ /**
2091
+ * Retrieves the user associated with this server member.
2092
+ *
2093
+ * @returns {User} The user instance.
2094
+ */
2095
+ get user() {
2096
+ return this.client.users.cache.get(this.id);
2097
+ }
2098
+ /**
2099
+ * Retrieves the server this member belongs to.
2100
+ *
2101
+ * @returns {Server} The server instance.
2102
+ */
2103
+ get server() {
2104
+ return this.client.servers.cache.get(this.serverId);
2105
+ }
2106
+ /**
2107
+ * Converts the server member to a string representation.
2108
+ *
2109
+ * @returns {string} A string representation of the server member in the format `<@userId>`.
2110
+ */
2111
+ toString() {
2112
+ return `<@${this.id}>`;
2113
+ }
2114
+ };
2115
+
2116
+ // src/struct/textChannel.ts
2117
+ var TextChannel2 = class extends ServerChannel {
2118
+ /**
2119
+ * Creates a new TextChannel instance.
2120
+ *
2121
+ * @param {client} client - The client instance.
2122
+ * @param {APITextChannel} data - The raw data for the text channel from the API.
2123
+ */
2124
+ constructor(client3, data) {
2125
+ super(client3, data);
2126
+ /** The ID of the last message sent in this text channel, if any. */
2127
+ this.lastMessageId = null;
2128
+ /** Manages the messages in this text channel. */
2129
+ this.messages = new MessageManager(this);
2130
+ /** The type of the channel, which is always `TEXT` for text channels. */
2131
+ this.type = "TEXT" /* TEXT */;
2132
+ this._patch(data);
2133
+ }
2134
+ /**
2135
+ * Updates the text channel instance with new data from the API.
2136
+ *
2137
+ * @param {APITextChannel} data - The raw data for the text channel from the API.
2138
+ * @returns {this} The updated text channel instance.
2139
+ * @protected
2140
+ */
2141
+ _patch(data) {
2142
+ super._patch(data);
2143
+ if (data.last_message_id) this.lastMessageId = data.last_message_id;
2144
+ return this;
2145
+ }
2146
+ /**
2147
+ * Retrieves the last message sent in this text channel.
2148
+ *
2149
+ * @returns {Message | null} The last message, or `null` if no message exists.
2150
+ */
2151
+ get lastMessage() {
2152
+ var _a;
2153
+ if (!this.lastMessageId) return null;
2154
+ return (_a = this.messages.cache.get(this.lastMessageId)) != null ? _a : null;
2155
+ }
2156
+ /**
2157
+ * Sends a message to this text channel.
2158
+ *
2159
+ * @param {MessageOptions | string} options - The message content or options for the message.
2160
+ * @returns {Promise<Message>} A promise that resolves with the sent message.
2161
+ *
2162
+ * @example
2163
+ * ```typescript
2164
+ * await textChannel.send("Hello, world!");
2165
+ * ```
2166
+ */
2167
+ send(options) {
2168
+ return this.messages.send(options);
2169
+ }
2170
+ /**
2171
+ * Deletes multiple messages from this text channel.
2172
+ *
2173
+ * @param {MessageResolvable[] | Map<string, Message> | number} messages - The messages to delete. This can be an array of message resolvables, a map of messages, or a number indicating how many recent messages to delete.
2174
+ * @returns {Promise<void>} A promise that resolves when the messages have been successfully deleted.
2175
+ *
2176
+ * @example
2177
+ * ```typescript
2178
+ * await textChannel.bulkDelete(10); // Deletes the last 10 messages.
2179
+ * ```
2180
+ */
2181
+ bulkDelete(messages) {
2182
+ return this.messages.bulkDelete(messages);
2183
+ }
2184
+ };
2185
+
2186
+ // src/struct/voiceChannels.ts
2187
+ var VoiceChannel = class extends ServerChannel {
2188
+ /**
2189
+ * Creates a new VoiceChannel instance.
2190
+ *
2191
+ * @param {client} client - The client instance.
2192
+ * @param {APIVoiceChannel} data - The raw data for the voice channel from the API.
2193
+ */
2194
+ constructor(client3, data) {
2195
+ super(client3, data);
2196
+ /** The type of the channel, which is always `VOICE` for voice channels. */
2197
+ this.type = "VOICE" /* VOICE */;
2198
+ this._patch(data);
2199
+ }
2200
+ /**
2201
+ * Updates the voice channel instance with new data from the API.
2202
+ *
2203
+ * @param {APIVoiceChannel} data - The raw data for the voice channel from the API.
2204
+ * @returns {this} The updated voice channel instance.
2205
+ * @protected
2206
+ */
2207
+ _patch(data) {
2208
+ super._patch(data);
2209
+ return this;
2210
+ }
2211
+ /**
2212
+ * Acknowledges the voice channel.
2213
+ *
2214
+ * @throws {TypeError} Throws an error because voice channels cannot be acknowledged.
2215
+ *
2216
+ * @example
2217
+ * ```typescript
2218
+ * try {
2219
+ * await voiceChannel.ack();
2220
+ * } catch (error) {
2221
+ * console.error(error.message); // "Cannot ack voice channel"
2222
+ * }
2223
+ * ```
2224
+ */
2225
+ ack() {
2226
+ throw new TypeError("Cannot ack voice channel");
2227
+ }
2228
+ };
2229
+
2230
+ // src/struct/category.ts
2231
+ var Category = class extends Base {
2232
+ /**
2233
+ * Creates a new Category instance.
2234
+ *
2235
+ * @param {Server} server - The server this category belongs to.
2236
+ * @param {APICategory} data - The raw data for the category from the API.
2237
+ */
2238
+ constructor(server, data) {
2239
+ super(server.client);
2240
+ this.server = server;
2241
+ /** An array of channel IDs that belong to this category. */
2242
+ this._children = [];
2243
+ this._patch(data);
2244
+ }
2245
+ /**
2246
+ * Updates the category instance with new data from the API.
2247
+ *
2248
+ * @param {APICategory} data - The raw data for the category from the API.
2249
+ * @returns {this} The updated category instance.
2250
+ * @protected
2251
+ */
2252
+ _patch(data) {
2253
+ super._patch(data);
2254
+ if (data.title) {
2255
+ this.name = data.title;
2256
+ }
2257
+ if (Array.isArray(data.channels)) {
2258
+ this._children = data.channels;
2259
+ }
2260
+ return this;
2261
+ }
2262
+ /**
2263
+ * Retrieves the channels that belong to this category.
2264
+ *
2265
+ * @returns {Map<string, ServerChannel>} A map of channel IDs to their corresponding `ServerChannel` instances.
2266
+ */
2267
+ get children() {
2268
+ const coll = /* @__PURE__ */ new Map();
2269
+ for (const childId of this._children) {
2270
+ const child = this.server.channels.cache.get(childId);
2271
+ if (child) coll.set(child.id, child);
2272
+ }
2273
+ return coll;
2274
+ }
2275
+ /**
2276
+ * Converts the category to a string representation.
2277
+ *
2278
+ * @returns {string} The name of the category.
2279
+ */
2280
+ toString() {
2281
+ return this.name;
2282
+ }
2283
+ };
2284
+
2285
+ // src/struct/emoji.ts
2286
+ var Emoji2 = class extends Base {
2287
+ /**
2288
+ * Creates a new Emoji instance.
2289
+ *
2290
+ * @param {client} client - The client instance.
2291
+ * @param {Emoji} data - The raw data for the emoji.
2292
+ */
2293
+ constructor(client3, data) {
2294
+ super(client3);
2295
+ /** The parent object of the emoji, which can be a server or other entity. */
2296
+ this.parent = null;
2297
+ /** The ID of the user who created the emoji, or `null` if not available. */
2298
+ this.creator_id = null;
2299
+ /** The name of the emoji, or `null` if not set. */
2300
+ this.name = null;
2301
+ this._patch(data);
2302
+ }
2303
+ /**
2304
+ * Retrieves the user who created the emoji.
2305
+ *
2306
+ * @returns {User | null} The creator of the emoji, or `null` if not found.
2307
+ */
2308
+ get creator() {
2309
+ var _a;
2310
+ return (_a = this.client.users.cache.get(this.creator_id)) != null ? _a : null;
2311
+ }
2312
+ /**
2313
+ * Retrieves the server associated with the emoji, if any.
2314
+ *
2315
+ * @returns {Server | null} The server instance, or `null` if the emoji is not associated with a server.
2316
+ */
2317
+ get server() {
2318
+ var _a;
2319
+ if (!this.parent) return null;
2320
+ return (_a = this.client.servers.cache.get(this.parent.id)) != null ? _a : null;
2321
+ }
2322
+ };
2323
+
2324
+ // src/managers/channelManager.ts
2325
+ var ChannelManager = class extends BaseManager {
2326
+ constructor() {
2327
+ super(...arguments);
2328
+ this.holds = null;
2329
+ }
2330
+ _add(data) {
2331
+ let channel;
2332
+ switch (data.channel_type) {
2333
+ case "TextChannel":
2334
+ channel = new TextChannel2(this.client, data);
2335
+ break;
2336
+ case "VoiceChannel":
2337
+ channel = new VoiceChannel(this.client, data);
2338
+ break;
2339
+ case "DirectMessage":
2340
+ channel = new DMChannel3(this.client, data);
2341
+ break;
2342
+ case "Group":
2343
+ channel = new GroupChannel2(this.client, data);
2344
+ break;
2345
+ case "SavedMessages":
2346
+ channel = new NotesChannel2(this.client, data);
2347
+ if (this.client.user) this.client.user.notes = channel;
2348
+ break;
2349
+ default:
2350
+ throw new Error(`Unknown Channel Type: ${data}`);
2351
+ }
2352
+ this.cache.set(channel.id, channel);
2353
+ return channel;
2354
+ }
2355
+ _remove(id) {
2356
+ var _a;
2357
+ const channel = this.cache.get(id);
2358
+ if (channel == null ? void 0 : channel.inServer()) {
2359
+ (_a = channel.server) == null ? void 0 : _a.channels.cache.delete(id);
2360
+ }
2361
+ super._remove(id);
2362
+ }
2363
+ /**
2364
+ * used to delete a channel
2365
+ *
2366
+ * @param channel The channel to delete
2367
+ * @returns A promise that resolves when the channel is deleted
2368
+ */
2369
+ delete(channel) {
2370
+ return __async(this, null, function* () {
2371
+ const id = this.resolveId(channel);
2372
+ if (!id) {
2373
+ throw new TypeError("INVALID_TYPE");
2374
+ }
2375
+ yield this.client.api.delete(`/channels/${id}`);
2376
+ });
2377
+ }
2378
+ /**
2379
+ * used to fetch a channel
2380
+ *
2381
+ * @param channel The channel to fetch
2382
+ * @param force Whether to force fetch the channel using the api or return it form cache if able
2383
+ * @returns A promise that resolves with the fetched channel
2384
+ */
2385
+ fetch(_0) {
2386
+ return __async(this, arguments, function* (channel, { force = true } = {}) {
2387
+ const id = this.resolveId(channel);
2388
+ if (!id) {
2389
+ throw new TypeError("INVALID_TYPE");
2390
+ }
2391
+ if (!force) {
2392
+ const channel2 = this.cache.get(id);
2393
+ if (channel2) return channel2;
2394
+ }
2395
+ const data = yield this.client.api.get(`/channels/${id}`);
2396
+ return this._add(data);
2397
+ });
2398
+ }
2399
+ /**
2400
+ * resolves a channel from a string or a channel object
2401
+ * @param channel The channel to resolve
2402
+ * @returns the resolved channel or null if not found
2403
+ */
2404
+ resolve(channel) {
2405
+ if (channel instanceof Channel) return channel;
2406
+ return super.resolve(channel);
2407
+ }
2408
+ /**
2409
+ * resolves a channel id from a string or a channel object
2410
+ * @param channel The channel to resolve
2411
+ * @returns the resolved channel id or null if not found
2412
+ */
2413
+ resolveId(channel) {
2414
+ if (channel instanceof Channel) return channel.id;
2415
+ return super.resolveId(channel);
2416
+ }
2417
+ };
2418
+
2419
+ // src/managers/serverManager.ts
2420
+ var ServerManager = class extends BaseManager {
2421
+ constructor() {
2422
+ super(...arguments);
2423
+ this.holds = Server2;
2424
+ }
2425
+ _remove(id) {
2426
+ var _a;
2427
+ const server = this.cache.get(id);
2428
+ for (const id2 of (_a = server == null ? void 0 : server.channels.cache.keys()) != null ? _a : []) {
2429
+ this.client.channels._remove(id2);
2430
+ }
2431
+ return super._remove(id);
2432
+ }
2433
+ /**
2434
+ * edits a server
2435
+ * @param server The server to edit
2436
+ * @param options The options to edit the server with
2437
+ * @param options.name The name of the server
2438
+ * @param options.description The description of the server
2439
+ * @returns A promise that resolves when the server is edited
2440
+ */
2441
+ edit(server, options) {
2442
+ return __async(this, null, function* () {
2443
+ const id = this.resolveId(server);
2444
+ if (!id) throw new TypeError("INVALID_TYPE");
2445
+ yield this.client.api.patch(`/servers/${id}`, { body: options });
2446
+ });
2447
+ }
2448
+ /**
2449
+ * leaves a server
2450
+ * @param server the server to leave
2451
+ */
2452
+ delete(server) {
2453
+ return __async(this, null, function* () {
2454
+ const id = this.resolveId(server);
2455
+ if (!id) throw new TypeError("INVALID_TYPE");
2456
+ yield this.client.api.delete(`/servers/${id}`);
2457
+ });
2458
+ }
2459
+ fetch(_0) {
2460
+ return __async(this, arguments, function* (server, { force = true } = {}) {
2461
+ const id = this.resolveId(server);
2462
+ if (!id) throw new TypeError("INVALID_TYPE");
2463
+ if (!force) {
2464
+ const server2 = this.cache.get(id);
2465
+ if (server2) return server2;
2466
+ }
2467
+ const data = yield this.client.api.get(`/servers/${id}`);
2468
+ return this._add(data);
2469
+ });
2470
+ }
2471
+ };
2472
+
2473
+ // src/managers/messageManager.ts
2474
+ var import_node_buffer2 = require("buffer");
2475
+ var import_stream = require("stream");
2476
+ var import_form_data2 = __toESM(require("form-data"), 1);
2477
+ var import_axios5 = __toESM(require("axios"), 1);
2478
+ var MessageManager = class extends BaseManager {
2479
+ constructor(channel) {
2480
+ super(channel.client);
2481
+ this.channel = channel;
2482
+ this.holds = Message;
2483
+ }
2484
+ /**
2485
+ *
2486
+ * @param content The content to send. Can be a string or an object with the following properties:
2487
+ * - content: The content of the message
2488
+ * - replies: An array of message IDs to reply to
2489
+ * - attachments: An array of attachment URLs, Files, or ReadStreams
2490
+ * - embeds: An array of MessageEmbed objects
2491
+ * @returns Promise that resolves to the sent message
2492
+ */
2493
+ send(content) {
2494
+ return __async(this, null, function* () {
2495
+ if (typeof content === "string") content = { content };
2496
+ let attachments = [];
2497
+ let embeds = [];
2498
+ if (Array.isArray(content.attachments)) {
2499
+ const promises = content.attachments.map((att) => __async(this, null, function* () {
2500
+ const data = new import_form_data2.default();
2501
+ if (typeof att === "string") {
2502
+ const readableStream = yield import_axios5.default.get(att, {
2503
+ responseType: "stream"
2504
+ });
2505
+ data.append("file", readableStream.data, {
2506
+ filename: att.split("/").pop()
2507
+ });
2508
+ }
2509
+ if (att instanceof import_stream.Readable) {
2510
+ data.append("file", att);
2511
+ }
2512
+ if (att instanceof import_node_buffer2.File) {
2513
+ const buffer = Buffer.from(yield att.arrayBuffer());
2514
+ data.append("file", buffer, { filename: att.name });
2515
+ }
2516
+ yield this.client.cdn.post("/attachments", data).then((attachment) => {
2517
+ const { id } = attachment;
2518
+ attachments.push(id);
2519
+ });
2520
+ }));
2521
+ yield Promise.all(promises);
2522
+ }
2523
+ if (Array.isArray(content.embeds)) {
2524
+ const promises = content.embeds.map((embed) => __async(this, null, function* () {
2525
+ const json = yield embed.toJSONWithMedia(this.client);
2526
+ embeds.push(json);
2527
+ }));
2528
+ yield Promise.all(promises);
2529
+ }
2530
+ const resp = yield this.client.api.post(
2531
+ `/channels/${this.channel.id}/messages`,
2532
+ {
2533
+ body: __spreadProps(__spreadValues({}, content), { attachments, embeds, nonce: UUID.generate() })
2534
+ }
2535
+ );
2536
+ return this._add(resp);
2537
+ });
2538
+ }
2539
+ /**
2540
+ * acknowledge a message to mark it as read (not important for bots)
2541
+ * @param message The message to acknowledge
2542
+ * @returns Promise that resolves when the message is acknowledged
2543
+ */
2544
+ ack(message) {
2545
+ return __async(this, null, function* () {
2546
+ const id = this.resolveId(message);
2547
+ if (!id) {
2548
+ throw new TypeError("INVALID_TYPE");
2549
+ }
2550
+ yield this.client.api.put(`/channels/${this.channel.id}/ack/${id}`);
2551
+ });
2552
+ }
2553
+ /**
2554
+ * bulk delete messages from the channel
2555
+ * @param messages The messages to delete. Can be an array of message IDs or a Map of message IDs to Message objects.
2556
+ * @returns Promise that resolves when the messages are deleted
2557
+ */
2558
+ bulkDelete(messages) {
2559
+ return __async(this, null, function* () {
2560
+ let ids = [];
2561
+ if (typeof messages === "number") {
2562
+ messages = yield this.fetch(messages);
2563
+ ids = messages instanceof Map ? [...messages.keys()] : [];
2564
+ } else if (messages instanceof Map) {
2565
+ ids = [...messages.keys()];
2566
+ } else {
2567
+ ids = messages.map((m) => this.resolveId(m)).filter(Boolean);
2568
+ }
2569
+ yield this.client.api.delete(`/channels/${this.channel.id}/messages/bulk`, {
2570
+ body: JSON.stringify({ ids })
2571
+ });
2572
+ });
2573
+ }
2574
+ /**
2575
+ * delete a message from the channel
2576
+ * @param message The message to delete. Can be a Message object or a message ID.
2577
+ * @returns Promise that resolves when the message is deleted
2578
+ */
2579
+ delete(message) {
2580
+ return __async(this, null, function* () {
2581
+ const id = this.resolveId(message);
2582
+ if (!id) {
2583
+ throw new TypeError("INVALID_TYPE");
2584
+ }
2585
+ yield this.client.api.delete(`/channels/${this.channel.id}/messages/${id}`);
2586
+ });
2587
+ }
2588
+ /**
2589
+ * edit a message in the channel
2590
+ * @param message The message to edit. Can be a Message object or a message ID.
2591
+ * @param options The options to edit the message with. Can be a string or an object with the following properties:
2592
+ * - content: The new content of the message
2593
+ * - attachments: An array of attachment URLs
2594
+ * - embeds: An array of MessageEmbed objects
2595
+ * @returns Promise that resolves when the message is edited
2596
+ */
2597
+ edit(message, options) {
2598
+ return __async(this, null, function* () {
2599
+ const id = this.resolveId(message);
2600
+ if (!id) {
2601
+ throw new TypeError("INVALID_TYPE");
2602
+ }
2603
+ if (typeof options === "string") options = { content: options };
2604
+ yield this.client.api.patch(`/channels/${this.channel.id}/messages/${id}`, {
2605
+ body: options
2606
+ });
2607
+ });
2608
+ }
2609
+ /**
2610
+ * search for messages in the channel
2611
+ * @param query The query to search for. Can be a string or an object with the following properties:
2612
+ * - query: The query to search for
2613
+ * - limit: The maximum number of messages to return
2614
+ * - before: The message ID to start searching from (exclusive)
2615
+ * - after: The message ID to stop searching at (exclusive)
2616
+ * - sort: The sort order of the results (asc or desc)
2617
+ * @returns Promise that resolves to a Map of message IDs to Message objects
2618
+ */
2619
+ search(query) {
2620
+ return __async(this, null, function* () {
2621
+ if (typeof query === "string") query = { query };
2622
+ const response = yield this.client.api.post(
2623
+ `/channels/${this.channel.id}/search`,
2624
+ {
2625
+ query
2626
+ }
2627
+ );
2628
+ return response.reduce((coll, cur) => {
2629
+ const msg = this._add(cur);
2630
+ coll.set(msg.id, msg);
2631
+ return coll;
2632
+ }, /* @__PURE__ */ new Map());
2633
+ });
2634
+ }
2635
+ fetch(query) {
2636
+ return __async(this, null, function* () {
2637
+ const id = this.resolveId(query);
2638
+ if (id) {
2639
+ const data = yield this.client.api.get(
2640
+ `/channels/${this.channel.id}/messages/${id}`
2641
+ );
2642
+ return this._add(data);
2643
+ }
2644
+ if (typeof query === "number") query = { limit: query };
2645
+ else if (typeof query === "undefined") query = { limit: 100 };
2646
+ const messages = yield this.client.api.get(
2647
+ `/channels/${this.channel.id}/messages`,
2648
+ { query: JSON.stringify(query) }
2649
+ );
2650
+ return messages.reduce((coll, cur) => {
2651
+ const msg = this._add(cur);
2652
+ coll.set(msg.id, msg);
2653
+ return coll;
2654
+ }, /* @__PURE__ */ new Map());
2655
+ });
2656
+ }
2657
+ /**
2658
+ * add a reaction to a message
2659
+ * @param message The message to react to. Can be a Message object or a message ID.
2660
+ * @param emoji emoji to react with. Can be a string or an Emoji object.
2661
+ * @returns Promise that resolves when the reaction is added
2662
+ */
2663
+ addReaction(message, emoji) {
2664
+ return __async(this, null, function* () {
2665
+ const id = this.resolveId(message);
2666
+ if (!id) {
2667
+ throw new TypeError("INVALID_TYPE");
2668
+ }
2669
+ if (emoji instanceof Emoji2) emoji = emoji.id;
2670
+ else if (typeof emoji !== "string") {
2671
+ throw new TypeError("INVALID_TYPE");
2672
+ }
2673
+ yield this.client.api.put(
2674
+ `/channels/${this.channel.id}/messages/${id}/reactions/${emoji}`
2675
+ );
2676
+ });
2677
+ }
2678
+ /**
2679
+ *
2680
+ * @param message The message to unreact. Can be a Message object or a message ID.
2681
+ * @param emoji the emoji to unreact with. Can be a string or an Emoji object.
2682
+ * @param user_id The user ID to remove the reaction for. If not provided, removes the reaction for the current user.
2683
+ * @param remove_all Whether to remove all of the specified reaction for the message. Defaults to false.
2684
+ * @returns Promise that resolves when the reaction is removed
2685
+ */
2686
+ removeReaction(message, emoji, user_id, remove_all = false) {
2687
+ return __async(this, null, function* () {
2688
+ const id = this.resolveId(message);
2689
+ if (!id) {
2690
+ throw new TypeError("INVALID_TYPE");
2691
+ }
2692
+ if (emoji instanceof Emoji2) emoji = emoji.id;
2693
+ else if (typeof emoji !== "string") {
2694
+ throw new TypeError("INVALID_TYPE");
2695
+ }
2696
+ const queryString = user_id ? `?user_id=${user_id}&remove_all=${remove_all}` : `?remove_all=${remove_all}`;
2697
+ yield this.client.api.delete(
2698
+ `/channels/${this.channel.id}/messages/${id}/reactions/${emoji}${queryString}`
2699
+ );
2700
+ });
2701
+ }
2702
+ /**
2703
+ * remove all reactions from a message
2704
+ * @param message The message to remove reactions from. Can be a Message object or a message ID.
2705
+ * @returns Promise that resolves when the reactions are removed
2706
+ */
2707
+ removeAllReactions(message) {
2708
+ return __async(this, null, function* () {
2709
+ const id = this.resolveId(message);
2710
+ if (!id) {
2711
+ throw new TypeError("INVALID_TYPE");
2712
+ }
2713
+ yield this.client.api.delete(
2714
+ `/channels/${this.channel.id}/messages/${id}/reactions`
2715
+ );
2716
+ });
2717
+ }
2718
+ };
2719
+
2720
+ // src/managers/roleManager.ts
2721
+ var RoleManager = class extends BaseManager {
2722
+ constructor(server) {
2723
+ super(server.client);
2724
+ this.server = server;
2725
+ this.holds = Role;
2726
+ }
2727
+ _add(data) {
2728
+ const role = new Role(this.server, data);
2729
+ this.cache.set(role.id, role);
2730
+ return role;
2731
+ }
2732
+ /**
2733
+ * creates a new role in the server
2734
+ * @param name The name of the role to create
2735
+ * @returns
2736
+ */
2737
+ create(name) {
2738
+ return __async(this, null, function* () {
2739
+ const { id, role } = yield this.client.api.post(`/servers/${this.server.id}/roles`, { body: { name } });
2740
+ return this._add(Object.assign(role, { id }));
2741
+ });
2742
+ }
2743
+ /**
2744
+ * deletes a role from the server
2745
+ * @param role the role to delete
2746
+ * @returns A promise that resolves when the role is deleted
2747
+ */
2748
+ delete(role) {
2749
+ return __async(this, null, function* () {
2750
+ const id = this.resolveId(role);
2751
+ if (!id) throw new TypeError("INVALID_TYPE");
2752
+ yield this.client.api.delete(`/servers/${this.server.id}/roles/${id}`);
2753
+ });
2754
+ }
2755
+ /**
2756
+ *
2757
+ * @param role the role to edit
2758
+ * @param data data to edit the role with
2759
+ * @param data.permissions The permissions to set for the role, in the format { a: allow, d: deny }
2760
+ * @param data.name The name of the role
2761
+ * @param data.colour The color of the role, or `null` if no color is set
2762
+ * @param data.hoist Whether the role is displayed separately in the member list
2763
+ * @param data.rank The rank of the role, used for ordering
2764
+ * @param data.remove Fields to remove from the role
2765
+ * @returns Role
2766
+ * @throws {TypeError} If the role ID is invalid
2767
+ */
2768
+ edit(role, data) {
2769
+ return __async(this, null, function* () {
2770
+ var _a, _b;
2771
+ const id = this.resolveId(role);
2772
+ if (!id) throw new TypeError("INVALID_TYPE");
2773
+ if (data.permissions) {
2774
+ const permissions = {
2775
+ allow: new FullPermissions(((_a = data.permissions) == null ? void 0 : _a.a) || []).bitfield,
2776
+ deny: new FullPermissions(((_b = data.permissions) == null ? void 0 : _b.d) || []).bitfield
2777
+ };
2778
+ yield this.client.api.put(
2779
+ `/servers/${this.server.id}/permissions/${id}`,
2780
+ { body: { permissions } }
2781
+ );
2782
+ }
2783
+ delete data.permissions;
2784
+ const updatedRole = yield this.client.api.patch(
2785
+ `/servers/${this.server.id}/roles/${id}`,
2786
+ { body: data }
2787
+ );
2788
+ return this._add(Object.assign(updatedRole, { id }));
2789
+ });
2790
+ }
2791
+ };
2792
+
2793
+ // src/managers/serverChannelManager.ts
2794
+ var ServerChannelManager = class extends BaseManager {
2795
+ constructor(server) {
2796
+ super(server.client);
2797
+ this.server = server;
2798
+ this.holds = ServerChannel;
2799
+ }
2800
+ _add(data) {
2801
+ let channel;
2802
+ switch (data.channel_type) {
2803
+ case "TextChannel":
2804
+ channel = new TextChannel2(this.client, data);
2805
+ break;
2806
+ case "VoiceChannel":
2807
+ channel = new VoiceChannel(this.client, data);
2808
+ break;
2809
+ default:
2810
+ throw new Error(
2811
+ `Unknown channel type: ${data.channel_type}`
2812
+ );
2813
+ }
2814
+ this.cache.set(channel.id, channel);
2815
+ return channel;
2816
+ }
2817
+ /**
2818
+ * creates a new channel in the server
2819
+ * @param name The name of the channel to create
2820
+ * @param type The type of the channel to create. Can be "Text" or "Voice". Defaults to "Text".
2821
+ * @param description The description of the channel to create. Only used for voice channels.
2822
+ * @returns A promise that resolves to the created channel
2823
+ */
2824
+ create(_0) {
2825
+ return __async(this, arguments, function* ({
2826
+ name,
2827
+ type = "Text",
2828
+ description
2829
+ }) {
2830
+ const data = yield this.client.api.post(
2831
+ `/servers/${this.server.id}/channels`,
2832
+ {
2833
+ body: {
2834
+ name,
2835
+ type,
2836
+ description,
2837
+ nonce: UUID.generate()
2838
+ }
2839
+ }
2840
+ );
2841
+ return this._add(data);
2842
+ });
2843
+ }
2844
+ /**
2845
+ * fetch a channel from the server
2846
+ * @param channel The channel to fetch. Can be a string, a channel object, or an API channel object.
2847
+ * @param force Whether to force fetch the channel from the API. Defaults to true.
2848
+ * If set to false, the method will return the channel from the cache if it exists.
2849
+ * @returns A promise that resolves to the fetched channel
2850
+ */
2851
+ fetch(_0) {
2852
+ return __async(this, arguments, function* (channel, { force = true } = {}) {
2853
+ const id = this.resolveId(channel);
2854
+ if (!id) {
2855
+ throw new TypeError("INVALID_ID");
2856
+ }
2857
+ if (!force) {
2858
+ const channel2 = this.cache.get(id);
2859
+ if (channel2) return channel2;
2860
+ }
2861
+ const data = yield this.client.api.get(
2862
+ `/servers/${this.server.id}/channels/${id}`
2863
+ );
2864
+ return this._add(data);
2865
+ });
2866
+ }
2867
+ };
2868
+
2869
+ // src/managers/serverMemberManager.ts
2870
+ var ServerMemberManager = class extends BaseManager {
2871
+ constructor(server) {
2872
+ super(server.client);
2873
+ this.server = server;
2874
+ this.holds = ServerMember3;
2875
+ }
2876
+ /**
2877
+ * edit selected member in the server
2878
+ * @param member The member to edit
2879
+ * @param options The options to edit the member with
2880
+ * @param options.nickname The nickname of the member to set
2881
+ * @param options.avatar The avatar of the member to set
2882
+ * @param options.roles The roles of the member to set
2883
+ * @returns A promise that resolves when the member is edited
2884
+ */
2885
+ edit(member, options) {
2886
+ return __async(this, null, function* () {
2887
+ const id = this.resolveId(member);
2888
+ if (!id) {
2889
+ throw new TypeError("INVALID_TYPE");
2890
+ }
2891
+ yield this.client.api.patch(`/servers/${this.server.id}/members/${id}`, {
2892
+ body: __spreadValues({}, options)
2893
+ });
2894
+ });
2895
+ }
2896
+ /**
2897
+ * ban selected member in the server
2898
+ * @param member The member to ban
2899
+ * @param reason the reason for the ban
2900
+ * @returns A promise that resolves when the member is banned
2901
+ */
2902
+ ban(member, reason) {
2903
+ return __async(this, null, function* () {
2904
+ const id = this.resolveId(member);
2905
+ if (!id) {
2906
+ throw new TypeError("INVALID_TYPE");
2907
+ }
2908
+ yield this.client.api.put(`/servers/${this.server.id}/bans/${id}`, {
2909
+ body: { reason }
2910
+ });
2911
+ });
2912
+ }
2913
+ /**
2914
+ * kick selected member in the server
2915
+ * @param member The member to kick
2916
+ * @returns A promise that resolves when the member is kicked
2917
+ */
2918
+ kick(member) {
2919
+ return __async(this, null, function* () {
2920
+ const id = this.resolveId(member);
2921
+ if (!id) {
2922
+ throw new TypeError("INVALID_TYPE");
2923
+ }
2924
+ yield this.client.api.delete(`/servers/${this.server.id}/members/${id}`);
2925
+ });
2926
+ }
2927
+ /**
2928
+ * unban selected member in the server
2929
+ * @param member The member to unban
2930
+ * @returns A promise that resolves when the member is unbanned
2931
+ */
2932
+ unban(member) {
2933
+ return __async(this, null, function* () {
2934
+ const id = this.resolveId(member);
2935
+ if (!id) {
2936
+ throw new TypeError("INVALID_TYPE");
2937
+ }
2938
+ yield this.client.api.delete(`/servers/${this.server.id}/bans/${id}`);
2939
+ });
2940
+ }
2941
+ fetch(member) {
2942
+ return __async(this, null, function* () {
2943
+ if (typeof member !== "undefined") {
2944
+ const id = this.resolveId(member);
2945
+ if (!id) {
2946
+ throw new TypeError("INVALID_TYPE");
2947
+ }
2948
+ const data = yield this.client.api.get(
2949
+ `/servers/${this.server.id}/members/${id}`
2950
+ );
2951
+ return this._add(data);
2952
+ }
2953
+ const { users, members } = yield this.client.api.get(`/servers/${this.server.id}/members`);
2954
+ users.reduce((coll, cur) => {
2955
+ const user = this.client.users._add(cur);
2956
+ coll.set(user.id, user);
2957
+ return coll;
2958
+ }, this.client.users.cache);
2959
+ return members.reduce((coll, cur) => {
2960
+ const member2 = this._add(cur);
2961
+ coll.set(member2.id, member2);
2962
+ return coll;
2963
+ }, /* @__PURE__ */ new Map());
2964
+ });
2965
+ }
2966
+ /**
2967
+ * resolves a member from a string or a member object
2968
+ * @param member The member to resolve
2969
+ * @returns The id of the member or null if it cannot be resolved
2970
+ */
2971
+ resolveId(member) {
2972
+ if (member == null) return null;
2973
+ if (member instanceof ServerMember3 || member instanceof User) {
2974
+ return member.id;
2975
+ }
2976
+ if (typeof member === "string") return member;
2977
+ if ("_id" in member) return member._id.user;
2978
+ return null;
2979
+ }
2980
+ };
2981
+ // Annotate the CommonJS export names for ESM import in node:
2982
+ 0 && (module.exports = {
2983
+ BaseManager,
2984
+ ChannelManager,
2985
+ MessageManager,
2986
+ RoleManager,
2987
+ ServerChannelManager,
2988
+ ServerManager,
2989
+ ServerMemberManager,
2990
+ UserManager
2991
+ });
2992
+ //# sourceMappingURL=index.cjs.map