revbot.js 0.0.14 → 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-D44PqKGb.d.ts +2386 -0
  264. package/dist/index-XkxTx7UU.d.cts +2386 -0
  265. package/dist/index.cjs +2 -1
  266. package/dist/index.cjs.map +1 -0
  267. package/dist/index.d.cts +11 -2624
  268. package/dist/index.d.ts +11 -2624
  269. package/dist/index.js +116 -4465
  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 +14 -4
package/dist/index.js CHANGED
@@ -1,4461 +1,111 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
8
- var __typeError = (msg) => {
9
- throw TypeError(msg);
10
- };
11
- var __pow = Math.pow;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __export = (target, all) => {
26
- for (var name in all)
27
- __defProp(target, name, { get: all[name], enumerable: true });
28
- };
29
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
30
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
31
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
32
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
33
- var __async = (__this, __arguments, generator) => {
34
- return new Promise((resolve, reject) => {
35
- var fulfilled = (value) => {
36
- try {
37
- step(generator.next(value));
38
- } catch (e) {
39
- reject(e);
40
- }
41
- };
42
- var rejected = (value) => {
43
- try {
44
- step(generator.throw(value));
45
- } catch (e) {
46
- reject(e);
47
- }
48
- };
49
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
50
- step((generator = generator.apply(__this, __arguments)).next());
51
- });
52
- };
53
- var __await = function(promise, isYieldStar) {
54
- this[0] = promise;
55
- this[1] = isYieldStar;
56
- };
57
- var __yieldStar = (value) => {
58
- var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
59
- if (obj == null) {
60
- obj = value[__knownSymbol("iterator")]();
61
- method = (k) => it[k] = (x) => obj[k](x);
62
- } else {
63
- obj = obj.call(value);
64
- method = (k) => it[k] = (v) => {
65
- if (isAwait) {
66
- isAwait = false;
67
- if (k === "throw") throw v;
68
- return v;
69
- }
70
- isAwait = true;
71
- return {
72
- done: false,
73
- value: new __await(new Promise((resolve) => {
74
- var x = obj[k](v);
75
- if (!(x instanceof Object)) __typeError("Object expected");
76
- resolve(x);
77
- }), 1)
78
- };
79
- };
80
- }
81
- return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
82
- throw x;
83
- }, "return" in obj && method("return"), it;
84
- };
85
-
86
- // src/managers/baseManager.ts
87
- var BaseManager = class {
88
- constructor(client3) {
89
- this.client = client3;
90
- this.cache = /* @__PURE__ */ new Map();
91
- }
92
- _add(raw) {
93
- if (!this.holds) throw new Error("Holds is not defined");
94
- const obj = new this.holds(this.client, raw);
95
- this.cache.set(obj.id, obj);
96
- return obj;
97
- }
98
- _remove(id) {
99
- this.cache.delete(id);
100
- }
101
- resolve(resolvable) {
102
- var _a;
103
- const id = this.resolveId(resolvable);
104
- if (id) return (_a = this.cache.get(id)) != null ? _a : null;
105
- return null;
106
- }
107
- resolveId(resolvable) {
108
- var _a;
109
- if (resolvable == null) return null;
110
- if (typeof resolvable === "string") return resolvable;
111
- if (this.holds && resolvable instanceof this.holds) return resolvable.id;
112
- const raw = resolvable;
113
- if (typeof raw === "object" && "_id" in raw) (_a = raw._id) != null ? _a : null;
114
- return null;
115
- }
116
- valueOf() {
117
- return this.cache;
118
- }
119
- };
120
-
121
- // src/utils/bitField.ts
122
- var DEFAULT_BIT = 0;
123
- var _BitField = class _BitField {
124
- constructor(bits = DEFAULT_BIT) {
125
- this.bitfield = DEFAULT_BIT;
126
- this.bitfield = this.self.resolve(bits);
127
- }
128
- /**
129
- * Resolves a bitfield or an array of bitfields into a single number.
130
- * @param bit The bitfield or array of bitfields to resolve.
131
- * @returns The resolved bitfield as a number.
132
- */
133
- static resolve(bit) {
134
- if (bit instanceof _BitField) return bit.bitfield;
135
- if (typeof bit === "number" && bit >= DEFAULT_BIT) return bit;
136
- if (Array.isArray(bit)) {
137
- return bit.map((p) => this.resolve(p)).reduce((prev, p) => prev | p, DEFAULT_BIT);
138
- }
139
- if (typeof this.FLAGS[bit] !== "undefined") return this.FLAGS[bit];
140
- throw new Error("BITFIELD_INVALID");
141
- }
142
- /**
143
- * Returns the class that this instance belongs to.
144
- * @returns The class of the bitfield.
145
- */
146
- get self() {
147
- return this.constructor;
148
- }
149
- /**
150
- * Checks if any of the bits in the bitfield are set.
151
- * @param bit The bitfield or array of bitfields to check.
152
- * @returns True if any bits are set, false otherwise.
153
- */
154
- any(bit) {
155
- bit = this.self.resolve(bit);
156
- return (this.bitfield & bit) !== DEFAULT_BIT;
157
- }
158
- /**
159
- * checks if a specific permission is set.
160
- */
161
- has(bit) {
162
- bit = this.self.resolve(bit);
163
- return (this.bitfield & bit) === bit;
164
- }
165
- /**
166
- * Returns an array of all the Permissions that are set in the bitfield.
167
- * @returns An array of flag names.
168
- */
169
- toArray() {
170
- return Object.keys(this.self.FLAGS).filter((bit) => this.has(bit));
171
- }
172
- add(...bits) {
173
- let total = 0;
174
- for (const bit of bits) {
175
- total |= this.self.resolve(bit);
176
- }
177
- if (Object.isFrozen(this)) {
178
- return new this.self(this.bitfield | total);
179
- }
180
- this.bitfield |= total;
181
- return this;
182
- }
183
- remove(...bits) {
184
- let total = 0;
185
- for (const bit of bits) {
186
- total |= this.self.resolve(bit);
187
- }
188
- if (Object.isFrozen(this)) {
189
- return new this.self(this.bitfield & ~total);
190
- }
191
- this.bitfield &= ~total;
192
- return this;
193
- }
194
- freeze() {
195
- return Object.freeze(this);
196
- }
197
- valueOf() {
198
- return this.bitfield;
199
- }
200
- /**
201
- *
202
- * @returns A record of all flags and their boolean values indicating whether they are set.
203
- */
204
- serialize() {
205
- const serialized = {};
206
- for (const [flag, bit] of Object.entries(this.self.FLAGS)) {
207
- serialized[flag] = this.has(bit);
208
- }
209
- return serialized;
210
- }
211
- *[Symbol.iterator]() {
212
- yield* __yieldStar(this.toArray());
213
- }
214
- };
215
- _BitField.FLAGS = {};
216
- var BitField = _BitField;
217
-
218
- // src/struct/base.ts
219
- var Base = class _Base {
220
- /**
221
- * Creates a new Base instance.
222
- *
223
- * @param {client} client - The client instance.
224
- */
225
- constructor(client3) {
226
- this.client = client3;
227
- }
228
- /**
229
- * Compares this object with another to determine if they are equal.
230
- *
231
- * @param {this | null} [obj] - The object to compare with.
232
- * @returns {boolean} `true` if the objects are equal, otherwise `false`.
233
- */
234
- equals(obj) {
235
- if (!obj) return false;
236
- for (const key in obj) {
237
- const a = obj[key], b = this[key];
238
- if (a instanceof _Base && !a.equals(b)) return false;
239
- if (a instanceof BitField && a.bitfield !== b.bitfield)
240
- return false;
241
- if (typeof a === "object" && a !== null) continue;
242
- if (a !== b) return false;
243
- }
244
- return true;
245
- }
246
- /**
247
- * Updates the object with new data and returns a clone of the object.
248
- *
249
- * @param {PartialObject} data - The data to update the object with.
250
- * @param {string[]} [clear] - Fields to clear in the object.
251
- * @returns {this} A clone of the updated object.
252
- */
253
- _update(data, clear) {
254
- const clone = this._clone();
255
- this._patch(data, clear);
256
- return clone;
257
- }
258
- /**
259
- * Patches the object with new data.
260
- *
261
- * @param {PartialObject} data - The data to patch the object with.
262
- * @param {string[]} [_clear] - Fields to clear in the object.
263
- * @returns {this} The updated object.
264
- * @protected
265
- */
266
- _patch(data, _clear) {
267
- if ("id" in data) this.id = data.id;
268
- if ("_id" in data) {
269
- if (typeof data._id === "string") this.id = data._id;
270
- if (typeof data._id === "object") this.id = data._id.user;
271
- }
272
- return this;
273
- }
274
- /**
275
- * Creates a deep clone of the object.
276
- *
277
- * @returns {this} A clone of the object.
278
- */
279
- _clone() {
280
- const clone = Object.assign(Object.create(this), this);
281
- for (const key in clone) {
282
- const prop = clone[key];
283
- if (prop instanceof _Base) clone[key] = prop._clone();
284
- }
285
- return clone;
286
- }
287
- };
288
-
289
- // src/utils/UUID.ts
290
- import { randomBytes } from "crypto";
291
- var _UUID = class _UUID extends null {
292
- static get PROG() {
293
- return randomBytes(1).readUInt8() / 255;
294
- }
295
- static time(now = Date.now()) {
296
- let mod, result = "";
297
- for (let i = this.TIME_LENGTH; i > 0; i--) {
298
- mod = now % this.ENCODING_LENGTH;
299
- result = this.ENCODING.charAt(mod) + result;
300
- now = (now - mod) / this.ENCODING_LENGTH;
301
- }
302
- return result;
303
- }
304
- static hash() {
305
- let result = "";
306
- for (let i = this.RANDOM_LENGTH; i > 0; i--) {
307
- let random = Math.floor(this.PROG * this.ENCODING_LENGTH);
308
- if (random === this.ENCODING_LENGTH) {
309
- random = this.ENCODING_LENGTH - 1;
310
- }
311
- result = this.ENCODING.charAt(random) + result;
312
- }
313
- return result;
314
- }
315
- static generate(timestamp = Date.now()) {
316
- return this.time(timestamp) + this.hash();
317
- }
318
- static timestampOf(id) {
319
- const timestamp = id.slice(0, this.TIME_LENGTH).split("").reverse().reduce((carry, char, index) => {
320
- const encodingIndex = this.ENCODING.indexOf(char);
321
- if (encodingIndex === -1) {
322
- throw new Error("invalid character found: " + char);
323
- }
324
- return carry += encodingIndex * Math.pow(this.ENCODING_LENGTH, index);
325
- }, 0);
326
- return new Date(timestamp);
327
- }
328
- };
329
- _UUID.ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
330
- _UUID.ENCODING_LENGTH = _UUID.ENCODING.length;
331
- _UUID.RANDOM_LENGTH = 16;
332
- _UUID.TIME_LENGTH = 10;
333
- _UUID.TIME_MAX = Math.pow(2, 48) - 1;
334
- var UUID = _UUID;
335
-
336
- // src/utils/constants.ts
337
- var Events = /* @__PURE__ */ ((Events2) => {
338
- Events2["CHANNEL_CREATE"] = "channelCreate";
339
- Events2["CHANNEL_DELETE"] = "channelDelete";
340
- Events2["CHANNEL_UPDATE"] = "channelUpdate";
341
- Events2["DEBUG"] = "debug";
342
- Events2["ERROR"] = "error";
343
- Events2["GROUP_JOIN"] = "groupJoin";
344
- Events2["GROUP_LEAVE"] = "groupLeave";
345
- Events2["MESSAGE"] = "message";
346
- Events2["MESSAGE_DELETE"] = "messageDelete";
347
- Events2["MESSAGE_DELETE_BULK"] = "messageDeleteBulk";
348
- Events2["MESSAGE_UPDATE"] = "messageUpdate";
349
- Events2["MESSAGE_REACT"] = "messageReact";
350
- Events2["MESSAGE_REACT_REMOVE"] = "messageUnreact";
351
- Events2["RAW"] = "raw";
352
- Events2["READY"] = "ready";
353
- Events2["ROLE_CREATE"] = "roleCreate";
354
- Events2["ROLE_DELETE"] = "roleDelete";
355
- Events2["ROLE_UPDATE"] = "roleUpdate";
356
- Events2["SERVER_CREATE"] = "serverCreate";
357
- Events2["SERVER_DELETE"] = "serverDelete";
358
- Events2["SERVER_MEMBER_JOIN"] = "serverMemberJoin";
359
- Events2["SERVER_MEMBER_LEAVE"] = "serverMemberLeave";
360
- Events2["SERVER_MEMBER_UPDATE"] = "serverMemberUpdate";
361
- Events2["SERVER_UPDATE"] = "serverUpdate";
362
- Events2["TYPING_START"] = "typingStart";
363
- Events2["TYPING_STOP"] = "typingStop";
364
- Events2["USER_UPDATE"] = "userUpdate";
365
- return Events2;
366
- })(Events || {});
367
- var WSEvents = /* @__PURE__ */ ((WSEvents2) => {
368
- WSEvents2["AUTHENTICATE"] = "Authenticate";
369
- WSEvents2["AUTHENTICATED"] = "Authenticated";
370
- WSEvents2["BEGIN_TYPING"] = "BeginTyping";
371
- WSEvents2["BULK"] = "Bulk";
372
- WSEvents2["CHANNEL_ACK"] = "ChannelAck";
373
- WSEvents2["CHANNEL_CREATE"] = "ChannelCreate";
374
- WSEvents2["CHANNEL_DELETE"] = "ChannelDelete";
375
- WSEvents2["CHANNEL_GROUP_JOIN"] = "ChannelGroupJoin";
376
- WSEvents2["CHANNEL_GROUP_LEAVE"] = "ChannelGroupLeave";
377
- WSEvents2["CHANNEL_START_TYPING"] = "ChannelStartTyping";
378
- WSEvents2["CHANNEL_STOP_TYPING"] = "ChannelStopTyping";
379
- WSEvents2["CHANNEL_UPDATE"] = "ChannelUpdate";
380
- WSEvents2["END_TYPING"] = "EndTyping";
381
- WSEvents2["ERROR"] = "Error";
382
- WSEvents2["MESSAGE"] = "Message";
383
- WSEvents2["MESSAGE_BULK_DELETE"] = "BulkMessageDelete";
384
- WSEvents2["MESSAGE_DELETE"] = "MessageDelete";
385
- WSEvents2["MESSAGE_UPDATE"] = "MessageUpdate";
386
- WSEvents2["PING"] = "Ping";
387
- WSEvents2["PONG"] = "Pong";
388
- WSEvents2["READY"] = "Ready";
389
- WSEvents2["SERVER_DELETE"] = "ServerDelete";
390
- WSEvents2["SERVER_MEMBER_JOIN"] = "ServerMemberJoin";
391
- WSEvents2["SERVER_MEMBER_LEAVE"] = "ServerMemberLeave";
392
- WSEvents2["SERVER_MEMBER_UPDATE"] = "ServerMemberUpdate";
393
- WSEvents2["SERVER_ROLE_DELETE"] = "ServerRoleDelete";
394
- WSEvents2["SERVER_ROLE_UPDATE"] = "ServerRoleUpdate";
395
- WSEvents2["SERVER_UPDATE"] = "ServerUpdate";
396
- WSEvents2["USER_RELATIONSHIP"] = "UserRelationship";
397
- WSEvents2["USER_UPDATE"] = "UserUpdate";
398
- return WSEvents2;
399
- })(WSEvents || {});
400
- var ChannelTypes = /* @__PURE__ */ ((ChannelTypes2) => {
401
- ChannelTypes2["DM"] = "DM";
402
- ChannelTypes2["GROUP"] = "GROUP";
403
- ChannelTypes2["TEXT"] = "TEXT";
404
- ChannelTypes2["VOICE"] = "VOICE";
405
- ChannelTypes2["NOTES"] = "NOTES";
406
- return ChannelTypes2;
407
- })(ChannelTypes || {});
408
- var DEFAULT_CLIENT_OPTIONS = {
409
- fetchMembers: true,
410
- rest: {
411
- timeout: 15e3,
412
- retries: 3
413
- },
414
- ws: {
415
- heartbeatInterval: 3e4,
416
- reconnect: true
417
- }
418
- };
419
- var wsUrl = "wss://ws.revolt.chat?version=1&format=json";
420
- var apiUrl = "https://api.revolt.chat";
421
- var cdnUrl = "https://cdn.revoltusercontent.com";
422
- var SYSTEM_USER_ID = "0".repeat(UUID.TIME_LENGTH + UUID.RANDOM_LENGTH);
423
-
424
- // src/utils/permissions.ts
425
- var ChannelPermissions = class extends BitField {
426
- constructor(bits) {
427
- super(bits);
428
- }
429
- static resolve(bit) {
430
- return super.resolve(bit);
431
- }
432
- };
433
- ChannelPermissions.FLAGS = {
434
- VIEW_CHANNEL: __pow(1, 0),
435
- SEND_MESSAGE: __pow(1, 22),
436
- MANAGE_MESSAGE: __pow(1, 2),
437
- MANAGE_CHANNEL: __pow(1, 3),
438
- VOICE_CALL: __pow(1, 4),
439
- INVITE_OTHERS: __pow(1, 5),
440
- EMBED_LINKS: __pow(1, 6),
441
- UPLOAD_FILES: __pow(1, 7)
442
- };
443
- var UserPermissions = class extends BitField {
444
- constructor(bits) {
445
- super(bits);
446
- }
447
- static resolve(bit) {
448
- return super.resolve(bit);
449
- }
450
- };
451
- UserPermissions.FLAGS = {
452
- ACCESS: __pow(1, 0),
453
- VIEW_PROFILE: __pow(1, 1),
454
- SEND_MESSAGES: __pow(1, 2),
455
- INVITE: __pow(1, 3)
456
- };
457
- var ServerPermissions = class extends BitField {
458
- constructor(bits) {
459
- super(bits);
460
- }
461
- static resolve(bit) {
462
- return super.resolve(bit);
463
- }
464
- };
465
- ServerPermissions.FLAGS = {
466
- VIEW_SERVER: __pow(1, 0),
467
- MANAGE_ROLES: __pow(1, 1),
468
- MANAGE_CHANNELS: __pow(1, 2),
469
- MANAGE_SERVER: __pow(1, 3),
470
- KICK_MEMBERS: __pow(1, 4),
471
- BAN_MEMBERS: __pow(1, 5),
472
- CHANGE_NICKNAME: __pow(1, 12),
473
- MANAGE_NICKNAMES: __pow(1, 13),
474
- CHANGE_AVATAR: __pow(1, 14),
475
- REMOVE_AVATARS: __pow(1, 15)
476
- };
477
- var FullPermissions = class extends BitField {
478
- constructor(bits) {
479
- super(bits);
480
- }
481
- static resolve(bit) {
482
- return super.resolve(bit);
483
- }
484
- };
485
- FullPermissions.FLAGS = {
486
- // * Generic permissions
487
- /// Manage the channel or channels on the server
488
- ManageChannel: __pow(2, 0),
489
- /// Manage the server
490
- ManageServer: __pow(2, 1),
491
- /// Manage permissions on servers or channels
492
- ManagePermissions: __pow(2, 2),
493
- /// Manage roles on server
494
- ManageRole: __pow(2, 3),
495
- /// Manage server customisation (includes emoji)
496
- ManageCustomisation: __pow(2, 4),
497
- // * Member permissions
498
- /// Kick other members below their ranking
499
- KickMembers: __pow(2, 6),
500
- /// Ban other members below their ranking
501
- BanMembers: __pow(2, 7),
502
- /// Timeout other members below their ranking
503
- TimeoutMembers: __pow(2, 8),
504
- /// Assign roles to members below their ranking
505
- AssignRoles: __pow(2, 9),
506
- /// Change own nickname
507
- ChangeNickname: __pow(2, 10),
508
- /// Change or remove other's nicknames below their ranking
509
- ManageNicknames: __pow(2, 11),
510
- /// Change own avatar
511
- ChangeAvatar: __pow(2, 12),
512
- /// Remove other's avatars below their ranking
513
- RemoveAvatars: __pow(2, 13),
514
- // * Channel permissions
515
- /// View a channel
516
- ViewChannel: __pow(2, 20),
517
- /// Read a channel's past message history
518
- ReadMessageHistory: __pow(2, 21),
519
- /// Send a message in a channel
520
- SendMessage: __pow(2, 22),
521
- /// Delete messages in a channel
522
- ManageMessages: __pow(2, 23),
523
- /// Manage webhook entries on a channel
524
- ManageWebhooks: __pow(2, 24),
525
- /// Create invites to this channel
526
- InviteOthers: __pow(2, 25),
527
- /// Send embedded content in this channel
528
- SendEmbeds: __pow(2, 26),
529
- /// Send attachments and media in this channel
530
- UploadFiles: __pow(2, 27),
531
- /// Masquerade messages using custom nickname and avatar
532
- Masquerade: __pow(2, 28),
533
- /// React to messages with emoji
534
- React: __pow(2, 29),
535
- // * Voice permissions
536
- /// Connect to a voice channel
537
- Connect: __pow(2, 30),
538
- /// Speak in a voice call
539
- Speak: __pow(2, 31),
540
- /// Share video in a voice call
541
- Video: __pow(2, 32),
542
- /// Mute other members with lower ranking in a voice call
543
- MuteMembers: __pow(2, 33),
544
- /// Deafen other members with lower ranking in a voice call
545
- DeafenMembers: __pow(2, 34),
546
- /// Move members between voice channels
547
- MoveMembers: __pow(2, 35),
548
- // * Mention permissions
549
- /// Mention @everyone or @online
550
- MentionEveryone: __pow(2, 37),
551
- /// Mention a role
552
- MentionRoles: __pow(2, 38),
553
- // * Grant all permissions
554
- /// Safely grant all permissions
555
- GrantAll: 4503599627370495
556
- };
557
- var DEFAULT_PERMISSION_DM = new ChannelPermissions([
558
- "VIEW_CHANNEL",
559
- "VIEW_CHANNEL",
560
- "MANAGE_CHANNEL",
561
- "VOICE_CALL",
562
- "EMBED_LINKS",
563
- "UPLOAD_FILES"
564
- ]).freeze();
565
-
566
- // src/utils/badges.ts
567
- var Badges = class extends BitField {
568
- constructor(bits) {
569
- super(bits);
570
- }
571
- static resolve(bit) {
572
- return super.resolve(bit);
573
- }
574
- };
575
- Badges.FLAGS = {
576
- DEVELOPER: 1 << 0,
577
- TRANSLATOR: 1 << 1,
578
- SUPPORTER: 1 << 2,
579
- RESPONSIBLE_DISCLOSURE: 1 << 3,
580
- REVOLT_TEAM: 1 << 4,
581
- EARLY_ADOPTER: 1 << 8
582
- };
583
-
584
- // src/struct/user.ts
585
- var User = class extends Base {
586
- /**
587
- * Creates a new User instance.
588
- *
589
- * @param {client} client - The client instance.
590
- * @param {APIUser} data - The raw data for the user from the API.
591
- */
592
- constructor(client3, data) {
593
- super(client3);
594
- /** The avatar of the user, or `null` if none is set. */
595
- this.avatar = null;
596
- /** The presence status of the user. */
597
- this.presence = new Presence(this.client);
598
- /** Whether the user is a bot. */
599
- this.bot = false;
600
- this._patch(data);
601
- }
602
- /**
603
- * Updates the user instance with new data from the API.
604
- *
605
- * @param {APIUser} data - The raw data for the user from the API.
606
- * @param {FieldsUser[]} [clear=[]] - Fields to clear in the user.
607
- * @returns {this} The updated user instance.
608
- * @protected
609
- */
610
- _patch(data, clear = []) {
611
- var _a, _b;
612
- super._patch(data);
613
- if (data.username) {
614
- this.username = data.username;
615
- }
616
- if (data.bot) {
617
- this.bot = true;
618
- }
619
- if (typeof data.badges === "number") {
620
- this.badges = new Badges(data.badges).freeze();
621
- }
622
- if (data.avatar) {
623
- this.avatar = new Attachment(this.client, data.avatar);
624
- }
625
- if (data.status) {
626
- this.presence.status = data.status.presence ? (_a = Status[data.status.presence]) != null ? _a : "OFFLINE" /* Invisible */ : "OFFLINE" /* Invisible */;
627
- this.presence.text = (_b = data.status.text) != null ? _b : null;
628
- }
629
- for (const field of clear) {
630
- if (field === "Avatar") this.avatar = null;
631
- if (field === "StatusText") this.presence.text = null;
632
- if (field === "StatusPresence") this.presence.status = "OFFLINE" /* Invisible */;
633
- }
634
- return this;
635
- }
636
- /**
637
- * Gets the creation date of the user.
638
- *
639
- * @returns {Date} The date when the user was created.
640
- */
641
- get createdAt() {
642
- return UUID.timestampOf(this.id);
643
- }
644
- /**
645
- * Gets the creation timestamp of the user in milliseconds.
646
- *
647
- * @returns {number} The timestamp of when the user was created.
648
- */
649
- get createdTimestamp() {
650
- return this.createdAt.getTime();
651
- }
652
- /**
653
- * Blocks the user.
654
- *
655
- * @returns {Promise<void>} A promise that resolves when the user is blocked.
656
- *
657
- * @example
658
- * ```typescript
659
- * await user.block();
660
- * ```
661
- */
662
- block() {
663
- return __async(this, null, function* () {
664
- yield this.client.api.put(`/users/${this.id}/block`);
665
- });
666
- }
667
- /**
668
- * Unblocks the user.
669
- *
670
- * @returns {Promise<void>} A promise that resolves when the user is unblocked.
671
- *
672
- * @example
673
- * ```typescript
674
- * await user.unblock();
675
- * ```
676
- */
677
- unblock() {
678
- return __async(this, null, function* () {
679
- yield this.client.api.delete(`/users/${this.id}/block`);
680
- });
681
- }
682
- /**
683
- * Creates a direct message (DM) channel with the user.
684
- *
685
- * @returns {Promise<DMChannel>} A promise that resolves with the created DM channel.
686
- *
687
- * @example
688
- * ```typescript
689
- * const dmChannel = await user.createDM();
690
- * ```
691
- */
692
- createDM() {
693
- return __async(this, null, function* () {
694
- const data = yield this.client.api.get(`/users/${this.id}/dm`);
695
- return this.client.channels._add(data);
696
- });
697
- }
698
- avatarURL() {
699
- var _a, _b;
700
- if (!((_a = this.avatar) == null ? void 0 : _a.id)) return void 0;
701
- return `${cdnUrl}/avatars/${(_b = this.avatar) == null ? void 0 : _b.id}`;
702
- }
703
- displayAvatarURL() {
704
- return __async(this, null, function* () {
705
- var _a;
706
- const defaultAvatar = `${cdnUrl}/users/${this.id}/default_avatar`;
707
- return (_a = this.avatarURL()) != null ? _a : defaultAvatar;
708
- });
709
- }
710
- /**
711
- * Fetches the latest data for the user from the API.
712
- *
713
- * @param {boolean} [force=false] - Whether to force a fetch even if the user is cached.
714
- * @returns {Promise<User>} A promise that resolves with the updated user instance.
715
- */
716
- fetch(force = false) {
717
- return this.client.users.fetch(this, { force });
718
- }
719
- /**
720
- * Converts the user to a string representation.
721
- *
722
- * @returns {string} A string representation of the user in the format `<@userId>`.
723
- */
724
- toString() {
725
- return `<@${this.id}>`;
726
- }
727
- };
728
-
729
- // src/struct/message.ts
730
- var Message = class extends Base {
731
- /**
732
- * Creates a new Message instance.
733
- *
734
- * @param {client} client - The client instance.
735
- * @param {APIMessage} data - The raw data for the message from the API.
736
- */
737
- constructor(client3, data) {
738
- super(client3);
739
- /** The type of the message (e.g., TEXT, SYSTEM). */
740
- this.type = "TEXT";
741
- /** The content of the message. */
742
- this.content = "";
743
- /** The ID of the channel where the message was sent. */
744
- this.channelId = "";
745
- /** The ID of the user who authored the message. */
746
- this.authorId = "";
747
- /** An array of embeds included in the message. */
748
- this.embeds = [];
749
- /** An array of file attachments included in the message. */
750
- this.attachments = [];
751
- /** Mentions included in the message. */
752
- this.mentions = new Mentions(this, []);
753
- /** The timestamp of when the message was last edited, or `null` if not edited. */
754
- this.editedTimestamp = null;
755
- /** the reactions and count on a message */
756
- this.reactions = /* @__PURE__ */ new Map();
757
- this._patch(data);
758
- }
759
- /**
760
- * Updates the message instance with new data from the API.
761
- *
762
- * @param {APIMessage} data - The raw data for the message from the API.
763
- * @returns {this} The updated message instance.
764
- * @protected
765
- */
766
- _patch(data) {
767
- super._patch(data);
768
- if (Array.isArray(data.embeds)) {
769
- this.embeds = data.embeds;
770
- }
771
- if (Array.isArray(data.attachments)) {
772
- this.attachments = data.attachments;
773
- }
774
- if (Array.isArray(data.mentions)) {
775
- this.mentions = new Mentions(this, data.mentions);
776
- }
777
- if (data.author) {
778
- this.authorId = data.author;
779
- }
780
- if (data.channel) {
781
- this.channelId = data.channel;
782
- }
783
- if (typeof data.content === "string") {
784
- this.content = data.content;
785
- }
786
- if (data.system) {
787
- this.type = data.system.type.toUpperCase();
788
- }
789
- if (data.edited) {
790
- this.editedTimestamp = Date.parse(data.edited);
791
- }
792
- return this;
793
- }
794
- /**
795
- * Gets the creation date of the message.
796
- *
797
- * @returns {Date} The date when the message was created.
798
- */
799
- get createdAt() {
800
- return UUID.timestampOf(this.id);
801
- }
802
- /**
803
- * Gets the creation timestamp of the message in milliseconds.
804
- *
805
- * @returns {number} The timestamp of when the message was created.
806
- */
807
- get createdTimestamp() {
808
- return this.createdAt.getTime();
809
- }
810
- /**
811
- * Gets the date when the message was last edited.
812
- *
813
- * @returns {Date | null} The date of the last edit, or `null` if not edited.
814
- */
815
- get editedAt() {
816
- return this.editedTimestamp ? new Date(this.editedTimestamp) : null;
817
- }
818
- /**
819
- * Checks if the message is a system message.
820
- *
821
- * @returns {boolean} `true` if the message is a system message, otherwise `false`.
822
- */
823
- get system() {
824
- return this.type !== "TEXT";
825
- }
826
- /**
827
- * Retrieves the author of the message.
828
- *
829
- * @returns {User | null} The user who authored the message, or `null` if not found.
830
- */
831
- get author() {
832
- var _a;
833
- return (_a = this.client.users.cache.get(this.authorId)) != null ? _a : null;
834
- }
835
- /**
836
- * Retrieves the channel where the message was sent.
837
- *
838
- * @returns {TextChannel | DMChannel | GroupChannel} The channel instance.
839
- */
840
- get channel() {
841
- return this.client.channels.cache.get(this.channelId);
842
- }
843
- /**
844
- * Retrieves the server ID associated with the message, if any.
845
- *
846
- * @returns {string | null} The server ID, or `null` if the message is not in a server.
847
- */
848
- get serverId() {
849
- const channel = this.channel;
850
- return channel.inServer() ? channel.serverId : null;
851
- }
852
- /**
853
- * Retrieves the server associated with the message, if any.
854
- *
855
- * @returns {Server | null} The server instance, or `null` if not found.
856
- */
857
- get server() {
858
- var _a;
859
- return (_a = this.client.servers.cache.get(this.serverId)) != null ? _a : null;
860
- }
861
- /**
862
- * Retrieves the server member who authored the message, if any.
863
- *
864
- * @returns {ServerMember | null} The server member instance, or `null` if not found.
865
- */
866
- get member() {
867
- var _a, _b;
868
- return (_b = (_a = this.server) == null ? void 0 : _a.members.cache.get(this.authorId)) != null ? _b : null;
869
- }
870
- /**
871
- * Gets the URL of the message.
872
- *
873
- * @returns {string} The URL of the message.
874
- */
875
- get url() {
876
- return `https://app.revolt.chat/${this.serverId ? `server/${this.serverId}` : ""}/channel/${this.channelId}/${this.id}`;
877
- }
878
- /**
879
- * Acknowledges the message.
880
- *
881
- * @returns {Promise<void>} A promise that resolves when the message is acknowledged.
882
- */
883
- ack() {
884
- return this.channel.messages.ack(this);
885
- }
886
- /**
887
- * Deletes the message.
888
- *
889
- * @returns {Promise<void>} A promise that resolves when the message is deleted.
890
- */
891
- delete() {
892
- return this.channel.messages.delete(this);
893
- }
894
- /**
895
- * Replies to the message.
896
- *
897
- * @param {string} content - The content of the reply.
898
- * @param {boolean} [mention=true] - Whether to mention the original message author.
899
- * @returns {Promise<Message>} A promise that resolves with the sent reply message.
900
- */
901
- reply(content, mention = true) {
902
- return this.channel.messages.send(__spreadProps(__spreadValues({}, typeof content === "object" ? content : { content }), {
903
- replies: [{ id: this.id, mention }]
904
- }));
905
- }
906
- /**
907
- * Edits the message.
908
- *
909
- * @param {MessageEditOptions | string} options - The new content or edit options.
910
- * @returns {Promise<void>} A promise that resolves when the message is edited.
911
- */
912
- edit(options) {
913
- return this.channel.messages.edit(this, options);
914
- }
915
- /**
916
- * Fetches the latest data for the message.
917
- *
918
- * @returns {Promise<Message>} A promise that resolves with the updated message instance.
919
- */
920
- fetch() {
921
- return this.channel.messages.fetch(this.id);
922
- }
923
- /**
924
- * Adds a reaction to the message.
925
- *
926
- * @param {string} emoji - The emoji to react with.
927
- * @returns {Promise<void>} A promise that resolves when the reaction is added.
928
- */
929
- addReaction(emoji) {
930
- return this.channel.messages.addReaction(this, emoji);
931
- }
932
- /**
933
- * Removes a reaction from the message.
934
- *
935
- * @param {string} emoji - The emoji to remove the reaction for.
936
- * @param {object} [options] - Options for removing the reaction.
937
- * @param {string} [options.user_id] - The user ID to remove the reaction for. If not provided, removes the reaction for the current user.
938
- * @param {boolean} [options.remove_all=false] - Whether to remove all of the specified reaction for the message.
939
- * @returns {Promise<void>} A promise that resolves when the reaction is removed.
940
- */
941
- removeReaction(emoji, options) {
942
- var _a, _b;
943
- return this.channel.messages.removeReaction(
944
- this,
945
- emoji,
946
- (_a = options == null ? void 0 : options.user_id) != null ? _a : void 0,
947
- (_b = options == null ? void 0 : options.remove_all) != null ? _b : false
948
- );
949
- }
950
- /**
951
- * Removes all reactions from the message.
952
- *
953
- * @returns {Promise<void>} A promise that resolves when all reactions are removed.
954
- */
955
- removeAllReactions() {
956
- return this.channel.messages.removeAllReactions(this);
957
- }
958
- /**
959
- * Checks if the message is in a server.
960
- *
961
- * @returns {boolean} `true` if the message is in a server, otherwise `false`.
962
- */
963
- inServer() {
964
- return this.channel.inServer();
965
- }
966
- /**
967
- * Converts the message to a string representation.
968
- *
969
- * @returns {string} The content of the message.
970
- */
971
- toString() {
972
- return this.content;
973
- }
974
- };
975
-
976
- // src/struct/attachment.ts
977
- var Attachment = class extends Base {
978
- /**
979
- * Creates a new Attachment instance.
980
- *
981
- * @param {client} client - The client instance.
982
- * @param {File} data - The raw data for the attachment from the API.
983
- */
984
- constructor(client3, data) {
985
- super(client3);
986
- this._patch(data);
987
- }
988
- /**
989
- * Updates the attachment instance with new data from the API.
990
- *
991
- * @param {File} data - The raw data for the attachment from the API.
992
- * @returns {this} The updated attachment instance.
993
- * @protected
994
- */
995
- _patch(data) {
996
- super._patch(data);
997
- if (data.filename) this.filename = data.filename;
998
- if (data.content_type) this.type = data.content_type;
999
- if (typeof data.size === "number") this.size = data.size;
1000
- if (data.metadata) this.metadata = data.metadata;
1001
- return this;
1002
- }
1003
- };
1004
-
1005
- // src/struct/presence.ts
1006
- var Status = /* @__PURE__ */ ((Status3) => {
1007
- Status3["Online"] = "ONLINE";
1008
- Status3["Idle"] = "IDLE";
1009
- Status3["Busy"] = "DND";
1010
- Status3["Invisible"] = "OFFLINE";
1011
- return Status3;
1012
- })(Status || {});
1013
- var Presence = class extends Base {
1014
- constructor() {
1015
- super(...arguments);
1016
- /** The custom status text of the user, or `null` if none is set. */
1017
- this.text = null;
1018
- /** The current status of the user (e.g., Online, Idle, Busy, Invisible). */
1019
- this.status = "OFFLINE" /* Invisible */;
1020
- }
1021
- };
1022
-
1023
- // src/struct/server.ts
1024
- var Server2 = class extends Base {
1025
- /**
1026
- * Creates a new Server instance.
1027
- *
1028
- * @param {client} client - The client instance.
1029
- * @param {APIServer} data - The raw data for the server from the API.
1030
- */
1031
- constructor(client3, data) {
1032
- super(client3);
1033
- /** The description of the server, or `null` if none is set. */
1034
- this.description = null;
1035
- /** Manages the members of the server. */
1036
- this.members = new ServerMemberManager(this);
1037
- /** Manages the channels of the server. */
1038
- this.channels = new ServerChannelManager(this);
1039
- /** Manages the roles of the server. */
1040
- this.roles = new RoleManager(this);
1041
- /** The icon of the server, or `null` if none is set. */
1042
- this.icon = null;
1043
- /** The banner of the server, or `null` if none is set. */
1044
- this.banner = null;
1045
- /** Whether analytics are enabled for the server. */
1046
- this.analytics = false;
1047
- /** Whether the server is discoverable. */
1048
- this.discoverable = false;
1049
- /** Whether the server is marked as NSFW (Not Safe For Work). */
1050
- this.nsfw = false;
1051
- /** The categories in the server. */
1052
- this.categories = /* @__PURE__ */ new Map();
1053
- /** the emojies associated with the server */
1054
- this.emojis = /* @__PURE__ */ new Map();
1055
- this._patch(data);
1056
- }
1057
- /**
1058
- * Updates the server instance with new data from the API.
1059
- *
1060
- * @param {APIServer} data - The raw data for the server from the API.
1061
- * @param {FieldsServer[]} [clear=[]] - Fields to clear in the server.
1062
- * @returns {this} The updated server instance.
1063
- * @protected
1064
- */
1065
- _patch(data, clear = []) {
1066
- var _a;
1067
- super._patch(data);
1068
- if (Array.isArray(data.categories)) {
1069
- this.categories.clear();
1070
- for (const cat of data.categories) {
1071
- const category = new Category(this, cat);
1072
- this.categories.set(category.id, category);
1073
- }
1074
- }
1075
- if (data.icon) {
1076
- this.icon = new Attachment(this.client, data.icon);
1077
- }
1078
- if (data.banner) {
1079
- this.banner = new Attachment(this.client, data.banner);
1080
- }
1081
- if (data.owner) {
1082
- this.ownerId = data.owner;
1083
- }
1084
- if (data.name) {
1085
- this.name = data.name;
1086
- }
1087
- if ("description" in data) {
1088
- this.description = (_a = data.description) != null ? _a : null;
1089
- }
1090
- if (Array.isArray(data.channels)) {
1091
- for (const id of data.channels) {
1092
- const channel = this.client.channels.cache.get(id);
1093
- if (channel == null ? void 0 : channel.inServer()) this.channels.cache.set(channel.id, channel);
1094
- }
1095
- }
1096
- if (typeof data.roles === "object") {
1097
- for (const [id, raw] of Object.entries(data.roles)) {
1098
- this.roles._add(Object.assign(raw, { id }));
1099
- }
1100
- }
1101
- if (typeof data.default_permissions === "number") {
1102
- this.permissions = new FullPermissions(data.default_permissions).freeze();
1103
- }
1104
- if (typeof data.analytics === "boolean") this.analytics = data.analytics;
1105
- if (typeof data.discoverable === "boolean") {
1106
- this.discoverable = data.discoverable;
1107
- }
1108
- if (typeof data.nsfw === "boolean") this.nsfw = data.nsfw;
1109
- for (const field of clear) {
1110
- if (field === "Icon") this.icon = null;
1111
- if (field === "Description") this.description = null;
1112
- if (field === "Banner") this.banner = null;
1113
- }
1114
- return this;
1115
- }
1116
- /**
1117
- * Retrieves the current user's member instance in the server.
1118
- *
1119
- * @returns {ServerMember | null} The current user's member instance, or `null` if not found.
1120
- */
1121
- get me() {
1122
- var _a, _b;
1123
- return (_b = this.members.cache.get((_a = this.client.user) == null ? void 0 : _a.id)) != null ? _b : null;
1124
- }
1125
- /**
1126
- * Gets the creation date of the server.
1127
- *
1128
- * @returns {Date} The date when the server was created.
1129
- */
1130
- get createdAt() {
1131
- return UUID.timestampOf(this.id);
1132
- }
1133
- /**
1134
- * Gets the creation timestamp of the server in milliseconds.
1135
- *
1136
- * @returns {number} The timestamp of when the server was created.
1137
- */
1138
- get createdTimestamp() {
1139
- return this.createdAt.getTime();
1140
- }
1141
- /**
1142
- * Retrieves the owner of the server.
1143
- *
1144
- * @returns {User | null} The owner of the server, or `null` if not found.
1145
- */
1146
- get owner() {
1147
- var _a;
1148
- return (_a = this.client.users.cache.get(this.ownerId)) != null ? _a : null;
1149
- }
1150
- // iconURL(options?: { size: number }): string | null {
1151
- // return this.icon
1152
- // ? this.client.api.cdn.icon(this.icon.id, options?.size)
1153
- // : null;
1154
- // }
1155
- // bannerURL(options?: { size: number }): string | null {
1156
- // return this.banner
1157
- // ? this.client.api.cdn.banner(this.banner.id, options?.size)
1158
- // : null;
1159
- // }
1160
- /**
1161
- * Converts the server to a string representation.
1162
- *
1163
- * @returns {string} The name of the server.
1164
- */
1165
- toString() {
1166
- return this.name;
1167
- }
1168
- };
1169
-
1170
- // src/struct/role.ts
1171
- var Role = class extends Base {
1172
- /**
1173
- * Creates a new Role instance.
1174
- *
1175
- * @param {Server} server - The server this role belongs to.
1176
- * @param {APIRole & { id: string }} data - The raw data for the role from the API.
1177
- */
1178
- constructor(server, data) {
1179
- super(server.client);
1180
- this.server = server;
1181
- /** The color of the role, or `null` if no color is set. */
1182
- this.color = null;
1183
- /** Whether the role is displayed separately in the member list. */
1184
- this.hoist = false;
1185
- this._patch(data);
1186
- }
1187
- /**
1188
- * Updates the role instance with new data from the API.
1189
- *
1190
- * @param {APIRole & { _id?: string }} data - The raw data for the role from the API.
1191
- * @param {FieldsRole[]} [clear=[]] - Fields to clear in the role.
1192
- * @returns {this} The updated role instance.
1193
- * @protected
1194
- */
1195
- _patch(data, clear = []) {
1196
- var _a;
1197
- super._patch(data);
1198
- if (data.name) this.name = data.name;
1199
- if (typeof data.hoist === "boolean") this.hoist = data.hoist;
1200
- if (typeof data.rank === "number") this.rank = data.rank;
1201
- if ("colour" in data) this.color = (_a = data.colour) != null ? _a : null;
1202
- if (data.permissions) {
1203
- const { a, d } = data.permissions;
1204
- this.overwrite = {
1205
- allow: new FullPermissions(a),
1206
- deny: new FullPermissions(d)
1207
- };
1208
- }
1209
- for (const field of clear) {
1210
- if (field === "Colour") this.color = null;
1211
- }
1212
- return this;
1213
- }
1214
- /**
1215
- * Gets the date when the role was created.
1216
- *
1217
- * @returns {Date} The creation date of the role.
1218
- */
1219
- get createdAt() {
1220
- return UUID.timestampOf(this.id);
1221
- }
1222
- /**
1223
- * Gets the timestamp of when the role was created.
1224
- *
1225
- * @returns {number} The creation timestamp of the role in milliseconds.
1226
- */
1227
- get createdTimestamp() {
1228
- return this.createdAt.getTime();
1229
- }
1230
- /**
1231
- * Gets the permissions overwrite for the role.
1232
- *
1233
- * @returns {Overwrite} The permissions overwrite for the role.
1234
- */
1235
- get permissions() {
1236
- return this.overwrite;
1237
- }
1238
- /**
1239
- * Deletes the role from the server.
1240
- *
1241
- * @returns {Promise<void>} A promise that resolves when the role is deleted.
1242
- *
1243
- * @example
1244
- * ```typescript
1245
- * await role.delete();
1246
- * console.log("Role deleted successfully.");
1247
- * ```
1248
- */
1249
- delete() {
1250
- return this.server.roles.delete(this);
1251
- }
1252
- edit(data) {
1253
- return this.server.roles.edit(this, data);
1254
- }
1255
- /**
1256
- * Converts the role to a string representation.
1257
- *
1258
- * @returns {string} A string representation of the role in the format `<@&roleId>`.
1259
- */
1260
- toString() {
1261
- return `<@&${this.id}>`;
1262
- }
1263
- };
1264
-
1265
- // src/struct/channel.ts
1266
- var Channel = class extends Base {
1267
- constructor() {
1268
- super(...arguments);
1269
- this.type = "UNKNOWN";
1270
- }
1271
- /**
1272
- * Gets the timestamp (in milliseconds) when the channel was created.
1273
- *
1274
- * @returns {number} The timestamp of the channel's creation.
1275
- */
1276
- get createdTimestamp() {
1277
- return this.createdAt.getTime();
1278
- }
1279
- /**
1280
- * Gets the date and time when the channel was created.
1281
- *
1282
- * @returns {Date} The creation date of the channel.
1283
- */
1284
- get createdAt() {
1285
- return UUID.timestampOf(this.id);
1286
- }
1287
- /**
1288
- * Deletes the current channel instance from the client's channel collection.
1289
- *
1290
- * This method interacts with the client's channel management system to remove
1291
- * the channel. Once deleted, the channel will no longer be accessible through
1292
- * the client.
1293
- *
1294
- * @returns {Promise<void>} A promise that resolves when the channel has been successfully deleted.
1295
- *
1296
- * @example
1297
- * ```typescript
1298
- * const channel = client.channels.get('1234567890');
1299
- * if (channel) {
1300
- * await channel.delete();
1301
- * console.log('Channel deleted successfully.');
1302
- * }
1303
- * ```
1304
- */
1305
- delete() {
1306
- return this.client.channels.delete(this);
1307
- }
1308
- /**
1309
- * Checks if the channel is a text-based channel.
1310
- *
1311
- * @returns {boolean} True if the channel is a text-based channel, otherwise false.
1312
- */
1313
- isText() {
1314
- return "messages" in this;
1315
- }
1316
- /**
1317
- * Checks if the channel is a voice channel.
1318
- *
1319
- * @returns {boolean} True if the channel is a voice channel, otherwise false.
1320
- */
1321
- isVoice() {
1322
- return this.type === "VOICE" /* VOICE */;
1323
- }
1324
- /**
1325
- * Checks if the channel is a group channel.
1326
- *
1327
- * @returns {boolean} True if the channel is a group channel, otherwise false.
1328
- */
1329
- isGroup() {
1330
- return this.type === "GROUP" /* GROUP */;
1331
- }
1332
- /**
1333
- * Checks if the channel is part of a server.
1334
- *
1335
- * @returns {boolean} True if the channel is a server channel, otherwise false.
1336
- */
1337
- inServer() {
1338
- return "serverId" in this;
1339
- }
1340
- /**
1341
- * Converts the channel to a string representation.
1342
- *
1343
- * @returns {string} A string representation of the channel in the format `<#channelId>`.
1344
- */
1345
- toString() {
1346
- return `<#${this.id}>`;
1347
- }
1348
- /**
1349
- * Fetches the latest data for the channel from the client's channel collection.
1350
- *
1351
- * @param {boolean} [force=true] - Whether to force a fetch even if the channel is cached.
1352
- * @returns {Promise<Channel>} A promise that resolves with the updated channel instance.
1353
- */
1354
- fetch(force = true) {
1355
- return this.client.channels.fetch(this, { force });
1356
- }
1357
- };
1358
-
1359
- // src/struct/dmChannel.ts
1360
- var DMChannel3 = class extends Channel {
1361
- /**
1362
- * Creates a new DMChannel instance.
1363
- *
1364
- * @param {client} client - The client instance.
1365
- * @param {APIDirectChannel} data - The raw data for the DM channel from the API.
1366
- */
1367
- constructor(client3, data) {
1368
- super(client3);
1369
- /** The type of the channel, which is always `DM` for direct message channels. */
1370
- this.type = "DM" /* DM */;
1371
- /** The default permissions for the DM channel. */
1372
- this.permissions = DEFAULT_PERMISSION_DM;
1373
- /** Manages the messages in this DM channel. */
1374
- this.messages = new MessageManager(this);
1375
- /** The ID of the last message sent in this DM channel, if any. */
1376
- this.lastMessageId = null;
1377
- this._patch(data);
1378
- }
1379
- /**
1380
- * Updates the DM channel instance with new data from the API.
1381
- *
1382
- * @param {APIDirectChannel} data - The raw data for the DM channel from the API.
1383
- * @returns {this} The updated DM channel instance.
1384
- * @protected
1385
- */
1386
- _patch(data) {
1387
- super._patch(data);
1388
- if (typeof data.active === "boolean") this.active = data.active;
1389
- if (data.last_message_id) this.lastMessageId = data.last_message_id;
1390
- return this;
1391
- }
1392
- /**
1393
- * Retrieves the last message sent in this DM channel.
1394
- *
1395
- * @returns {Message | null} The last message, or `null` if no message exists.
1396
- */
1397
- get lastMessage() {
1398
- var _a;
1399
- if (!this.lastMessageId) return null;
1400
- return (_a = this.messages.cache.get(this.lastMessageId)) != null ? _a : null;
1401
- }
1402
- /**
1403
- * Deletes multiple messages from this DM channel.
1404
- *
1405
- * @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.
1406
- * @returns {Promise<void>} A promise that resolves when the messages have been successfully deleted.
1407
- *
1408
- * @example
1409
- * ```typescript
1410
- * await dmChannel.bulkDelete(10); // Deletes the last 10 messages.
1411
- * ```
1412
- */
1413
- bulkDelete(messages) {
1414
- return this.messages.bulkDelete(messages);
1415
- }
1416
- /**
1417
- * Sends a message to this DM channel.
1418
- *
1419
- * @param {MessageOptions | string} options - The message content or options for the message.
1420
- * @returns {Promise<Message>} A promise that resolves with the sent message.
1421
- *
1422
- * @example
1423
- * ```typescript
1424
- * await dmChannel.send("Hello, world!");
1425
- * ```
1426
- */
1427
- send(options) {
1428
- return this.messages.send(options);
1429
- }
1430
- };
1431
-
1432
- // src/struct/groupChannel.ts
1433
- var GroupChannel2 = class extends Channel {
1434
- /**
1435
- * Creates a new GroupChannel instance.
1436
- *
1437
- * @param {client} client - The client instance.
1438
- * @param {APIGroupChannel} data - The raw data for the group channel from the API.
1439
- */
1440
- constructor(client3, data) {
1441
- super(client3);
1442
- /** The type of the channel, which is always `GROUP` for group channels. */
1443
- this.type = "GROUP" /* GROUP */;
1444
- /** The description of the group channel, if any. */
1445
- this.description = null;
1446
- /** The icon of the group channel, if any. */
1447
- this.icon = null;
1448
- /** Manages the messages in this group channel. */
1449
- this.messages = new MessageManager(this);
1450
- /** The ID of the last message sent in this group channel, if any. */
1451
- this.lastMessageId = null;
1452
- /** A map of user IDs to their corresponding `User` instances in the group channel. */
1453
- this.users = /* @__PURE__ */ new Map();
1454
- /** Whether the group channel is marked as NSFW (Not Safe For Work). */
1455
- this.nsfw = false;
1456
- this._patch(data);
1457
- }
1458
- /**
1459
- * Updates the group channel instance with new data from the API.
1460
- *
1461
- * @param {APIGroupChannel} data - The raw data for the group channel from the API.
1462
- * @returns {this} The updated group channel instance.
1463
- * @protected
1464
- */
1465
- _patch(data) {
1466
- var _a;
1467
- super._patch(data);
1468
- if ("description" in data) {
1469
- this.description = (_a = data.description) != null ? _a : null;
1470
- }
1471
- if (Array.isArray(data.recipients)) {
1472
- this.users.clear();
1473
- for (const userId of data.recipients) {
1474
- const user = this.client.users.cache.get(userId);
1475
- if (user) this.users.set(user.id, user);
1476
- }
1477
- }
1478
- if (typeof data.permissions === "number") {
1479
- this.permissions = new ChannelPermissions(data.permissions).freeze();
1480
- }
1481
- if (data.owner) {
1482
- this.ownerId = data.owner;
1483
- }
1484
- if (data.icon) {
1485
- this.icon = new Attachment(this.client, data.icon);
1486
- }
1487
- if (data.name) {
1488
- this.name = data.name;
1489
- }
1490
- if (data.last_message_id) this.lastMessageId = data.last_message_id;
1491
- if (typeof data.nsfw === "boolean") this.nsfw = data.nsfw;
1492
- return this;
1493
- }
1494
- /**
1495
- * Retrieves the last message sent in this group channel.
1496
- *
1497
- * @returns {Message | null} The last message, or `null` if no message exists.
1498
- */
1499
- get lastMessage() {
1500
- var _a;
1501
- if (!this.lastMessageId) return null;
1502
- return (_a = this.messages.cache.get(this.lastMessageId)) != null ? _a : null;
1503
- }
1504
- /**
1505
- * Retrieves the owner of the group channel.
1506
- *
1507
- * @returns {User | null} The owner of the group channel, or `null` if not found.
1508
- */
1509
- get owner() {
1510
- var _a;
1511
- return (_a = this.client.users.cache.get(this.ownerId)) != null ? _a : null;
1512
- }
1513
- /**
1514
- * Deletes multiple messages from this group channel.
1515
- *
1516
- * @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.
1517
- * @returns {Promise<void>} A promise that resolves when the messages have been successfully deleted.
1518
- *
1519
- * @example
1520
- * ```typescript
1521
- * await groupChannel.bulkDelete(10); // Deletes the last 10 messages.
1522
- * ```
1523
- */
1524
- bulkDelete(messages) {
1525
- return this.messages.bulkDelete(messages);
1526
- }
1527
- /**
1528
- * Creates an invite for the group channel.
1529
- *
1530
- * @returns {Promise<Invite>} A promise that resolves with the created invite.
1531
- *
1532
- * @example
1533
- * ```typescript
1534
- * const invite = await groupChannel.createInvite();
1535
- * console.log(`Invite created: ${invite}`);
1536
- * ```
1537
- */
1538
- createInvite() {
1539
- return __async(this, null, function* () {
1540
- const data = yield this.client.api.post(`/channels/${this.id}/invites`, {});
1541
- return new Invite(
1542
- this.client,
1543
- data
1544
- );
1545
- });
1546
- }
1547
- /**
1548
- * Adds a user to the group channel.
1549
- *
1550
- * @param {UserResolvable} user - The user to add to the group channel.
1551
- * @returns {Promise<void>} A promise that resolves when the user has been successfully added.
1552
- *
1553
- * @example
1554
- * ```typescript
1555
- * await groupChannel.add(user);
1556
- * ```
1557
- */
1558
- add(user) {
1559
- return __async(this, null, function* () {
1560
- const id = this.client.users.resolveId(user);
1561
- if (!id) throw new TypeError("INVALID_TYPE");
1562
- yield this.client.api.put(`/channels/${this.id}/recipients/${id}`);
1563
- });
1564
- }
1565
- /**
1566
- * Removes a user from the group channel.
1567
- *
1568
- * @param {UserResolvable} user - The user to remove from the group channel.
1569
- * @returns {Promise<void>} A promise that resolves when the user has been successfully removed.
1570
- *
1571
- * @example
1572
- * ```typescript
1573
- * await groupChannel.remove(user);
1574
- * ```
1575
- */
1576
- remove(user) {
1577
- return __async(this, null, function* () {
1578
- const id = this.client.users.resolveId(user);
1579
- if (!id) throw new TypeError("INVALID_TYPE");
1580
- yield this.client.api.delete(`/channels/${this.id}/recipients/${id}`);
1581
- });
1582
- }
1583
- /**
1584
- * Leaves the group channel.
1585
- *
1586
- * @returns {Promise<void>} A promise that resolves when the group channel has been successfully left.
1587
- *
1588
- * @example
1589
- * ```typescript
1590
- * await groupChannel.leave();
1591
- * ```
1592
- */
1593
- leave() {
1594
- return super.delete();
1595
- }
1596
- /**
1597
- * Sends a message to this group channel.
1598
- *
1599
- * @param {MessageOptions | string} options - The message content or options for the message.
1600
- * @returns {Promise<Message>} A promise that resolves with the sent message.
1601
- *
1602
- * @example
1603
- * ```typescript
1604
- * await groupChannel.send("Hello, group!");
1605
- * ```
1606
- */
1607
- send(options) {
1608
- return this.messages.send(options);
1609
- }
1610
- // iconURL(options?: { size: number }): string | null {
1611
- // if (!this.icon) return null;
1612
- // return this.client.api.cdn.icon(this.icon.id, options?.size);
1613
- // }
1614
- };
1615
-
1616
- // src/struct/invite.ts
1617
- var Invite = class extends Base {
1618
- /**
1619
- * Creates a new Invite instance.
1620
- *
1621
- * @param {client} client - The client instance.
1622
- * @param {APIInvite} data - The raw data for the invite from the API.
1623
- */
1624
- constructor(client3, data) {
1625
- super(client3);
1626
- /** The ID of the server associated with the invite, if any. */
1627
- this.serverId = null;
1628
- this._patch(data);
1629
- }
1630
- /**
1631
- * Updates the invite instance with new data from the API.
1632
- *
1633
- * @param {APIInvite} data - The raw data for the invite from the API.
1634
- * @returns {this} The updated invite instance.
1635
- * @protected
1636
- */
1637
- _patch(data) {
1638
- super._patch(data);
1639
- if (data.channel) this.channelId = data.channel;
1640
- if (data.creator) this.inviterId = data.channel;
1641
- return this;
1642
- }
1643
- /**
1644
- * Retrieves the server associated with the invite.
1645
- *
1646
- * @returns {Server | null} The server associated with the invite, or `null` if not found.
1647
- */
1648
- get server() {
1649
- var _a;
1650
- return (_a = this.client.servers.cache.get(this.serverId)) != null ? _a : null;
1651
- }
1652
- /**
1653
- * Retrieves the channel associated with the invite.
1654
- *
1655
- * @returns {Channel | null} The channel associated with the invite, or `null` if not found.
1656
- */
1657
- get channel() {
1658
- var _a;
1659
- return (_a = this.client.channels.cache.get(this.channelId)) != null ? _a : null;
1660
- }
1661
- /**
1662
- * Retrieves the user who created the invite.
1663
- *
1664
- * @returns {User | null} The user who created the invite, or `null` if not found.
1665
- */
1666
- get inviter() {
1667
- var _a;
1668
- return (_a = this.client.users.cache.get(this.inviterId)) != null ? _a : null;
1669
- }
1670
- // toString(): string {
1671
- // return this.client.api.cdn.invite(this.id);
1672
- // }
1673
- };
1674
-
1675
- // src/struct/mentions.ts
1676
- var Mentions = class {
1677
- /**
1678
- * Creates a new Mentions instance.
1679
- *
1680
- * @param {Message} message - The message associated with the mentions.
1681
- * @param {string[]} _users - An array of user IDs mentioned in the message.
1682
- */
1683
- constructor(message, _users) {
1684
- this.message = message;
1685
- this._users = _users;
1686
- this.client = message.client;
1687
- }
1688
- /**
1689
- * Checks if a specific user is mentioned in the message.
1690
- *
1691
- * @param {UserResolvable} user - The user to check.
1692
- * @returns {boolean} `true` if the user is mentioned, otherwise `false`.
1693
- * @throws {TypeError} Throws an error if the user cannot be resolved.
1694
- *
1695
- * @example
1696
- * ```typescript
1697
- * if (mentions.has(someUser)) {
1698
- * console.log("User is mentioned!");
1699
- * }
1700
- * ```
1701
- */
1702
- has(user) {
1703
- const id = this.client.users.resolveId(user);
1704
- if (!id) throw new TypeError("INVALID_TYPE");
1705
- return this._users.includes(id);
1706
- }
1707
- /**
1708
- * Retrieves the server members mentioned in the message.
1709
- *
1710
- * @returns {Map<string, ServerMember> | null} A map of user IDs to `ServerMember` instances, or `null` if the message is not in a server.
1711
- *
1712
- * @example
1713
- * ```typescript
1714
- * const members = mentions.members;
1715
- * if (members) {
1716
- * members.forEach(member => console.log(member.displayName));
1717
- * }
1718
- * ```
1719
- */
1720
- get members() {
1721
- const server = this.message.server;
1722
- if (!server) return null;
1723
- const members = /* @__PURE__ */ new Map();
1724
- for (const userId of this._users) {
1725
- const member = server.members.cache.get(userId);
1726
- if (member) members.set(member.id, member);
1727
- }
1728
- return members;
1729
- }
1730
- /**
1731
- * Retrieves the users mentioned in the message.
1732
- *
1733
- * @returns {Map<string, User>} A map of user IDs to `User` instances.
1734
- *
1735
- * @example
1736
- * ```typescript
1737
- * const users = mentions.users;
1738
- * users.forEach(user => console.log(user.username));
1739
- * ```
1740
- */
1741
- get users() {
1742
- const users = /* @__PURE__ */ new Map();
1743
- for (const userId of this._users) {
1744
- const user = this.client.users.cache.get(userId);
1745
- if (user) users.set(user.id, user);
1746
- }
1747
- return users;
1748
- }
1749
- };
1750
-
1751
- // src/struct/messageEmbed.ts
1752
- import { Readable } from "stream";
1753
- import axios from "axios";
1754
- import FormData from "form-data";
1755
- import { File } from "node:buffer";
1756
- var _url, _title, _description, _icon_url, _color, _media;
1757
- var MessageEmbed = class {
1758
- constructor() {
1759
- __privateAdd(this, _url);
1760
- __privateAdd(this, _title);
1761
- __privateAdd(this, _description);
1762
- __privateAdd(this, _icon_url);
1763
- __privateAdd(this, _color);
1764
- __privateAdd(this, _media);
1765
- }
1766
- /**
1767
- * Sets the title of the embed.
1768
- *
1769
- * @param {string} title - The title to set.
1770
- * @returns {this} The updated `MessageEmbed` instance.
1771
- */
1772
- setTitle(title) {
1773
- __privateSet(this, _title, title);
1774
- return this;
1775
- }
1776
- /**
1777
- * Sets the icon URL of the embed.
1778
- *
1779
- * @param {string} iconURL - The URL of the icon to set.
1780
- * @returns {this} The updated `MessageEmbed` instance.
1781
- */
1782
- setIcon(iconURL) {
1783
- __privateSet(this, _icon_url, iconURL);
1784
- return this;
1785
- }
1786
- /**
1787
- * Sets the color of the embed.
1788
- *
1789
- * @param {string} color - The color to set (e.g., a hex code).
1790
- * @returns {this} The updated `MessageEmbed` instance.
1791
- */
1792
- setColor(color) {
1793
- __privateSet(this, _color, color);
1794
- return this;
1795
- }
1796
- /**
1797
- * Sets the description of the embed.
1798
- *
1799
- * @param {string} description - The description to set.
1800
- * @returns {this} The updated `MessageEmbed` instance.
1801
- */
1802
- setDescription(description) {
1803
- __privateSet(this, _description, description);
1804
- return this;
1805
- }
1806
- /**
1807
- * Sets the URL of the embed.
1808
- *
1809
- * @param {string} url - The URL to set.
1810
- * @returns {this} The updated `MessageEmbed` instance.
1811
- */
1812
- setURL(url) {
1813
- __privateSet(this, _url, url);
1814
- return this;
1815
- }
1816
- /**
1817
- * Sets the media (e.g., image or video) of the embed.
1818
- *
1819
- * @param {Readable | string | File} media - The media URL, File or Stream to set.
1820
- * @returns {this} The updated `MessageEmbed` instance.
1821
- */
1822
- setMedia(media) {
1823
- __privateSet(this, _media, media);
1824
- return this;
1825
- }
1826
- /**
1827
- *
1828
- * @param client The client instance used to send the embed.
1829
- * @returns SendableEmbed
1830
- * Converts the embed to a JSON object that can be sent to the API, including media handling.
1831
- */
1832
- toJSONWithMedia(client3) {
1833
- return __async(this, null, function* () {
1834
- const embed = {
1835
- title: __privateGet(this, _title),
1836
- icon_url: __privateGet(this, _icon_url),
1837
- colour: __privateGet(this, _color),
1838
- description: __privateGet(this, _description),
1839
- url: __privateGet(this, _url)
1840
- };
1841
- if (__privateGet(this, _media)) {
1842
- let att = __privateGet(this, _media);
1843
- const data = new FormData();
1844
- if (typeof att === "string") {
1845
- const readableStream = yield axios.get(att, {
1846
- responseType: "stream"
1847
- });
1848
- data.append("file", readableStream.data, {
1849
- filename: att.split("/").pop()
1850
- });
1851
- }
1852
- if (att instanceof Readable) {
1853
- data.append("file", att);
1854
- }
1855
- if (att instanceof File) {
1856
- const buffer = Buffer.from(yield att.arrayBuffer());
1857
- data.append("file", buffer, { filename: att.name });
1858
- }
1859
- yield client3.cdn.post("/attachments", data).then((attachment) => {
1860
- const { id } = attachment;
1861
- embed.media = id;
1862
- });
1863
- }
1864
- return embed;
1865
- });
1866
- }
1867
- /**
1868
- * Converts the embed to a JSON object that can be sent to the API.
1869
- *
1870
- * @returns {SendableEmbed} The JSON representation of the embed.
1871
- */
1872
- toJSON() {
1873
- var _a;
1874
- return {
1875
- title: __privateGet(this, _title),
1876
- icon_url: __privateGet(this, _icon_url),
1877
- colour: __privateGet(this, _color),
1878
- description: __privateGet(this, _description),
1879
- url: __privateGet(this, _url),
1880
- media: (_a = __privateGet(this, _media)) == null ? void 0 : _a.toString()
1881
- };
1882
- }
1883
- };
1884
- _url = new WeakMap();
1885
- _title = new WeakMap();
1886
- _description = new WeakMap();
1887
- _icon_url = new WeakMap();
1888
- _color = new WeakMap();
1889
- _media = new WeakMap();
1890
-
1891
- // src/struct/notesChannel.ts
1892
- var NotesChannel = class extends Channel {
1893
- /**
1894
- * Creates a new NotesChannel instance.
1895
- *
1896
- * @param {client} client - The client instance.
1897
- * @param {APINotesChannel} data - The raw data for the notes channel from the API.
1898
- */
1899
- constructor(client3, data) {
1900
- super(client3);
1901
- /** The type of the channel, which is always `NOTES` for notes channels. */
1902
- this.type = "NOTES" /* NOTES */;
1903
- /** The ID of the last message sent in this notes channel, if any. */
1904
- this.lastMessageId = null;
1905
- /** Manages the messages in this notes channel. */
1906
- this.messages = new MessageManager(this);
1907
- this._patch(data);
1908
- }
1909
- /**
1910
- * Updates the notes channel instance with new data from the API.
1911
- *
1912
- * @param {APINotesChannel} data - The raw data for the notes channel from the API.
1913
- * @returns {this} The updated notes channel instance.
1914
- * @protected
1915
- */
1916
- _patch(data) {
1917
- super._patch(data);
1918
- if (data.user) {
1919
- this.userId = data.user;
1920
- }
1921
- return this;
1922
- }
1923
- /**
1924
- * Sends a message to this notes channel.
1925
- *
1926
- * @param {MessageOptions | string} options - The message content or options for the message.
1927
- * @returns {Promise<Message>} A promise that resolves with the sent message.
1928
- *
1929
- * @example
1930
- * ```typescript
1931
- * await notesChannel.send("This is a saved message.");
1932
- * ```
1933
- */
1934
- send(options) {
1935
- return this.messages.send(options);
1936
- }
1937
- /**
1938
- * Deletes multiple messages from this notes channel.
1939
- *
1940
- * @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.
1941
- * @returns {Promise<void>} A promise that resolves when the messages have been successfully deleted.
1942
- *
1943
- * @example
1944
- * ```typescript
1945
- * await notesChannel.bulkDelete(5); // Deletes the last 5 messages.
1946
- * ```
1947
- */
1948
- bulkDelete(messages) {
1949
- return this.messages.bulkDelete(messages);
1950
- }
1951
- /**
1952
- * Retrieves the last message sent in this notes channel.
1953
- *
1954
- * @returns {Message | null} The last message, or `null` if no message exists.
1955
- */
1956
- get lastMessage() {
1957
- var _a;
1958
- if (!this.lastMessageId) return null;
1959
- return (_a = this.messages.cache.get(this.lastMessageId)) != null ? _a : null;
1960
- }
1961
- /**
1962
- * Retrieves the user associated with this notes channel.
1963
- *
1964
- * @returns {User} The user associated with the notes channel.
1965
- */
1966
- get user() {
1967
- return this.client.user;
1968
- }
1969
- };
1970
-
1971
- // src/struct/serverChannel.ts
1972
- var ServerChannel = class extends Channel {
1973
- /**
1974
- * Creates a new ServerChannel instance.
1975
- *
1976
- * @param {client} client - The client instance.
1977
- * @param {APIServerChannel} data - The raw data for the server channel from the API.
1978
- */
1979
- constructor(client3, data) {
1980
- super(client3);
1981
- /** The description of the channel, or `null` if none is set. */
1982
- this.description = null;
1983
- /** The icon of the channel, or `null` if none is set. */
1984
- this.icon = null;
1985
- /** The permission overwrites for the channel. */
1986
- this.overwrites = /* @__PURE__ */ new Map();
1987
- /** Whether the channel is marked as NSFW (Not Safe For Work). */
1988
- this.nsfw = false;
1989
- this._patch(data);
1990
- }
1991
- /**
1992
- * Updates the server channel instance with new data from the API.
1993
- *
1994
- * @param {APIServerChannel} data - The raw data for the server channel from the API.
1995
- * @param {FieldsChannel[]} [clear=[]] - Fields to clear in the channel.
1996
- * @returns {this} The updated server channel instance.
1997
- * @protected
1998
- */
1999
- _patch(data, clear = []) {
2000
- var _a;
2001
- super._patch(data);
2002
- if (data.name) this.name = data.name;
2003
- if (data.server) this.serverId = data.server;
2004
- if ("description" in data) this.description = (_a = data.description) != null ? _a : null;
2005
- if (data.icon) this.icon = new Attachment(this.client, data.icon);
2006
- if (typeof data.nsfw === "boolean") this.nsfw = data.nsfw;
2007
- if (data.role_permissions) {
2008
- this.overwrites.clear();
2009
- for (const [id, { a, d }] of Object.entries(data.role_permissions)) {
2010
- this.overwrites.set(id, {
2011
- allow: new FullPermissions(a),
2012
- deny: new FullPermissions(d)
2013
- });
2014
- }
2015
- }
2016
- for (const field of clear) {
2017
- if (field === "Icon") this.icon = null;
2018
- if (field === "Description") this.description = null;
2019
- }
2020
- return this;
2021
- }
2022
- /**
2023
- * Creates an invite for the server channel.
2024
- *
2025
- * @returns {Promise<Invite>} A promise that resolves with the created invite.
2026
- *
2027
- * @example
2028
- * ```typescript
2029
- * const invite = await serverChannel.createInvite();
2030
- * console.log(`Invite created: ${invite}`);
2031
- * ```
2032
- */
2033
- createInvite() {
2034
- return __async(this, null, function* () {
2035
- const data = yield this.client.api.post(`/channels/${this.id}/invites`, {});
2036
- return new Invite(
2037
- this.client,
2038
- data
2039
- );
2040
- });
2041
- }
2042
- // iconURL(options?: { size: number }): string | null {
2043
- // return this.icon
2044
- // ? this.client.api.cdn.icon(this.icon.id, options?.size)
2045
- // : null;
2046
- // }
2047
- /**
2048
- * Retrieves the server this channel belongs to.
2049
- *
2050
- * @returns {Server} The server instance.
2051
- */
2052
- get server() {
2053
- return this.client.servers.cache.get(this.serverId);
2054
- }
2055
- /**
2056
- * Retrieves the category this channel belongs to, if any.
2057
- *
2058
- * @returns {Category | null} The category instance, or `null` if the channel is not in a category.
2059
- */
2060
- get category() {
2061
- var _a;
2062
- return (_a = Array.from(this.server.categories.values()).find(
2063
- (cat) => cat.children.has(this.id)
2064
- )) != null ? _a : null;
2065
- }
2066
- };
2067
-
2068
- // src/struct/serverMember.ts
2069
- var ServerMember3 = class extends Base {
2070
- /**
2071
- * Creates a new ServerMember instance.
2072
- *
2073
- * @param {client} client - The client instance.
2074
- * @param {APIMember} data - The raw data for the server member from the API.
2075
- */
2076
- constructor(client3, data) {
2077
- super(client3);
2078
- /** The nickname of the member, or `null` if none is set. */
2079
- this.nickname = null;
2080
- /** The avatar of the member, or `null` if none is set. */
2081
- this.avatar = null;
2082
- /** roles assigned to the member */
2083
- this.roles = [];
2084
- this._patch(data);
2085
- }
2086
- /**
2087
- * Updates the server member instance with new data from the API.
2088
- *
2089
- * @param {APIMember} data - The raw data for the server member from the API.
2090
- * @param {FieldsMember[]} [clear=[]] - Fields to clear in the server member.
2091
- * @returns {this} The updated server member instance.
2092
- * @protected
2093
- */
2094
- _patch(data, clear = []) {
2095
- var _a;
2096
- super._patch(data);
2097
- if ("nickname" in data) {
2098
- this.nickname = (_a = data.nickname) != null ? _a : null;
2099
- }
2100
- if (data.avatar) {
2101
- this.avatar = new Attachment(this.client, data.avatar);
2102
- }
2103
- if (data._id) {
2104
- this.serverId = data._id.server;
2105
- this.id = data._id.user;
2106
- }
2107
- if (Array.isArray(data.roles)) {
2108
- if (!data.roles.length) this.roles = [];
2109
- else {
2110
- this.roles = data.roles.map((roleId) => {
2111
- const role = this.server.roles.cache.get(roleId);
2112
- if (!role) {
2113
- throw new Error(
2114
- `Role with ID ${roleId} not found in server ${this.serverId}`
2115
- );
2116
- }
2117
- return role;
2118
- });
2119
- }
2120
- }
2121
- for (const field of clear) {
2122
- if (field === "Avatar") this.avatar = null;
2123
- if (field === "Nickname") this.nickname = null;
2124
- }
2125
- return this;
2126
- }
2127
- /**
2128
- * Sets the nickname of the server member.
2129
- *
2130
- * @param {string} [nickname] - The new nickname to set, or `undefined` to clear the nickname.
2131
- * @returns {Promise<this>} A promise that resolves with the updated server member instance.
2132
- *
2133
- * @example
2134
- * ```typescript
2135
- * await member.setNickname("NewNickname");
2136
- * ```
2137
- */
2138
- setNickname(nickname) {
2139
- return __async(this, null, function* () {
2140
- yield this.server.members.edit(this, { nickname });
2141
- return this;
2142
- });
2143
- }
2144
- /**
2145
- * adds a role to the server member.
2146
- * @param roleId - The ID of the role to add to the member.
2147
- * @returns
2148
- */
2149
- addRole(roleId) {
2150
- return __async(this, null, function* () {
2151
- const currentRoles = this.roles.map((role) => role.id);
2152
- if (currentRoles.includes(roleId)) {
2153
- return this;
2154
- }
2155
- yield this.server.members.edit(this, {
2156
- roles: [...currentRoles, roleId]
2157
- });
2158
- return this;
2159
- });
2160
- }
2161
- /**
2162
- * Removes a role from the server member.
2163
- *
2164
- * @param {string} roleId - The ID of the role to remove from the member.
2165
- * @returns {Promise<this>} A promise that resolves with the updated server member instance.
2166
- *
2167
- * @example
2168
- * ```typescript
2169
- * await member.removeRole("roleId");
2170
- * ```
2171
- */
2172
- removeRole(roleId) {
2173
- return __async(this, null, function* () {
2174
- const currentRoles = this.roles.map((role) => role.id);
2175
- if (!currentRoles.includes(roleId)) {
2176
- return this;
2177
- }
2178
- yield this.server.members.edit(this, {
2179
- roles: currentRoles.filter((id) => id !== roleId)
2180
- });
2181
- return this;
2182
- });
2183
- }
2184
- /**
2185
- * Bans the server member.
2186
- *
2187
- * @param {string} [reason] - The reason for the ban.
2188
- * @returns {Promise<void>} A promise that resolves when the member is banned.
2189
- *
2190
- * @example
2191
- * ```typescript
2192
- * await member.ban("Violation of rules");
2193
- * ```
2194
- */
2195
- ban(reason) {
2196
- return this.server.members.ban(this, reason);
2197
- }
2198
- /**
2199
- * Kicks the server member.
2200
- *
2201
- * @returns {Promise<void>} A promise that resolves when the member is kicked.
2202
- *
2203
- * @example
2204
- * ```typescript
2205
- * await member.kick();
2206
- * ```
2207
- */
2208
- kick() {
2209
- return this.server.members.kick(this);
2210
- }
2211
- /**
2212
- * Leaves the server.
2213
- *
2214
- * @returns {Promise<void>} A promise that resolves when the member leaves the server.
2215
- *
2216
- * @example
2217
- * ```typescript
2218
- * await member.leave();
2219
- * ```
2220
- */
2221
- leave() {
2222
- return this.client.servers.delete(this.serverId);
2223
- }
2224
- // async displayAvatarURL(options?: { size: number }): Promise<string> {
2225
- // return await this.user.displayAvatarURL(options);
2226
- // }
2227
- /**
2228
- * Retrieves the user associated with this server member.
2229
- *
2230
- * @returns {User} The user instance.
2231
- */
2232
- get user() {
2233
- return this.client.users.cache.get(this.id);
2234
- }
2235
- /**
2236
- * Retrieves the server this member belongs to.
2237
- *
2238
- * @returns {Server} The server instance.
2239
- */
2240
- get server() {
2241
- return this.client.servers.cache.get(this.serverId);
2242
- }
2243
- /**
2244
- * Converts the server member to a string representation.
2245
- *
2246
- * @returns {string} A string representation of the server member in the format `<@userId>`.
2247
- */
2248
- toString() {
2249
- return `<@${this.id}>`;
2250
- }
2251
- };
2252
-
2253
- // src/struct/textChannel.ts
2254
- var TextChannel2 = class extends ServerChannel {
2255
- /**
2256
- * Creates a new TextChannel instance.
2257
- *
2258
- * @param {client} client - The client instance.
2259
- * @param {APITextChannel} data - The raw data for the text channel from the API.
2260
- */
2261
- constructor(client3, data) {
2262
- super(client3, data);
2263
- /** The ID of the last message sent in this text channel, if any. */
2264
- this.lastMessageId = null;
2265
- /** Manages the messages in this text channel. */
2266
- this.messages = new MessageManager(this);
2267
- /** The type of the channel, which is always `TEXT` for text channels. */
2268
- this.type = "TEXT" /* TEXT */;
2269
- this._patch(data);
2270
- }
2271
- /**
2272
- * Updates the text channel instance with new data from the API.
2273
- *
2274
- * @param {APITextChannel} data - The raw data for the text channel from the API.
2275
- * @returns {this} The updated text channel instance.
2276
- * @protected
2277
- */
2278
- _patch(data) {
2279
- super._patch(data);
2280
- if (data.last_message_id) this.lastMessageId = data.last_message_id;
2281
- return this;
2282
- }
2283
- /**
2284
- * Retrieves the last message sent in this text channel.
2285
- *
2286
- * @returns {Message | null} The last message, or `null` if no message exists.
2287
- */
2288
- get lastMessage() {
2289
- var _a;
2290
- if (!this.lastMessageId) return null;
2291
- return (_a = this.messages.cache.get(this.lastMessageId)) != null ? _a : null;
2292
- }
2293
- /**
2294
- * Sends a message to this text channel.
2295
- *
2296
- * @param {MessageOptions | string} options - The message content or options for the message.
2297
- * @returns {Promise<Message>} A promise that resolves with the sent message.
2298
- *
2299
- * @example
2300
- * ```typescript
2301
- * await textChannel.send("Hello, world!");
2302
- * ```
2303
- */
2304
- send(options) {
2305
- return this.messages.send(options);
2306
- }
2307
- /**
2308
- * Deletes multiple messages from this text channel.
2309
- *
2310
- * @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.
2311
- * @returns {Promise<void>} A promise that resolves when the messages have been successfully deleted.
2312
- *
2313
- * @example
2314
- * ```typescript
2315
- * await textChannel.bulkDelete(10); // Deletes the last 10 messages.
2316
- * ```
2317
- */
2318
- bulkDelete(messages) {
2319
- return this.messages.bulkDelete(messages);
2320
- }
2321
- };
2322
-
2323
- // src/struct/voiceChannels.ts
2324
- var VoiceChannel = class extends ServerChannel {
2325
- /**
2326
- * Creates a new VoiceChannel instance.
2327
- *
2328
- * @param {client} client - The client instance.
2329
- * @param {APIVoiceChannel} data - The raw data for the voice channel from the API.
2330
- */
2331
- constructor(client3, data) {
2332
- super(client3, data);
2333
- /** The type of the channel, which is always `VOICE` for voice channels. */
2334
- this.type = "VOICE" /* VOICE */;
2335
- this._patch(data);
2336
- }
2337
- /**
2338
- * Updates the voice channel instance with new data from the API.
2339
- *
2340
- * @param {APIVoiceChannel} data - The raw data for the voice channel from the API.
2341
- * @returns {this} The updated voice channel instance.
2342
- * @protected
2343
- */
2344
- _patch(data) {
2345
- super._patch(data);
2346
- return this;
2347
- }
2348
- /**
2349
- * Acknowledges the voice channel.
2350
- *
2351
- * @throws {TypeError} Throws an error because voice channels cannot be acknowledged.
2352
- *
2353
- * @example
2354
- * ```typescript
2355
- * try {
2356
- * await voiceChannel.ack();
2357
- * } catch (error) {
2358
- * console.error(error.message); // "Cannot ack voice channel"
2359
- * }
2360
- * ```
2361
- */
2362
- ack() {
2363
- throw new TypeError("Cannot ack voice channel");
2364
- }
2365
- };
2366
-
2367
- // src/struct/category.ts
2368
- var Category = class extends Base {
2369
- /**
2370
- * Creates a new Category instance.
2371
- *
2372
- * @param {Server} server - The server this category belongs to.
2373
- * @param {APICategory} data - The raw data for the category from the API.
2374
- */
2375
- constructor(server, data) {
2376
- super(server.client);
2377
- this.server = server;
2378
- /** An array of channel IDs that belong to this category. */
2379
- this._children = [];
2380
- this._patch(data);
2381
- }
2382
- /**
2383
- * Updates the category instance with new data from the API.
2384
- *
2385
- * @param {APICategory} data - The raw data for the category from the API.
2386
- * @returns {this} The updated category instance.
2387
- * @protected
2388
- */
2389
- _patch(data) {
2390
- super._patch(data);
2391
- if (data.title) {
2392
- this.name = data.title;
2393
- }
2394
- if (Array.isArray(data.channels)) {
2395
- this._children = data.channels;
2396
- }
2397
- return this;
2398
- }
2399
- /**
2400
- * Retrieves the channels that belong to this category.
2401
- *
2402
- * @returns {Map<string, ServerChannel>} A map of channel IDs to their corresponding `ServerChannel` instances.
2403
- */
2404
- get children() {
2405
- const coll = /* @__PURE__ */ new Map();
2406
- for (const childId of this._children) {
2407
- const child = this.server.channels.cache.get(childId);
2408
- if (child) coll.set(child.id, child);
2409
- }
2410
- return coll;
2411
- }
2412
- /**
2413
- * Converts the category to a string representation.
2414
- *
2415
- * @returns {string} The name of the category.
2416
- */
2417
- toString() {
2418
- return this.name;
2419
- }
2420
- };
2421
-
2422
- // src/struct/emoji.ts
2423
- var Emoji2 = class extends Base {
2424
- /**
2425
- * Creates a new Emoji instance.
2426
- *
2427
- * @param {client} client - The client instance.
2428
- * @param {Emoji} data - The raw data for the emoji.
2429
- */
2430
- constructor(client3, data) {
2431
- super(client3);
2432
- /** The parent object of the emoji, which can be a server or other entity. */
2433
- this.parent = null;
2434
- /** The ID of the user who created the emoji, or `null` if not available. */
2435
- this.creator_id = null;
2436
- /** The name of the emoji, or `null` if not set. */
2437
- this.name = null;
2438
- this._patch(data);
2439
- }
2440
- /**
2441
- * Retrieves the user who created the emoji.
2442
- *
2443
- * @returns {User | null} The creator of the emoji, or `null` if not found.
2444
- */
2445
- get creator() {
2446
- var _a;
2447
- return (_a = this.client.users.cache.get(this.creator_id)) != null ? _a : null;
2448
- }
2449
- /**
2450
- * Retrieves the server associated with the emoji, if any.
2451
- *
2452
- * @returns {Server | null} The server instance, or `null` if the emoji is not associated with a server.
2453
- */
2454
- get server() {
2455
- var _a;
2456
- if (!this.parent) return null;
2457
- return (_a = this.client.servers.cache.get(this.parent.id)) != null ? _a : null;
2458
- }
2459
- };
2460
-
2461
- // src/managers/channelManager.ts
2462
- var ChannelManager = class extends BaseManager {
2463
- constructor() {
2464
- super(...arguments);
2465
- this.holds = null;
2466
- }
2467
- _add(data) {
2468
- let channel;
2469
- switch (data.channel_type) {
2470
- case "TextChannel":
2471
- channel = new TextChannel2(this.client, data);
2472
- break;
2473
- case "VoiceChannel":
2474
- channel = new VoiceChannel(this.client, data);
2475
- break;
2476
- case "DirectMessage":
2477
- channel = new DMChannel3(this.client, data);
2478
- break;
2479
- case "Group":
2480
- channel = new GroupChannel2(this.client, data);
2481
- break;
2482
- case "SavedMessages":
2483
- channel = new NotesChannel(this.client, data);
2484
- if (this.client.user) this.client.user.notes = channel;
2485
- break;
2486
- default:
2487
- throw new Error(`Unknown Channel Type: ${data}`);
2488
- }
2489
- this.cache.set(channel.id, channel);
2490
- return channel;
2491
- }
2492
- _remove(id) {
2493
- var _a;
2494
- const channel = this.cache.get(id);
2495
- if (channel == null ? void 0 : channel.inServer()) {
2496
- (_a = channel.server) == null ? void 0 : _a.channels.cache.delete(id);
2497
- }
2498
- super._remove(id);
2499
- }
2500
- /**
2501
- * used to delete a channel
2502
- *
2503
- * @param channel The channel to delete
2504
- * @returns A promise that resolves when the channel is deleted
2505
- */
2506
- delete(channel) {
2507
- return __async(this, null, function* () {
2508
- const id = this.resolveId(channel);
2509
- if (!id) {
2510
- throw new TypeError("INVALID_TYPE");
2511
- }
2512
- yield this.client.api.delete(`/channels/${id}`);
2513
- });
2514
- }
2515
- /**
2516
- * used to fetch a channel
2517
- *
2518
- * @param channel The channel to fetch
2519
- * @param force Whether to force fetch the channel using the api or return it form cache if able
2520
- * @returns A promise that resolves with the fetched channel
2521
- */
2522
- fetch(_0) {
2523
- return __async(this, arguments, function* (channel, { force = true } = {}) {
2524
- const id = this.resolveId(channel);
2525
- if (!id) {
2526
- throw new TypeError("INVALID_TYPE");
2527
- }
2528
- if (!force) {
2529
- const channel2 = this.cache.get(id);
2530
- if (channel2) return channel2;
2531
- }
2532
- const data = yield this.client.api.get(`/channels/${id}`);
2533
- return this._add(data);
2534
- });
2535
- }
2536
- /**
2537
- * resolves a channel from a string or a channel object
2538
- * @param channel The channel to resolve
2539
- * @returns the resolved channel or null if not found
2540
- */
2541
- resolve(channel) {
2542
- if (channel instanceof Channel) return channel;
2543
- return super.resolve(channel);
2544
- }
2545
- /**
2546
- * resolves a channel id from a string or a channel object
2547
- * @param channel The channel to resolve
2548
- * @returns the resolved channel id or null if not found
2549
- */
2550
- resolveId(channel) {
2551
- if (channel instanceof Channel) return channel.id;
2552
- return super.resolveId(channel);
2553
- }
2554
- };
2555
-
2556
- // src/managers/serverManager.ts
2557
- var ServerManager = class extends BaseManager {
2558
- constructor() {
2559
- super(...arguments);
2560
- this.holds = Server2;
2561
- }
2562
- _remove(id) {
2563
- var _a;
2564
- const server = this.cache.get(id);
2565
- for (const id2 of (_a = server == null ? void 0 : server.channels.cache.keys()) != null ? _a : []) {
2566
- this.client.channels._remove(id2);
2567
- }
2568
- return super._remove(id);
2569
- }
2570
- /**
2571
- * edits a server
2572
- * @param server The server to edit
2573
- * @param options The options to edit the server with
2574
- * @param options.name The name of the server
2575
- * @param options.description The description of the server
2576
- * @returns A promise that resolves when the server is edited
2577
- */
2578
- edit(server, options) {
2579
- return __async(this, null, function* () {
2580
- const id = this.resolveId(server);
2581
- if (!id) throw new TypeError("INVALID_TYPE");
2582
- yield this.client.api.patch(`/servers/${id}`, { body: options });
2583
- });
2584
- }
2585
- /**
2586
- * leaves a server
2587
- * @param server the server to leave
2588
- */
2589
- delete(server) {
2590
- return __async(this, null, function* () {
2591
- const id = this.resolveId(server);
2592
- if (!id) throw new TypeError("INVALID_TYPE");
2593
- yield this.client.api.delete(`/servers/${id}`);
2594
- });
2595
- }
2596
- fetch(_0) {
2597
- return __async(this, arguments, function* (server, { force = true } = {}) {
2598
- const id = this.resolveId(server);
2599
- if (!id) throw new TypeError("INVALID_TYPE");
2600
- if (!force) {
2601
- const server2 = this.cache.get(id);
2602
- if (server2) return server2;
2603
- }
2604
- const data = yield this.client.api.get(`/servers/${id}`);
2605
- return this._add(data);
2606
- });
2607
- }
2608
- };
2609
-
2610
- // src/managers/userManager.ts
2611
- var UserManager = class extends BaseManager {
2612
- constructor() {
2613
- super(...arguments);
2614
- this.holds = User;
2615
- }
2616
- /**
2617
- *
2618
- * @param user The user to fetch
2619
- * @returns A promise that resolves when the user is fetched
2620
- */
2621
- fetch(_0) {
2622
- return __async(this, arguments, function* (user, { force = false } = {}) {
2623
- const id = this.resolveId(user);
2624
- if (!id) throw new TypeError("INVALID_TYPE");
2625
- if (!force) {
2626
- const user2 = this.cache.get(id);
2627
- if (user2) return user2;
2628
- }
2629
- const data = yield this.client.api.get(`/users/${id}`);
2630
- return this._add(data);
2631
- });
2632
- }
2633
- resolve(resolvable) {
2634
- if (resolvable instanceof Message) return resolvable.author;
2635
- return super.resolve(resolvable);
2636
- }
2637
- /**
2638
- * get a user id form cache
2639
- * @param resolvable The user to resolve
2640
- * @returns The user id or null if it cannot be resolved
2641
- */
2642
- resolveId(resolvable) {
2643
- if (resolvable instanceof Message) return resolvable.authorId;
2644
- return super.resolveId(resolvable);
2645
- }
2646
- };
2647
-
2648
- // src/managers/messageManager.ts
2649
- import { File as File2 } from "node:buffer";
2650
- import { Readable as Readable2 } from "stream";
2651
- import FormData2 from "form-data";
2652
- import axios2 from "axios";
2653
- var MessageManager = class extends BaseManager {
2654
- constructor(channel) {
2655
- super(channel.client);
2656
- this.channel = channel;
2657
- this.holds = Message;
2658
- }
2659
- /**
2660
- *
2661
- * @param content The content to send. Can be a string or an object with the following properties:
2662
- * - content: The content of the message
2663
- * - replies: An array of message IDs to reply to
2664
- * - attachments: An array of attachment URLs, Files, or ReadStreams
2665
- * - embeds: An array of MessageEmbed objects
2666
- * @returns Promise that resolves to the sent message
2667
- */
2668
- send(content) {
2669
- return __async(this, null, function* () {
2670
- if (typeof content === "string") content = { content };
2671
- let attachments = [];
2672
- let embeds = [];
2673
- if (Array.isArray(content.attachments)) {
2674
- const promises = content.attachments.map((att) => __async(this, null, function* () {
2675
- const data = new FormData2();
2676
- if (typeof att === "string") {
2677
- const readableStream = yield axios2.get(att, {
2678
- responseType: "stream"
2679
- });
2680
- data.append("file", readableStream.data, {
2681
- filename: att.split("/").pop()
2682
- });
2683
- }
2684
- if (att instanceof Readable2) {
2685
- data.append("file", att);
2686
- }
2687
- if (att instanceof File2) {
2688
- const buffer = Buffer.from(yield att.arrayBuffer());
2689
- data.append("file", buffer, { filename: att.name });
2690
- }
2691
- yield this.client.cdn.post("/attachments", data).then((attachment) => {
2692
- const { id } = attachment;
2693
- attachments.push(id);
2694
- });
2695
- }));
2696
- yield Promise.all(promises);
2697
- }
2698
- if (Array.isArray(content.embeds)) {
2699
- const promises = content.embeds.map((embed) => __async(this, null, function* () {
2700
- const json = yield embed.toJSONWithMedia(this.client);
2701
- embeds.push(json);
2702
- }));
2703
- yield Promise.all(promises);
2704
- }
2705
- const resp = yield this.client.api.post(
2706
- `/channels/${this.channel.id}/messages`,
2707
- {
2708
- body: __spreadProps(__spreadValues({}, content), { attachments, embeds, nonce: UUID.generate() })
2709
- }
2710
- );
2711
- return this._add(resp);
2712
- });
2713
- }
2714
- /**
2715
- * acknowledge a message to mark it as read (not important for bots)
2716
- * @param message The message to acknowledge
2717
- * @returns Promise that resolves when the message is acknowledged
2718
- */
2719
- ack(message) {
2720
- return __async(this, null, function* () {
2721
- const id = this.resolveId(message);
2722
- if (!id) {
2723
- throw new TypeError("INVALID_TYPE");
2724
- }
2725
- yield this.client.api.put(`/channels/${this.channel.id}/ack/${id}`);
2726
- });
2727
- }
2728
- /**
2729
- * bulk delete messages from the channel
2730
- * @param messages The messages to delete. Can be an array of message IDs or a Map of message IDs to Message objects.
2731
- * @returns Promise that resolves when the messages are deleted
2732
- */
2733
- bulkDelete(messages) {
2734
- return __async(this, null, function* () {
2735
- let ids = [];
2736
- if (typeof messages === "number") {
2737
- messages = yield this.fetch(messages);
2738
- ids = messages instanceof Map ? [...messages.keys()] : [];
2739
- } else if (messages instanceof Map) {
2740
- ids = [...messages.keys()];
2741
- } else {
2742
- ids = messages.map((m) => this.resolveId(m)).filter(Boolean);
2743
- }
2744
- yield this.client.api.delete(`/channels/${this.channel.id}/messages/bulk`, {
2745
- body: JSON.stringify({ ids })
2746
- });
2747
- });
2748
- }
2749
- /**
2750
- * delete a message from the channel
2751
- * @param message The message to delete. Can be a Message object or a message ID.
2752
- * @returns Promise that resolves when the message is deleted
2753
- */
2754
- delete(message) {
2755
- return __async(this, null, function* () {
2756
- const id = this.resolveId(message);
2757
- if (!id) {
2758
- throw new TypeError("INVALID_TYPE");
2759
- }
2760
- yield this.client.api.delete(`/channels/${this.channel.id}/messages/${id}`);
2761
- });
2762
- }
2763
- /**
2764
- * edit a message in the channel
2765
- * @param message The message to edit. Can be a Message object or a message ID.
2766
- * @param options The options to edit the message with. Can be a string or an object with the following properties:
2767
- * - content: The new content of the message
2768
- * - attachments: An array of attachment URLs
2769
- * - embeds: An array of MessageEmbed objects
2770
- * @returns Promise that resolves when the message is edited
2771
- */
2772
- edit(message, options) {
2773
- return __async(this, null, function* () {
2774
- const id = this.resolveId(message);
2775
- if (!id) {
2776
- throw new TypeError("INVALID_TYPE");
2777
- }
2778
- if (typeof options === "string") options = { content: options };
2779
- yield this.client.api.patch(`/channels/${this.channel.id}/messages/${id}`, {
2780
- body: options
2781
- });
2782
- });
2783
- }
2784
- /**
2785
- * search for messages in the channel
2786
- * @param query The query to search for. Can be a string or an object with the following properties:
2787
- * - query: The query to search for
2788
- * - limit: The maximum number of messages to return
2789
- * - before: The message ID to start searching from (exclusive)
2790
- * - after: The message ID to stop searching at (exclusive)
2791
- * - sort: The sort order of the results (asc or desc)
2792
- * @returns Promise that resolves to a Map of message IDs to Message objects
2793
- */
2794
- search(query) {
2795
- return __async(this, null, function* () {
2796
- if (typeof query === "string") query = { query };
2797
- const response = yield this.client.api.post(
2798
- `/channels/${this.channel.id}/search`,
2799
- {
2800
- query
2801
- }
2802
- );
2803
- return response.reduce((coll, cur) => {
2804
- const msg = this._add(cur);
2805
- coll.set(msg.id, msg);
2806
- return coll;
2807
- }, /* @__PURE__ */ new Map());
2808
- });
2809
- }
2810
- fetch(query) {
2811
- return __async(this, null, function* () {
2812
- const id = this.resolveId(query);
2813
- if (id) {
2814
- const data = yield this.client.api.get(
2815
- `/channels/${this.channel.id}/messages/${id}`
2816
- );
2817
- return this._add(data);
2818
- }
2819
- if (typeof query === "number") query = { limit: query };
2820
- else if (typeof query === "undefined") query = { limit: 100 };
2821
- const messages = yield this.client.api.get(
2822
- `/channels/${this.channel.id}/messages`,
2823
- { query: JSON.stringify(query) }
2824
- );
2825
- return messages.reduce((coll, cur) => {
2826
- const msg = this._add(cur);
2827
- coll.set(msg.id, msg);
2828
- return coll;
2829
- }, /* @__PURE__ */ new Map());
2830
- });
2831
- }
2832
- /**
2833
- * add a reaction to a message
2834
- * @param message The message to react to. Can be a Message object or a message ID.
2835
- * @param emoji emoji to react with. Can be a string or an Emoji object.
2836
- * @returns Promise that resolves when the reaction is added
2837
- */
2838
- addReaction(message, emoji) {
2839
- return __async(this, null, function* () {
2840
- const id = this.resolveId(message);
2841
- if (!id) {
2842
- throw new TypeError("INVALID_TYPE");
2843
- }
2844
- if (emoji instanceof Emoji2) emoji = emoji.id;
2845
- else if (typeof emoji !== "string") {
2846
- throw new TypeError("INVALID_TYPE");
2847
- }
2848
- yield this.client.api.put(
2849
- `/channels/${this.channel.id}/messages/${id}/reactions/${emoji}`
2850
- );
2851
- });
2852
- }
2853
- /**
2854
- *
2855
- * @param message The message to unreact. Can be a Message object or a message ID.
2856
- * @param emoji the emoji to unreact with. Can be a string or an Emoji object.
2857
- * @param user_id The user ID to remove the reaction for. If not provided, removes the reaction for the current user.
2858
- * @param remove_all Whether to remove all of the specified reaction for the message. Defaults to false.
2859
- * @returns Promise that resolves when the reaction is removed
2860
- */
2861
- removeReaction(message, emoji, user_id, remove_all = false) {
2862
- return __async(this, null, function* () {
2863
- const id = this.resolveId(message);
2864
- if (!id) {
2865
- throw new TypeError("INVALID_TYPE");
2866
- }
2867
- if (emoji instanceof Emoji2) emoji = emoji.id;
2868
- else if (typeof emoji !== "string") {
2869
- throw new TypeError("INVALID_TYPE");
2870
- }
2871
- const queryString = user_id ? `?user_id=${user_id}&remove_all=${remove_all}` : `?remove_all=${remove_all}`;
2872
- yield this.client.api.delete(
2873
- `/channels/${this.channel.id}/messages/${id}/reactions/${emoji}${queryString}`
2874
- );
2875
- });
2876
- }
2877
- /**
2878
- * remove all reactions from a message
2879
- * @param message The message to remove reactions from. Can be a Message object or a message ID.
2880
- * @returns Promise that resolves when the reactions are removed
2881
- */
2882
- removeAllReactions(message) {
2883
- return __async(this, null, function* () {
2884
- const id = this.resolveId(message);
2885
- if (!id) {
2886
- throw new TypeError("INVALID_TYPE");
2887
- }
2888
- yield this.client.api.delete(
2889
- `/channels/${this.channel.id}/messages/${id}/reactions`
2890
- );
2891
- });
2892
- }
2893
- };
2894
-
2895
- // src/managers/roleManager.ts
2896
- var RoleManager = class extends BaseManager {
2897
- constructor(server) {
2898
- super(server.client);
2899
- this.server = server;
2900
- this.holds = Role;
2901
- }
2902
- _add(data) {
2903
- const role = new Role(this.server, data);
2904
- this.cache.set(role.id, role);
2905
- return role;
2906
- }
2907
- /**
2908
- * creates a new role in the server
2909
- * @param name The name of the role to create
2910
- * @returns
2911
- */
2912
- create(name) {
2913
- return __async(this, null, function* () {
2914
- const { id, role } = yield this.client.api.post(`/servers/${this.server.id}/roles`, { body: { name } });
2915
- return this._add(Object.assign(role, { id }));
2916
- });
2917
- }
2918
- /**
2919
- * deletes a role from the server
2920
- * @param role the role to delete
2921
- * @returns A promise that resolves when the role is deleted
2922
- */
2923
- delete(role) {
2924
- return __async(this, null, function* () {
2925
- const id = this.resolveId(role);
2926
- if (!id) throw new TypeError("INVALID_TYPE");
2927
- yield this.client.api.delete(`/servers/${this.server.id}/roles/${id}`);
2928
- });
2929
- }
2930
- /**
2931
- *
2932
- * @param role the role to edit
2933
- * @param data data to edit the role with
2934
- * @param data.permissions The permissions to set for the role, in the format { a: allow, d: deny }
2935
- * @param data.name The name of the role
2936
- * @param data.colour The color of the role, or `null` if no color is set
2937
- * @param data.hoist Whether the role is displayed separately in the member list
2938
- * @param data.rank The rank of the role, used for ordering
2939
- * @param data.remove Fields to remove from the role
2940
- * @returns Role
2941
- * @throws {TypeError} If the role ID is invalid
2942
- */
2943
- edit(role, data) {
2944
- return __async(this, null, function* () {
2945
- var _a, _b;
2946
- const id = this.resolveId(role);
2947
- if (!id) throw new TypeError("INVALID_TYPE");
2948
- if (data.permissions) {
2949
- const permissions = {
2950
- allow: new FullPermissions(((_a = data.permissions) == null ? void 0 : _a.a) || []).bitfield,
2951
- deny: new FullPermissions(((_b = data.permissions) == null ? void 0 : _b.d) || []).bitfield
2952
- };
2953
- yield this.client.api.put(
2954
- `/servers/${this.server.id}/permissions/${id}`,
2955
- { body: { permissions } }
2956
- );
2957
- }
2958
- delete data.permissions;
2959
- const updatedRole = yield this.client.api.patch(
2960
- `/servers/${this.server.id}/roles/${id}`,
2961
- { body: data }
2962
- );
2963
- return this._add(Object.assign(updatedRole, { id }));
2964
- });
2965
- }
2966
- };
2967
-
2968
- // src/managers/serverChannelManager.ts
2969
- var ServerChannelManager = class extends BaseManager {
2970
- constructor(server) {
2971
- super(server.client);
2972
- this.server = server;
2973
- this.holds = ServerChannel;
2974
- }
2975
- _add(data) {
2976
- let channel;
2977
- switch (data.channel_type) {
2978
- case "TextChannel":
2979
- channel = new TextChannel2(this.client, data);
2980
- break;
2981
- case "VoiceChannel":
2982
- channel = new VoiceChannel(this.client, data);
2983
- break;
2984
- default:
2985
- throw new Error(
2986
- `Unknown channel type: ${data.channel_type}`
2987
- );
2988
- }
2989
- this.cache.set(channel.id, channel);
2990
- return channel;
2991
- }
2992
- /**
2993
- * creates a new channel in the server
2994
- * @param name The name of the channel to create
2995
- * @param type The type of the channel to create. Can be "Text" or "Voice". Defaults to "Text".
2996
- * @param description The description of the channel to create. Only used for voice channels.
2997
- * @returns A promise that resolves to the created channel
2998
- */
2999
- create(_0) {
3000
- return __async(this, arguments, function* ({
3001
- name,
3002
- type = "Text",
3003
- description
3004
- }) {
3005
- const data = yield this.client.api.post(
3006
- `/servers/${this.server.id}/channels`,
3007
- {
3008
- body: {
3009
- name,
3010
- type,
3011
- description,
3012
- nonce: UUID.generate()
3013
- }
3014
- }
3015
- );
3016
- return this._add(data);
3017
- });
3018
- }
3019
- /**
3020
- * fetch a channel from the server
3021
- * @param channel The channel to fetch. Can be a string, a channel object, or an API channel object.
3022
- * @param force Whether to force fetch the channel from the API. Defaults to true.
3023
- * If set to false, the method will return the channel from the cache if it exists.
3024
- * @returns A promise that resolves to the fetched channel
3025
- */
3026
- fetch(_0) {
3027
- return __async(this, arguments, function* (channel, { force = true } = {}) {
3028
- const id = this.resolveId(channel);
3029
- if (!id) {
3030
- throw new TypeError("INVALID_ID");
3031
- }
3032
- if (!force) {
3033
- const channel2 = this.cache.get(id);
3034
- if (channel2) return channel2;
3035
- }
3036
- const data = yield this.client.api.get(
3037
- `/servers/${this.server.id}/channels/${id}`
3038
- );
3039
- return this._add(data);
3040
- });
3041
- }
3042
- };
3043
-
3044
- // src/managers/serverMemberManager.ts
3045
- var ServerMemberManager = class extends BaseManager {
3046
- constructor(server) {
3047
- super(server.client);
3048
- this.server = server;
3049
- this.holds = ServerMember3;
3050
- }
3051
- /**
3052
- * edit selected member in the server
3053
- * @param member The member to edit
3054
- * @param options The options to edit the member with
3055
- * @param options.nickname The nickname of the member to set
3056
- * @param options.avatar The avatar of the member to set
3057
- * @param options.roles The roles of the member to set
3058
- * @returns A promise that resolves when the member is edited
3059
- */
3060
- edit(member, options) {
3061
- return __async(this, null, function* () {
3062
- const id = this.resolveId(member);
3063
- if (!id) {
3064
- throw new TypeError("INVALID_TYPE");
3065
- }
3066
- yield this.client.api.patch(`/servers/${this.server.id}/members/${id}`, {
3067
- body: __spreadValues({}, options)
3068
- });
3069
- });
3070
- }
3071
- /**
3072
- * ban selected member in the server
3073
- * @param member The member to ban
3074
- * @param reason the reason for the ban
3075
- * @returns A promise that resolves when the member is banned
3076
- */
3077
- ban(member, reason) {
3078
- return __async(this, null, function* () {
3079
- const id = this.resolveId(member);
3080
- if (!id) {
3081
- throw new TypeError("INVALID_TYPE");
3082
- }
3083
- yield this.client.api.put(`/servers/${this.server.id}/bans/${id}`, {
3084
- body: { reason }
3085
- });
3086
- });
3087
- }
3088
- /**
3089
- * kick selected member in the server
3090
- * @param member The member to kick
3091
- * @returns A promise that resolves when the member is kicked
3092
- */
3093
- kick(member) {
3094
- return __async(this, null, function* () {
3095
- const id = this.resolveId(member);
3096
- if (!id) {
3097
- throw new TypeError("INVALID_TYPE");
3098
- }
3099
- yield this.client.api.delete(`/servers/${this.server.id}/members/${id}`);
3100
- });
3101
- }
3102
- /**
3103
- * unban selected member in the server
3104
- * @param member The member to unban
3105
- * @returns A promise that resolves when the member is unbanned
3106
- */
3107
- unban(member) {
3108
- return __async(this, null, function* () {
3109
- const id = this.resolveId(member);
3110
- if (!id) {
3111
- throw new TypeError("INVALID_TYPE");
3112
- }
3113
- yield this.client.api.delete(`/servers/${this.server.id}/bans/${id}`);
3114
- });
3115
- }
3116
- fetch(member) {
3117
- return __async(this, null, function* () {
3118
- if (typeof member !== "undefined") {
3119
- const id = this.resolveId(member);
3120
- if (!id) {
3121
- throw new TypeError("INVALID_TYPE");
3122
- }
3123
- const data = yield this.client.api.get(
3124
- `/servers/${this.server.id}/members/${id}`
3125
- );
3126
- return this._add(data);
3127
- }
3128
- const { users, members } = yield this.client.api.get(`/servers/${this.server.id}/members`);
3129
- users.reduce((coll, cur) => {
3130
- const user = this.client.users._add(cur);
3131
- coll.set(user.id, user);
3132
- return coll;
3133
- }, this.client.users.cache);
3134
- return members.reduce((coll, cur) => {
3135
- const member2 = this._add(cur);
3136
- coll.set(member2.id, member2);
3137
- return coll;
3138
- }, /* @__PURE__ */ new Map());
3139
- });
3140
- }
3141
- /**
3142
- * resolves a member from a string or a member object
3143
- * @param member The member to resolve
3144
- * @returns The id of the member or null if it cannot be resolved
3145
- */
3146
- resolveId(member) {
3147
- if (member == null) return null;
3148
- if (member instanceof ServerMember3 || member instanceof User) {
3149
- return member.id;
3150
- }
3151
- if (typeof member === "string") return member;
3152
- if ("_id" in member) return member._id.user;
3153
- return null;
3154
- }
3155
- };
3156
-
3157
- // src/client/baseClient.ts
3158
- import { EventEmitter } from "node:events";
3159
-
3160
- // src/rest/restClient.ts
3161
- import { AxiosError } from "axios";
3162
-
3163
- // package.json
3164
- var version = "0.0.13";
3165
-
3166
- // src/rest/restUtils/rateLimitQueue.ts
3167
- import axios3 from "axios";
3168
- var RateLimitQueue = class {
3169
- constructor() {
3170
- this.bucketMap = /* @__PURE__ */ new Map();
3171
- this.pathToBucket = /* @__PURE__ */ new Map();
3172
- }
3173
- request(config) {
3174
- return __async(this, null, function* () {
3175
- const path = config.url;
3176
- const bucketId = this.pathToBucket.get(path);
3177
- let bucket = bucketId ? this.bucketMap.get(bucketId) : void 0;
3178
- if (bucket && bucket.remaining <= 0 && Date.now() < bucket.resetAfter) {
3179
- return new Promise((resolve, reject) => {
3180
- bucket.queue.push(() => __async(this, null, function* () {
3181
- try {
3182
- const res = yield this._doRequest(config, path);
3183
- resolve(res);
3184
- } catch (e) {
3185
- reject(e);
3186
- }
3187
- }));
3188
- });
3189
- } else {
3190
- return this._doRequest(config, path);
3191
- }
3192
- });
3193
- }
3194
- _doRequest(config, path) {
3195
- return __async(this, null, function* () {
3196
- const response = yield axios3(config);
3197
- this._updateRateLimit(path, response);
3198
- return response;
3199
- });
3200
- }
3201
- _updateRateLimit(path, response) {
3202
- const headers = response.headers;
3203
- const limit = parseInt(headers["x-ratelimit-limit"]);
3204
- const remaining = parseInt(headers["x-ratelimit-remaining"]);
3205
- const resetAfter = parseFloat(headers["x-ratelimit-reset-after"]) * 1e3 + Date.now();
3206
- const bucket = headers["x-ratelimit-bucket"];
3207
- const resetIn = parseInt(headers["x-ratelimit-reset-after"]);
3208
- if (!bucket) return;
3209
- this.pathToBucket.set(path, bucket);
3210
- let state = this.bucketMap.get(bucket);
3211
- if (!state) {
3212
- state = {
3213
- limit,
3214
- remaining,
3215
- resetAfter,
3216
- bucket,
3217
- resetIn,
3218
- queue: [],
3219
- lastPath: path
3220
- };
3221
- this.bucketMap.set(bucket, state);
3222
- } else {
3223
- state.limit = limit;
3224
- state.remaining = remaining;
3225
- state.resetAfter = resetAfter;
3226
- state.lastPath = path;
3227
- }
3228
- if (remaining <= 0) {
3229
- if (state.resetTimeout) clearTimeout(state.resetTimeout);
3230
- const delay = resetIn;
3231
- state.resetTimeout = setTimeout(() => {
3232
- state.remaining = state.limit;
3233
- state.resetTimeout = void 0;
3234
- while (state.queue.length > 0 && state.remaining > 0) {
3235
- const fn = state.queue.shift();
3236
- if (fn) {
3237
- state.remaining--;
3238
- fn();
3239
- }
3240
- }
3241
- }, delay);
3242
- }
3243
- }
3244
- };
3245
-
3246
- // src/rest/restClient.ts
3247
- var RestClient = class {
3248
- constructor(client3) {
3249
- this.client = client3;
3250
- this.rateLimitQueue = new RateLimitQueue();
3251
- }
3252
- /**
3253
- * Helper function to handle API requests.
3254
- * @param method The HTTP method (GET, POST, PATCH, PUT, DELETE).
3255
- * @param url The URL for the request.
3256
- * @param body The request body (if applicable).
3257
- * @param query Query parameters (if applicable).
3258
- * @returns The API response.
3259
- */
3260
- request(method, url, body, query, retry) {
3261
- return __async(this, null, function* () {
3262
- var _a;
3263
- try {
3264
- if (!this.client.token) throw new Error("Token is required");
3265
- const authHeader = this.client.bot ? "X-Bot-Token" : "X-Session-Token";
3266
- const config = __spreadProps(__spreadValues({}, {
3267
- method,
3268
- url: `${apiUrl}${url}`,
3269
- params: query,
3270
- data: body == null ? void 0 : body.body,
3271
- headers: {
3272
- [authHeader]: this.client.token,
3273
- "User-Agent": `RevBot.js/${version}`
3274
- }
3275
- }), {
3276
- url: `${apiUrl}${url}`
3277
- });
3278
- const response = yield this.rateLimitQueue.request(config);
3279
- return response.data;
3280
- } catch (error) {
3281
- if (retry) throw typeof error;
3282
- if (error instanceof AxiosError) {
3283
- if (error.status && (error.status === 429 || error.status >= 500)) {
3284
- return this.retryRequest(0, method, url, body, query);
3285
- }
3286
- if (error.status) {
3287
- throw new Error(
3288
- `API call failed with status ${error.status}: ${(_a = error.response) == null ? void 0 : _a.statusText}`
3289
- );
3290
- }
3291
- }
3292
- throw new Error(
3293
- `API call failed: ${error instanceof Error ? error.message : error}`
3294
- );
3295
- }
3296
- });
3297
- }
3298
- retryRequest(attempt = 0, method, url, body, query) {
3299
- return __async(this, null, function* () {
3300
- var _a, _b;
3301
- if (attempt >= ((_b = (_a = this.client.options.rest) == null ? void 0 : _a.retries) != null ? _b : 3)) {
3302
- throw new Error("Max retries reached");
3303
- }
3304
- try {
3305
- return yield this.request(method, url, body, query, true);
3306
- } catch (error) {
3307
- console.warn(`Attempt ${attempt + 1} failed:`, error);
3308
- yield new Promise(
3309
- (resolve) => {
3310
- var _a2, _b2, _c;
3311
- return setTimeout(
3312
- resolve,
3313
- (_c = (_a2 = this.client.options.rest) == null ? void 0 : _a2.timeout) != null ? _c : (_b2 = DEFAULT_CLIENT_OPTIONS.rest) == null ? void 0 : _b2.timeout
3314
- );
3315
- }
3316
- );
3317
- return this.retryRequest(attempt + 1, method, url, body, query);
3318
- }
3319
- });
3320
- }
3321
- /**
3322
- * GET request.
3323
- * @param url The URL for the request.
3324
- * @param query Query parameters (if applicable).
3325
- * @returns The API response.
3326
- */
3327
- get(url, query) {
3328
- return __async(this, null, function* () {
3329
- return this.request("GET", url, void 0, query);
3330
- });
3331
- }
3332
- /**
3333
- * POST request.
3334
- * @param url The URL for the request.
3335
- * @param body The request body.
3336
- * @param query Query parameters (if applicable).
3337
- * @returns The API response.
3338
- */
3339
- post(url, body, query) {
3340
- return __async(this, null, function* () {
3341
- return this.request("POST", url, body, query);
3342
- });
3343
- }
3344
- /**
3345
- * PATCH request.
3346
- * @param url The URL for the request.
3347
- * @param body The request body.
3348
- * @param query Query parameters (if applicable).
3349
- * @returns The API response.
3350
- */
3351
- patch(url, body, query) {
3352
- return __async(this, null, function* () {
3353
- return this.request("PATCH", url, body, query);
3354
- });
3355
- }
3356
- /**
3357
- * PUT request.
3358
- * @param url The URL for the request.
3359
- * @param body The request body.
3360
- * @param query Query parameters (if applicable).
3361
- * @returns The API response.
3362
- */
3363
- put(url, body, query) {
3364
- return __async(this, null, function* () {
3365
- return this.request("PUT", url, body, query);
3366
- });
3367
- }
3368
- /**
3369
- * DELETE request.
3370
- * @param url The URL for the request.
3371
- * @param query Query parameters (if applicable).
3372
- * @returns The API response.
3373
- */
3374
- delete(url, body, query) {
3375
- return __async(this, null, function* () {
3376
- return this.request("DELETE", url, body, query);
3377
- });
3378
- }
3379
- };
3380
-
3381
- // src/rest/CDNClient.ts
3382
- import { AxiosError as AxiosError2 } from "axios";
3383
- var CDNClient = class {
3384
- constructor(client3) {
3385
- this.client = client3;
3386
- this.rateLimitQueue = new RateLimitQueue();
3387
- }
3388
- /**
3389
- * Helper function to handle API requests.
3390
- * @param method The HTTP method (GET, POST, PATCH, PUT, DELETE).
3391
- * @param url The URL for the request.
3392
- * @param body The request body (if applicable).
3393
- * @param query Query parameters (if applicable).
3394
- * @returns The API response.
3395
- */
3396
- request(method, url, data, query, retry) {
3397
- return __async(this, null, function* () {
3398
- try {
3399
- if (!this.client.token) throw new Error("Token is required");
3400
- const authHeader = this.client.bot ? "X-Bot-Token" : "X-Session-Token";
3401
- const config = __spreadProps(__spreadValues({}, {
3402
- method,
3403
- url: `${cdnUrl}${url}`,
3404
- params: query,
3405
- data,
3406
- maxBodyLength: Infinity,
3407
- headers: __spreadValues({
3408
- [authHeader]: this.client.token,
3409
- "Content-Type": "multipart/form-data",
3410
- "User-Agent": `RevBot.js/${version}`
3411
- }, data.getHeaders())
3412
- }), {
3413
- url: `${cdnUrl}${url}`
3414
- });
3415
- const response = yield this.rateLimitQueue.request(config);
3416
- return response.data;
3417
- } catch (error) {
3418
- if (retry) throw typeof error;
3419
- if (error instanceof AxiosError2) {
3420
- if (error.status && (error.status === 429 || error.status >= 500)) {
3421
- return this.retryRequest(0, method, url, data, query);
3422
- }
3423
- if (error.status) {
3424
- console.error(`API call failed with status ${error.status}:`, error);
3425
- throw new Error(
3426
- `API call failed with status ${error.status}: ${error.message}`
3427
- );
3428
- }
3429
- }
3430
- throw new Error(
3431
- `API call failed: ${error instanceof Error ? error.message : error}`
3432
- );
3433
- }
3434
- });
3435
- }
3436
- retryRequest(attempt = 0, method, url, body, query) {
3437
- return __async(this, null, function* () {
3438
- var _a, _b;
3439
- if (attempt >= ((_b = (_a = this.client.options.rest) == null ? void 0 : _a.retries) != null ? _b : 3)) {
3440
- throw new Error("Max retries reached");
3441
- }
3442
- try {
3443
- return yield this.request(method, url, body, query, true);
3444
- } catch (error) {
3445
- console.warn(`Attempt ${attempt + 1} failed:`, error);
3446
- yield new Promise(
3447
- (resolve) => {
3448
- var _a2, _b2, _c;
3449
- return setTimeout(
3450
- resolve,
3451
- (_c = (_a2 = this.client.options.rest) == null ? void 0 : _a2.timeout) != null ? _c : (_b2 = DEFAULT_CLIENT_OPTIONS.rest) == null ? void 0 : _b2.timeout
3452
- );
3453
- }
3454
- );
3455
- return this.retryRequest(attempt + 1, method, url, body, query);
3456
- }
3457
- });
3458
- }
3459
- /**
3460
- * POST request.
3461
- * @param url The URL for the request.
3462
- * @param data The request body.
3463
- * @param query Query parameters (if applicable).
3464
- * @returns The API response.
3465
- */
3466
- post(url, data) {
3467
- return __async(this, null, function* () {
3468
- return this.request("POST", url, data);
3469
- });
3470
- }
3471
- };
3472
-
3473
- // src/client/baseClient.ts
3474
- var _token;
3475
- var BaseClient = class extends EventEmitter {
3476
- /**
3477
- * Creates a new BaseClient instance.
3478
- *
3479
- * @param {clientOptions} [options={}] - The options for configuring the client.
3480
- */
3481
- constructor(options = {}) {
3482
- var _a;
3483
- super();
3484
- /** The authentication token for the client. */
3485
- __privateAdd(this, _token, null);
3486
- /** Whether the client is a bot. */
3487
- this.bot = true;
3488
- this.options = __spreadValues(__spreadValues({}, DEFAULT_CLIENT_OPTIONS), options);
3489
- this.bot = (_a = this.options.isBot) != null ? _a : true;
3490
- this.api = new RestClient(this);
3491
- this.cdn = new CDNClient(this);
3492
- }
3493
- /**
3494
- * Emits a debug message.
3495
- *
3496
- * @param {unknown} msg - The debug message to emit.
3497
- */
3498
- debug(msg) {
3499
- this.emit("debug" /* DEBUG */, msg);
3500
- }
3501
- /**
3502
- * Sets the authentication token for the client.
3503
- *
3504
- * @param {string | null} token - The authentication token.
3505
- */
3506
- set token(token) {
3507
- __privateSet(this, _token, token);
3508
- }
3509
- /**
3510
- * Gets the authentication token for the client.
3511
- *
3512
- * @returns {string | null} The authentication token, or `null` if not set.
3513
- */
3514
- get token() {
3515
- return __privateGet(this, _token);
3516
- }
3517
- };
3518
- _token = new WeakMap();
3519
-
3520
- // src/client/events/index.ts
3521
- var events_exports = {};
3522
- __export(events_exports, {
3523
- BulkMessageDelete: () => BulkMessageDelete,
3524
- ChannelCreate: () => ChannelCreate,
3525
- ChannelDelete: () => ChannelDelete,
3526
- ChannelGroupJoin: () => ChannelGroupJoin,
3527
- ChannelGroupLeave: () => ChannelGroupLeave,
3528
- ChannelStartTyping: () => ChannelStartTyping,
3529
- ChannelStopTyping: () => ChannelStopTyping,
3530
- ChannelUpdate: () => ChannelUpdate,
3531
- Message: () => Message6,
3532
- MessageDelete: () => MessageDelete,
3533
- MessageReact: () => MessageReact,
3534
- MessageUnreact: () => MessageUnreact,
3535
- MessageUpdate: () => MessageUpdate,
3536
- ServerCreate: () => ServerCreate,
3537
- ServerDelete: () => ServerDelete,
3538
- ServerMemberJoin: () => ServerMemberJoin,
3539
- ServerMemberLeave: () => ServerMemberLeave,
3540
- ServerMemberUpdate: () => ServerMemberUpdate,
3541
- ServerRoleDelete: () => ServerRoleDelete,
3542
- ServerRoleUpdate: () => ServerRoleUpdate,
3543
- ServerUpdate: () => ServerUpdate,
3544
- UserUpdate: () => UserUpdate
3545
- });
3546
-
3547
- // src/client/events/event.ts
3548
- var Event = class {
3549
- /**
3550
- * Creates a new Event instance.
3551
- *
3552
- * @param {client} client - The client instance.
3553
- */
3554
- constructor(client3) {
3555
- this.client = client3;
3556
- }
3557
- };
3558
-
3559
- // src/client/events/bulkMessageDelete.ts
3560
- var BulkMessageDelete = class extends Event {
3561
- /**
3562
- * Handles the bulk message delete event.
3563
- *
3564
- * @param {{ ids: string[] }} data - The data for the event, containing the IDs of the deleted messages.
3565
- */
3566
- handle(data) {
3567
- this.client.emit("messageDeleteBulk" /* MESSAGE_DELETE_BULK */, data.ids);
3568
- }
3569
- };
3570
-
3571
- // src/client/events/channelCreate.ts
3572
- var ChannelCreate = class extends Event {
3573
- /**
3574
- * Handles the channel creation event.
3575
- *
3576
- * @param {API.Channel} data - The raw data for the created channel from the API.
3577
- * @returns {Promise<{ channel: unknown }>} A promise that resolves with the created channel.
3578
- */
3579
- handle(data) {
3580
- return __async(this, null, function* () {
3581
- var _a;
3582
- const channel = this.client.channels._add(data);
3583
- if (channel) {
3584
- if (channel.inServer()) {
3585
- const server = (_a = channel.server) != null ? _a : yield this.client.servers.fetch(channel.serverId);
3586
- server.channels.cache.set(channel.id, channel);
3587
- }
3588
- this.client.emit("channelCreate" /* CHANNEL_CREATE */, channel);
3589
- }
3590
- return { channel };
3591
- });
3592
- }
3593
- };
3594
-
3595
- // src/client/events/channelDelete.ts
3596
- var ChannelDelete = class extends Event {
3597
- /**
3598
- * Handles the channel deletion event.
3599
- *
3600
- * @param {{ id: string }} data - The data for the event, containing the ID of the deleted channel.
3601
- * @returns {{ channel: unknown }} An object containing the deleted channel, or `undefined` if not found.
3602
- */
3603
- handle(data) {
3604
- var _a;
3605
- const channel = this.client.channels.cache.get(data.id);
3606
- if (channel) {
3607
- if (channel.inServer()) {
3608
- (_a = channel.server) == null ? void 0 : _a.channels.cache.delete(channel.id);
3609
- }
3610
- this.client.emit("channelDelete" /* CHANNEL_DELETE */, channel);
3611
- }
3612
- return { channel };
3613
- }
3614
- };
3615
-
3616
- // src/client/events/channelGroupJoin.ts
3617
- var ChannelGroupJoin = class extends Event {
3618
- /**
3619
- * Handles the group channel join event.
3620
- *
3621
- * @param {{ id: string; user: string }} data - The data for the event, containing the channel ID and user ID.
3622
- * @returns {Promise<{ channel: unknown; user: unknown }>} A promise that resolves with the updated channel and user.
3623
- */
3624
- handle(data) {
3625
- return __async(this, null, function* () {
3626
- const channel = this.client.channels.cache.get(data.id);
3627
- const user = yield this.client.users.fetch(data.user, { force: false });
3628
- if (channel == null ? void 0 : channel.isGroup()) {
3629
- channel.users.set(user.id, user);
3630
- this.client.emit("groupJoin" /* GROUP_JOIN */, channel, user);
3631
- }
3632
- return { channel, user };
3633
- });
3634
- }
3635
- };
3636
-
3637
- // src/client/events/channelGroupLeave.ts
3638
- var ChannelGroupLeave = class extends Event {
3639
- /**
3640
- * Handles the group channel leave event.
3641
- *
3642
- * @param {{ id: string; user: string }} data - The data for the event, containing the channel ID and user ID.
3643
- * @returns {Promise<{ channel: unknown; user: unknown }>} A promise that resolves with the updated channel and user.
3644
- */
3645
- handle(data) {
3646
- return __async(this, null, function* () {
3647
- const channel = this.client.channels.cache.get(data.id);
3648
- const user = yield this.client.users.fetch(data.user, { force: false });
3649
- if (channel == null ? void 0 : channel.isGroup()) {
3650
- channel.users.delete(data.user);
3651
- this.client.emit("groupLeave" /* GROUP_LEAVE */, channel, user);
3652
- }
3653
- return { channel, user };
3654
- });
3655
- }
3656
- };
3657
-
3658
- // src/client/events/channelStarttyping.ts
3659
- var ChannelStartTyping = class extends Event {
3660
- /**
3661
- * Handles the typing start event.
3662
- *
3663
- * @param {{ id: string; user: string }} data - The data for the event, containing the channel ID and user ID.
3664
- * @returns {{ channel: unknown; user: unknown }} An object containing the channel and user involved in the event.
3665
- */
3666
- handle(data) {
3667
- const channel = this.client.channels.cache.get(data.id);
3668
- const user = this.client.users.cache.get(data.user);
3669
- if ((channel == null ? void 0 : channel.isText()) && user) {
3670
- this.client.emit("typingStart" /* TYPING_START */, channel, user);
3671
- }
3672
- return { channel, user };
3673
- }
3674
- };
3675
-
3676
- // src/client/events/channelStopTyping.ts
3677
- var ChannelStopTyping = class extends Event {
3678
- /**
3679
- * Handles the typing stop event.
3680
- *
3681
- * @param {{ id: string; user: string }} data - The data for the event, containing the channel ID and user ID.
3682
- * @returns {{ channel: unknown; user: unknown }} An object containing the channel and user involved in the event.
3683
- */
3684
- handle(data) {
3685
- const channel = this.client.channels.cache.get(data.id);
3686
- const user = this.client.users.cache.get(data.user);
3687
- if ((channel == null ? void 0 : channel.isText()) && user) {
3688
- this.client.emit("typingStop" /* TYPING_STOP */, channel, user);
3689
- }
3690
- return { channel, user };
3691
- }
3692
- };
3693
-
3694
- // src/client/events/channelUpdate.ts
3695
- var ChannelUpdate = class extends Event {
3696
- /**
3697
- * Handles the channel update event.
3698
- *
3699
- * @param {{ id: string; data: API.Channel; clear: API.FieldsChannel }} data - The data for the event, containing the channel ID, updated data, and fields to clear.
3700
- * @returns {void}
3701
- */
3702
- handle(data) {
3703
- const channel = this.client.channels.cache.get(data.id);
3704
- const oldChannel = channel == null ? void 0 : channel._update(data.data);
3705
- if (channel && oldChannel && !channel.equals(oldChannel)) {
3706
- this.client.emit("channelUpdate" /* CHANNEL_UPDATE */, oldChannel, channel);
3707
- }
3708
- }
3709
- };
3710
-
3711
- // src/client/events/message.ts
3712
- var Message6 = class extends Event {
3713
- /**
3714
- * Handles the message event.
3715
- *
3716
- * @param {API.Message} data - The raw data for the message from the API.
3717
- * @returns {Promise<{ message: unknown }>} A promise that resolves with the created message, or an empty object if the channel is not text-based.
3718
- */
3719
- handle(data) {
3720
- return __async(this, null, function* () {
3721
- const channel = this.client.channels.cache.get(data.channel);
3722
- if (channel == null ? void 0 : channel.isText()) {
3723
- const message = channel.messages._add(data);
3724
- if (data.author !== SYSTEM_USER_ID && !data.webhook) {
3725
- yield this.client.users.fetch(data.author, { force: false });
3726
- }
3727
- this.client.emit("message" /* MESSAGE */, message);
3728
- return { message };
3729
- }
3730
- return {};
3731
- });
3732
- }
3733
- };
3734
-
3735
- // src/client/events/messageDelete.ts
3736
- var MessageDelete = class extends Event {
3737
- /**
3738
- * Handles the message deletion event.
3739
- *
3740
- * @param {{ id: string; channel: string }} data - The data for the event, containing the message ID and channel ID.
3741
- * @returns {{ message: unknown } | {}} An object containing the deleted message, or an empty object if the channel is not text-based or the message is not found.
3742
- */
3743
- handle(data) {
3744
- const channel = this.client.channels.cache.get(data.channel);
3745
- if (channel == null ? void 0 : channel.isText()) {
3746
- const message = channel.messages.cache.get(data.id);
3747
- if (message) {
3748
- channel.messages._remove(message.id);
3749
- this.client.emit("messageDelete" /* MESSAGE_DELETE */, message);
3750
- }
3751
- return { message };
3752
- }
3753
- return {};
3754
- }
3755
- };
3756
-
3757
- // src/client/events/messageUpdate.ts
3758
- var MessageUpdate = class extends Event {
3759
- /**
3760
- * Handles the message update event.
3761
- *
3762
- * @param {{ id: string; channel: string; data: API.Message }} data - The data for the event, containing the message ID, channel ID, and updated message data.
3763
- * @returns {void}
3764
- */
3765
- handle(data) {
3766
- const channel = this.client.channels.cache.get(data.channel);
3767
- if (!(channel == null ? void 0 : channel.isText())) return;
3768
- const message = channel == null ? void 0 : channel.messages.cache.get(data.id);
3769
- const oldMessage = message == null ? void 0 : message._update(data.data);
3770
- if (oldMessage && message && !message.equals(oldMessage)) {
3771
- this.client.emit("messageUpdate" /* MESSAGE_UPDATE */, oldMessage, message);
3772
- }
3773
- }
3774
- };
3775
-
3776
- // src/client/events/serverCreate.ts
3777
- var ServerCreate = class extends Event {
3778
- /**
3779
- * Handles the server creation event.
3780
- *
3781
- * @param {API.Server} data - The raw data for the created server from the API.
3782
- * @returns {Promise<void>} A promise that resolves when the server is added and members are optionally fetched.
3783
- */
3784
- handle(data) {
3785
- return __async(this, null, function* () {
3786
- const server = this.client.servers._add(data);
3787
- if (this.client.options.fetchMembers) {
3788
- yield server.members.fetch();
3789
- }
3790
- this.client.emit("serverCreate" /* SERVER_CREATE */, server);
3791
- });
3792
- }
3793
- };
3794
-
3795
- // src/client/events/serverDelete.ts
3796
- var ServerDelete = class extends Event {
3797
- /**
3798
- * Handles the server deletion event.
3799
- *
3800
- * @param {API.Server} data - The raw data for the deleted server from the API.
3801
- * @returns {{ server: unknown }} An object containing the deleted server, or `undefined` if not found.
3802
- */
3803
- handle(data) {
3804
- const server = this.client.servers.cache.get(data._id);
3805
- if (server) {
3806
- this.client.servers._remove(server.id);
3807
- this.client.emit("serverDelete" /* SERVER_DELETE */, server);
3808
- }
3809
- return { server };
3810
- }
3811
- };
3812
-
3813
- // src/client/events/serverMemberJoin.ts
3814
- var ServerMemberJoin = class extends Event {
3815
- /**
3816
- * Handles the server member join event.
3817
- *
3818
- * @param {{ id: string; user: string }} data - The data for the event, containing the server ID and user ID.
3819
- * @returns {Promise<{ member: unknown }>} A promise that resolves with the joined member.
3820
- */
3821
- handle(data) {
3822
- return __async(this, null, function* () {
3823
- let server = this.client.servers.cache.get(data.id);
3824
- if (!server) {
3825
- server = yield this.client.servers.fetch(data.id);
3826
- this.client.emit("serverCreate" /* SERVER_CREATE */, server);
3827
- }
3828
- const member = yield server.members.fetch(data.user);
3829
- server.members.cache.set(member.id, member);
3830
- this.client.emit("serverMemberJoin" /* SERVER_MEMBER_JOIN */, member);
3831
- return { member };
3832
- });
3833
- }
3834
- };
3835
-
3836
- // src/client/events/serverMemberLeave.ts
3837
- var ServerMemberLeave = class extends Event {
3838
- /**
3839
- * Handles the server member leave event.
3840
- *
3841
- * @param {{ id: string; user: string }} data - The data for the event, containing the server ID and user ID.
3842
- * @returns {{ server: unknown; member?: unknown }} An object containing the server and the member who left, or just the server if the member is not found.
3843
- */
3844
- handle(data) {
3845
- const server = this.client.servers.cache.get(data.id);
3846
- if (server) {
3847
- const member = server.members.cache.get(data.user);
3848
- if (member) {
3849
- server.members._remove(member.id);
3850
- this.client.emit("serverMemberLeave" /* SERVER_MEMBER_LEAVE */, member);
3851
- }
3852
- return { server, member };
3853
- }
3854
- return { server };
3855
- }
3856
- };
3857
-
3858
- // src/client/events/serverMemberUpdate.ts
3859
- var ServerMemberUpdate = class extends Event {
3860
- /**
3861
- * Handles the server member update event.
3862
- *
3863
- * @param {{ id: string; data: API.Member }} data - The data for the event, containing the server ID and updated member data.
3864
- * @returns {void}
3865
- */
3866
- handle(data) {
3867
- const updateData = __spreadProps(__spreadValues({}, data.data), {
3868
- _id: { server: data.id.server, user: data.id.user }
3869
- });
3870
- const server = this.client.servers.cache.get(data.id.server);
3871
- const member = server == null ? void 0 : server.members.cache.get(data.id.user);
3872
- const oldMember = member == null ? void 0 : member._update(updateData);
3873
- if (oldMember && member && (!member.equals(oldMember) || areRolesDifferent(member.roles, oldMember.roles))) {
3874
- this.client.emit("serverMemberUpdate" /* SERVER_MEMBER_UPDATE */, oldMember, member);
3875
- }
3876
- }
3877
- };
3878
- function areRolesDifferent(rolesA, rolesB) {
3879
- const idsA = rolesA.map((role) => role.id).sort();
3880
- const idsB = rolesB.map((role) => role.id).sort();
3881
- return idsA.length !== idsB.length || !idsA.every((id, index) => id === idsB[index]);
3882
- }
3883
-
3884
- // src/client/events/serverRoleDelete.ts
3885
- var ServerRoleDelete = class extends Event {
3886
- /**
3887
- * Handles the server role deletion event.
3888
- *
3889
- * @param {{ id: string; role_id: string }} data - The data for the event, containing the server ID and role ID.
3890
- * @returns {{ role: unknown } | {}} An object containing the deleted role, or an empty object if the role or server is not found.
3891
- */
3892
- handle(data) {
3893
- const server = this.client.servers.cache.get(data.id);
3894
- if (server) {
3895
- const role = server.roles.cache.get(data.role_id);
3896
- if (role) {
3897
- server.roles._remove(role.id);
3898
- this.client.emit("roleDelete" /* ROLE_DELETE */, role);
3899
- }
3900
- return { role };
3901
- }
3902
- return {};
3903
- }
3904
- };
3905
-
3906
- // src/client/events/serverRoleUpdate.ts
3907
- var ServerRoleUpdate = class extends Event {
3908
- /**
3909
- * Handles the server role update event.
3910
- *
3911
- * @param {{ id: string; role_id: string; data: API.Role & { _id: string }; clear: API.FieldsRole[] }} data - The data for the event, containing the server ID, role ID, updated role data, and fields to clear.
3912
- * @returns {void}
3913
- */
3914
- handle(data) {
3915
- const server = this.client.servers.cache.get(data.id);
3916
- if (!server) return;
3917
- const role = server.roles.cache.get(data.role_id);
3918
- const oldRole = role == null ? void 0 : role._update(data.data, data.clear);
3919
- if (role && oldRole && !role.equals(oldRole)) {
3920
- this.client.emit("roleUpdate" /* ROLE_UPDATE */, oldRole, role);
3921
- }
3922
- }
3923
- };
3924
-
3925
- // src/client/events/serverupdate.ts
3926
- var ServerUpdate = class extends Event {
3927
- /**
3928
- * Handles the server update event.
3929
- *
3930
- * @param {{ id: string; data: API.Server; clear: API.FieldsServer[] }} data - The data for the event, containing the server ID, updated server data, and fields to clear.
3931
- * @returns {void}
3932
- */
3933
- handle(data) {
3934
- const server = this.client.servers.cache.get(data.id);
3935
- const oldServer = server == null ? void 0 : server._update(data.data, data.clear);
3936
- if (oldServer && server && !oldServer.equals(server)) {
3937
- this.client.emit("serverUpdate" /* SERVER_UPDATE */, oldServer, server);
3938
- }
3939
- }
3940
- };
3941
-
3942
- // src/client/events/userUpdate.ts
3943
- var UserUpdate = class extends Event {
3944
- /**
3945
- * Handles the user update event.
3946
- *
3947
- * @param {{ id: string; data: API.User; clear: API.FieldsUser[] }} data - The data for the event, containing the user ID, updated user data, and fields to clear.
3948
- * @returns {void}
3949
- */
3950
- handle(data) {
3951
- const user = data.id === this.client.user.id ? this.client.user : this.client.users.cache.get(data.id);
3952
- const oldUser = user == null ? void 0 : user._update(data.data, data.clear);
3953
- if (user && oldUser && !user.equals(oldUser)) {
3954
- this.client.emit("userUpdate" /* USER_UPDATE */, oldUser, user);
3955
- }
3956
- }
3957
- };
3958
-
3959
- // src/client/events/messageReact.ts
3960
- var MessageReact = class extends Event {
3961
- /**
3962
- * Handles the message reaction event.
3963
- *
3964
- * @param {MessageReactData} data - The data for the event, containing the message ID, channel ID, user ID, and emoji ID.
3965
- * @returns {Promise<unknown>} A promise that resolves with an empty object.
3966
- */
3967
- handle(data) {
3968
- return __async(this, null, function* () {
3969
- var _a, _b;
3970
- const channel = this.client.channels.cache.get(data.channel_id);
3971
- if (channel == null ? void 0 : channel.isText()) {
3972
- let message = channel.messages.cache.get(data.id) ? channel.messages.cache.get(data.id) : yield channel.messages.fetch(data.id);
3973
- if (message) {
3974
- if ((_a = message.reactions.get(data.emoji_id)) == null ? void 0 : _a.indexOf(data.user_id)) return;
3975
- if (!((_b = message.reactions.get(data.emoji_id)) == null ? void 0 : _b.push(data.user_id)))
3976
- message.reactions.set(data.emoji_id, [data.user_id]);
3977
- this.client.emit("messageReact" /* MESSAGE_REACT */, message);
3978
- }
3979
- }
3980
- return {};
3981
- });
3982
- }
3983
- };
3984
-
3985
- // src/client/events/messageUnreact.ts
3986
- var MessageUnreact = class extends Event {
3987
- /**
3988
- * Handles the message reaction removal event.
3989
- *
3990
- * @param {MessageReactData} data - The data for the event, containing the message ID, channel ID, user ID, and emoji ID.
3991
- * @returns {Promise<unknown>} A promise that resolves with an empty object.
3992
- */
3993
- handle(data) {
3994
- return __async(this, null, function* () {
3995
- const channel = this.client.channels.cache.get(data.channel_id);
3996
- if (channel == null ? void 0 : channel.isText()) {
3997
- let message = channel.messages.cache.get(data.id) ? channel.messages.cache.get(data.id) : yield channel.messages.fetch(data.id);
3998
- if (message) {
3999
- const reaction = message.reactions.get(data.emoji_id);
4000
- if (reaction) {
4001
- const index = reaction.indexOf(data.user_id);
4002
- if (index !== -1) {
4003
- reaction.splice(index, 1);
4004
- }
4005
- if (reaction.length === 0) {
4006
- message.reactions.delete(data.emoji_id);
4007
- }
4008
- }
4009
- this.client.emit("messageUnreact" /* MESSAGE_REACT_REMOVE */, message);
4010
- }
4011
- }
4012
- return {};
4013
- });
4014
- }
4015
- };
4016
-
4017
- // src/client/events/eventManager.ts
4018
- var _events;
4019
- var EventManager = class {
4020
- /**
4021
- * Creates a new EventManager instance.
4022
- *
4023
- * @param {client} client - The client instance.
4024
- */
4025
- constructor(client3) {
4026
- this.client = client3;
4027
- /** A map of registered events, keyed by their names. */
4028
- __privateAdd(this, _events, /* @__PURE__ */ new Map());
4029
- for (const Event2 of Object.values(events_exports)) {
4030
- this.register(Event2);
4031
- }
4032
- }
4033
- /**
4034
- * Registers an event with the manager.
4035
- *
4036
- * @param {new (client: client) => CustomEvent} Event - The event class to register.
4037
- */
4038
- register(Event2) {
4039
- __privateGet(this, _events).set(Event2.name.replace(/Events$/, ""), new Event2(this.client));
4040
- }
4041
- /**
4042
- * Retrieves a registered event by its name.
4043
- *
4044
- * @param {string} name - The name of the event to retrieve.
4045
- * @returns {CustomEvent | null} The event instance, or `null` if not found.
4046
- */
4047
- get(name) {
4048
- var _a;
4049
- return (_a = __privateGet(this, _events).get(name)) != null ? _a : null;
4050
- }
4051
- };
4052
- _events = new WeakMap();
4053
-
4054
- // src/struct/clientUser.ts
4055
- var ClientUser = class extends User {
4056
- constructor() {
4057
- super(...arguments);
4058
- /** The notes channel associated with the client user, if any. */
4059
- this.notes = null;
4060
- }
4061
- /**
4062
- * Updates the username of the client user.
4063
- *
4064
- * @param {string} username - The new username to set.
4065
- * @param {string} [password] - The current password of the user (required for non-bot accounts).
4066
- * @returns {Promise<void>} A promise that resolves when the username has been successfully updated.
4067
- * @throws {Error} Throws an error if the client user is a bot and a password is provided.
4068
- *
4069
- * @example
4070
- * ```typescript
4071
- * await clientUser.setUsername("NewUsername", "CurrentPassword");
4072
- * ```
4073
- */
4074
- setUsername(username, password) {
4075
- return __async(this, null, function* () {
4076
- if (this.bot && password) {
4077
- throw new Error("Bots do not have passwords");
4078
- }
4079
- yield this.client.api.patch("/users/@me/username", {
4080
- body: { username, password }
4081
- });
4082
- });
4083
- }
4084
- /**
4085
- * Updates the status of the client user.
4086
- *
4087
- * @param {string | null} text - The status text to set, or `null` to clear the status.
4088
- * @param {Status} [presence] - The presence status (e.g., online, idle, etc.).
4089
- * @returns {Promise<void>} A promise that resolves when the status has been successfully updated.
4090
- *
4091
- * @example
4092
- * ```typescript
4093
- * await clientUser.setStatus("Available", "online");
4094
- * ```
4095
- */
4096
- setStatus(text, presence) {
4097
- return __async(this, null, function* () {
4098
- yield this.client.api.patch("/users/@me", {
4099
- body: { status: { text, presence } }
4100
- });
4101
- });
4102
- }
4103
- };
4104
-
4105
- // src/client/webSocket.ts
4106
- var WebSocketClient = class {
4107
- /**
4108
- * Creates a new WebSocketClient instance.
4109
- *
4110
- * @param {client} client - The client instance.
4111
- */
4112
- constructor(client3) {
4113
- this.client = client3;
4114
- /** Whether the last pong acknowledgment was received. */
4115
- this.lastPongAck = false;
4116
- /** Whether the WebSocket client is connected. */
4117
- this.connected = false;
4118
- /** A promise representing the reconnecting process, or `null` if not reconnecting. */
4119
- this.reconnecting = null;
4120
- /** Whether the WebSocket client is ready. */
4121
- this.ready = false;
4122
- }
4123
- /**
4124
- * Logs a debug message.
4125
- *
4126
- * @param {unknown} message - The message to log.
4127
- * @private
4128
- */
4129
- debug(message) {
4130
- this.client.debug(`[WS] ${message}`);
4131
- }
4132
- /**
4133
- * Sends data through the WebSocket connection.
4134
- *
4135
- * @param {unknown} data - The data to send.
4136
- * @returns {Promise<void>} A promise that resolves when the data is sent.
4137
- * @throws {Error} Throws an error if the WebSocket is not open.
4138
- */
4139
- send(data) {
4140
- return __async(this, null, function* () {
4141
- var _a;
4142
- if (this.reconnecting) {
4143
- this.debug("Reconnecting, waiting to send message.");
4144
- yield this.reconnecting;
4145
- }
4146
- if (((_a = this.socket) == null ? void 0 : _a.readyState) === WebSocket.OPEN) {
4147
- this.socket.send(JSON.stringify(data));
4148
- } else {
4149
- this.debug("Socket is not open, cannot send message.");
4150
- throw new Error("Socket is not open");
4151
- }
4152
- });
4153
- }
4154
- /**
4155
- * Handles the WebSocket connection opening.
4156
- *
4157
- * @private
4158
- */
4159
- onOpen() {
4160
- if (!this.client.token) throw new Error("Token is required");
4161
- this.send({
4162
- type: "Authenticate" /* AUTHENTICATE */,
4163
- token: this.client.token
4164
- });
4165
- }
4166
- /**
4167
- * Gets the current ping (latency) of the WebSocket connection.
4168
- *
4169
- * @returns {number} The ping in milliseconds, or `-0` if the WebSocket is not connected.
4170
- */
4171
- get ping() {
4172
- if (!this.socket) return -0;
4173
- return Date.now() - this.lastPingTimestamp;
4174
- }
4175
- /**
4176
- * Sets the heartbeat interval for the WebSocket connection.
4177
- *
4178
- * @param {number} time - The interval time in milliseconds. Use `-1` to clear the interval.
4179
- */
4180
- setHeartbeatTimer(time) {
4181
- this.debug(`Setting a heartbeat interval for ${time}ms.`);
4182
- if (this.heartbeatInterval) {
4183
- clearInterval(this.heartbeatInterval);
4184
- }
4185
- if (time !== -1) {
4186
- this.heartbeatInterval = setInterval(() => this.sendHeartbeat(), time);
4187
- }
4188
- }
4189
- /**
4190
- * Sends a heartbeat to the server to keep the connection alive.
4191
- */
4192
- sendHeartbeat() {
4193
- var _a;
4194
- this.debug("Sending heartbeat.");
4195
- if (!this.lastPongAck) {
4196
- this.debug("Did not receive a pong ack.");
4197
- if ((_a = this.client.options.ws) == null ? void 0 : _a.reconnect) {
4198
- this.reconnecting = this.destroy().then(() => this.connect()).then(() => this.reconnecting = null);
4199
- }
4200
- }
4201
- const now = Date.now();
4202
- this.send({ type: "Ping" /* PING */, data: now });
4203
- this.lastPongAck = false;
4204
- this.lastPingTimestamp = now;
4205
- }
4206
- /**
4207
- * Handles WebSocket errors.
4208
- *
4209
- * @param {unknown} event - The error event.
4210
- * @private
4211
- */
4212
- onError(event) {
4213
- this.client.emit("error" /* ERROR */, event);
4214
- }
4215
- /**
4216
- * Handles incoming WebSocket messages.
4217
- *
4218
- * @param {{ data: unknown }} param0 - The message event containing the data.
4219
- * @private
4220
- */
4221
- onMessage({ data }) {
4222
- let packet;
4223
- try {
4224
- packet = JSON.parse(String(data));
4225
- } catch (err) {
4226
- this.client.emit("error" /* ERROR */, err);
4227
- return;
4228
- }
4229
- this.client.emit("raw" /* RAW */, packet);
4230
- this.onPacket(packet).catch((e) => this.client.emit("error" /* ERROR */, e));
4231
- }
4232
- /**
4233
- * Handles the WebSocket connection closing.
4234
- *
4235
- * @param {{ code: number; reason: string }} event - The close event containing the code and reason.
4236
- * @private
4237
- */
4238
- onClose(event) {
4239
- this.debug(`Closed with reason: ${event.reason}, code: ${event.code}`);
4240
- this.destroy();
4241
- }
4242
- /**
4243
- * Handles incoming WebSocket packets.
4244
- *
4245
- * @param {any} packet - The packet data.
4246
- * @private
4247
- */
4248
- onPacket(packet) {
4249
- return __async(this, null, function* () {
4250
- var _a, _b, _c, _d;
4251
- if (!packet) {
4252
- this.debug(`Received broken packet: '${packet}'.`);
4253
- return;
4254
- }
4255
- switch (packet.type) {
4256
- case "Bulk" /* BULK */:
4257
- yield Promise.all(packet.v.map((p) => this.onPacket(p)));
4258
- break;
4259
- case "Authenticated" /* AUTHENTICATED */:
4260
- this.connected = true;
4261
- break;
4262
- case "Pong" /* PONG */:
4263
- this.debug(`Received a heartbeat.`);
4264
- this.lastPongAck = true;
4265
- break;
4266
- case "Error" /* ERROR */:
4267
- this.client.emit("error" /* ERROR */, packet.error);
4268
- break;
4269
- case "Ready" /* READY */: {
4270
- this.lastPongAck = true;
4271
- const promises = [];
4272
- for (const user of packet.users) {
4273
- if (user.relationship === "User" && !this.client.user) {
4274
- this.client.user = new ClientUser(this.client, user);
4275
- } else {
4276
- this.client.users._add(user);
4277
- }
4278
- }
4279
- for (const server of packet.servers) {
4280
- const s = this.client.servers._add(server);
4281
- if (this.client.options.fetchMembers) {
4282
- promises.push(s.members.fetch());
4283
- }
4284
- }
4285
- for (const channel of packet.channels) {
4286
- this.client.channels._add(channel);
4287
- }
4288
- for (const member of packet.members) {
4289
- (_a = this.client.servers.cache.get(member._id.server)) == null ? void 0 : _a.members._add(member);
4290
- }
4291
- for (const emoji of packet.emojis) {
4292
- (_b = this.client.servers.cache.get(emoji.parent.id)) == null ? void 0 : _b.emojis.set(emoji._id, __spreadProps(__spreadValues({}, emoji), { _id: emoji._id }));
4293
- }
4294
- this.setHeartbeatTimer(
4295
- (_d = (_c = this.client.options.ws) == null ? void 0 : _c.heartbeatInterval) != null ? _d : 3e4
4296
- );
4297
- yield Promise.all(promises);
4298
- this.ready = true;
4299
- this.client.emit("ready" /* READY */, this.client);
4300
- break;
4301
- }
4302
- default: {
4303
- const action = this.client.events.get(packet.type);
4304
- if (action) {
4305
- yield action.handle(packet);
4306
- } else {
4307
- this.debug(`Received unknown packet "${packet.type}"`);
4308
- }
4309
- break;
4310
- }
4311
- }
4312
- });
4313
- }
4314
- /**
4315
- * Connects to the WebSocket server.
4316
- *
4317
- * @returns {Promise<this>} A promise that resolves when the connection is established.
4318
- */
4319
- connect() {
4320
- return new Promise((resolve) => {
4321
- var _a, _b;
4322
- if (((_a = this.socket) == null ? void 0 : _a.readyState) === WebSocket.OPEN && this.ready) {
4323
- return resolve(this);
4324
- }
4325
- if (typeof this.client.options === "undefined") {
4326
- throw new Error("MISSING_CONFIGURATION_SYNC");
4327
- }
4328
- if (typeof this.client.token !== "string") {
4329
- throw new Error("INVALID_TOKEN");
4330
- }
4331
- const ws = this.socket = (_b = this.socket) != null ? _b : new WebSocket(`${wsUrl}`);
4332
- ws.onopen = this.onOpen.bind(this);
4333
- ws.onmessage = this.onMessage.bind(this);
4334
- ws.onerror = this.onError.bind(this);
4335
- ws.onclose = this.onClose.bind(this);
4336
- ws.addEventListener("open", () => resolve(this));
4337
- });
4338
- }
4339
- /**
4340
- * Destroys the WebSocket connection and clears its state.
4341
- *
4342
- * @returns {Promise<void>} A promise that resolves when the connection is destroyed.
4343
- */
4344
- destroy() {
4345
- return new Promise((resolve) => {
4346
- var _a;
4347
- this.setHeartbeatTimer(-1);
4348
- this.connected = false;
4349
- this.ready = false;
4350
- if (((_a = this.socket) == null ? void 0 : _a.readyState) === WebSocket.OPEN) {
4351
- this.socket.addEventListener("close", () => {
4352
- this.socket = null;
4353
- resolve();
4354
- });
4355
- this.socket.close();
4356
- } else {
4357
- this.socket = null;
4358
- resolve();
4359
- }
4360
- });
4361
- }
4362
- };
4363
-
4364
- // src/client/client.ts
4365
- var client2 = class extends BaseClient {
4366
- constructor() {
4367
- super(...arguments);
4368
- /** The WebSocket client used for real-time communication. */
4369
- this.ws = new WebSocketClient(this);
4370
- /** Manages the channels in the client. */
4371
- this.channels = new ChannelManager(this);
4372
- /** Manages the servers in the client. */
4373
- this.servers = new ServerManager(this);
4374
- /** Manages the users in the client. */
4375
- this.users = new UserManager(this);
4376
- /** Manages the events in the client. */
4377
- this.events = new EventManager(this);
4378
- /** The authenticated user, or `null` if not logged in. */
4379
- this.user = null;
4380
- /** The timestamp when the client became ready, or `null` if not ready. */
4381
- this.readyAt = null;
4382
- }
4383
- /**
4384
- * Gets the timestamp when the client became ready.
4385
- *
4386
- * @returns {number | null} The ready timestamp in milliseconds, or `null` if not ready.
4387
- */
4388
- get readyTimestamp() {
4389
- return this.readyAt ? this.readyAt.getTime() : null;
4390
- }
4391
- /**
4392
- * Gets the uptime of the client in milliseconds.
4393
- *
4394
- * @returns {number | null} The uptime in milliseconds, or `null` if the client is not ready.
4395
- */
4396
- get upTime() {
4397
- return this.readyAt ? Date.now() - this.readyAt.getTime() : null;
4398
- }
4399
- /**
4400
- * Logs the client into the API using the provided token.
4401
- *
4402
- * @param {string} token - The authentication token.
4403
- * @returns {Promise<void>} A promise that resolves when the client is logged in.
4404
- * @throws {Error} Throws an error if the token is not provided or if the WebSocket connection fails.
4405
- *
4406
- * @example
4407
- * ```typescript
4408
- * await client.login("your-token-here");
4409
- * ```
4410
- */
4411
- login(token) {
4412
- return __async(this, null, function* () {
4413
- if (!token) throw new Error("Token is required");
4414
- this.token = token;
4415
- this.debug("Logging in...");
4416
- try {
4417
- yield this.ws.connect();
4418
- } catch (error) {
4419
- this.debug(`Error connecting to WebSocket: ${error}`);
4420
- throw error;
4421
- }
4422
- this.readyAt = /* @__PURE__ */ new Date();
4423
- });
4424
- }
4425
- /**
4426
- * Destroys the client, disconnecting it from the API and clearing its state.
4427
- *
4428
- * @returns {Promise<void>} A promise that resolves when the client is destroyed.
4429
- *
4430
- * @example
4431
- * ```typescript
4432
- * await client.destroy();
4433
- * ```
4434
- */
4435
- destroy() {
4436
- return __async(this, null, function* () {
4437
- this.token = null;
4438
- this.user = null;
4439
- this.readyAt = null;
4440
- yield this.ws.destroy();
4441
- });
4442
- }
4443
- /**
4444
- * Checks if the client is ready.
4445
- *
4446
- * @returns {boolean} `true` if the client is ready, otherwise `false`.
4447
- *
4448
- * @example
4449
- * ```typescript
4450
- * if (client.isReady()) {
4451
- * console.log("Client is ready!");
4452
- * }
4453
- * ```
4454
- */
4455
- isReady() {
4456
- return this.readyAt !== null;
4457
- }
4458
- };
1
+ import {
2
+ Category,
3
+ ChannelManager,
4
+ DMChannel,
5
+ GroupChannel,
6
+ Message,
7
+ MessageManager,
8
+ NotesChannel,
9
+ Role,
10
+ RoleManager,
11
+ Server,
12
+ ServerChannel,
13
+ ServerChannelManager,
14
+ ServerManager,
15
+ ServerMember,
16
+ ServerMemberManager,
17
+ TextChannel,
18
+ User,
19
+ UserManager,
20
+ VoiceChannel,
21
+ client
22
+ } from "./chunk-XQEYCTYC.js";
23
+ import "./chunk-XMS4UTPG.js";
24
+ import "./chunk-55PAATU6.js";
25
+ import "./chunk-H4SZEZP2.js";
26
+ import "./chunk-3ANNOYXY.js";
27
+ import "./chunk-6V6HPZ33.js";
28
+ import "./chunk-6WJXGICC.js";
29
+ import "./chunk-VELIOWTX.js";
30
+ import "./chunk-OETI5C5L.js";
31
+ import "./chunk-AOKM5TCP.js";
32
+ import "./chunk-X7VEORVS.js";
33
+ import "./chunk-O2IN5OZI.js";
34
+ import "./chunk-43CUB3NP.js";
35
+ import "./chunk-SYXHGCHU.js";
36
+ import "./chunk-G7DLVJKH.js";
37
+ import "./chunk-GCIV7PRI.js";
38
+ import "./chunk-MSJCRRXO.js";
39
+ import "./chunk-RMACMP4R.js";
40
+ import "./chunk-WMWOEYVA.js";
41
+ import "./chunk-35BYGFDX.js";
42
+ import "./chunk-OK227BBS.js";
43
+ import "./chunk-FKNQEJE7.js";
44
+ import "./chunk-E2P4PIDH.js";
45
+ import "./chunk-LQUZ7Q7D.js";
46
+ import "./chunk-W4XDXSOK.js";
47
+ import "./chunk-K4VAG5ZU.js";
48
+ import {
49
+ MessageEmbed
50
+ } from "./chunk-EOZ7QHOH.js";
51
+ import {
52
+ Presence,
53
+ Status
54
+ } from "./chunk-YXX4DJB3.js";
55
+ import {
56
+ Channel
57
+ } from "./chunk-J2RF7D67.js";
58
+ import {
59
+ Emoji
60
+ } from "./chunk-5RK7FEID.js";
61
+ import {
62
+ Invite
63
+ } from "./chunk-R2PF552K.js";
64
+ import {
65
+ Mentions
66
+ } from "./chunk-BQS6ZLNY.js";
67
+ import {
68
+ Attachment
69
+ } from "./chunk-VU3XNPDE.js";
70
+ import {
71
+ Base
72
+ } from "./chunk-YLSAAPO4.js";
73
+ import "./chunk-MLKHJGSQ.js";
74
+ import "./chunk-HKLTWZSB.js";
75
+ import "./chunk-DSM44DGO.js";
76
+ import "./chunk-HETUKFLM.js";
77
+ import "./chunk-GNQQG7EP.js";
78
+ import "./chunk-7XUN3OQT.js";
79
+ import {
80
+ ChannelPermissions,
81
+ DEFAULT_PERMISSION_DM,
82
+ FullPermissions,
83
+ ServerPermissions,
84
+ UserPermissions
85
+ } from "./chunk-7PA5MDKS.js";
86
+ import {
87
+ Badges
88
+ } from "./chunk-LY7OFI25.js";
89
+ import {
90
+ ChannelTypes,
91
+ DEFAULT_CLIENT_OPTIONS,
92
+ Events,
93
+ SYSTEM_USER_ID,
94
+ WSEvents,
95
+ apiUrl,
96
+ cdnUrl,
97
+ wsUrl
98
+ } from "./chunk-LUDTY3LL.js";
99
+ import {
100
+ UUID
101
+ } from "./chunk-CQ4AJZQD.js";
102
+ import {
103
+ BitField
104
+ } from "./chunk-LAL23AQK.js";
105
+ import {
106
+ BaseManager
107
+ } from "./chunk-3GLQHMWL.js";
108
+ import "./chunk-ICANLKGX.js";
4459
109
  export {
4460
110
  Attachment,
4461
111
  Badges,
@@ -4469,11 +119,11 @@ export {
4469
119
  ChannelTypes,
4470
120
  DEFAULT_CLIENT_OPTIONS,
4471
121
  DEFAULT_PERMISSION_DM,
4472
- DMChannel3 as DMChannel,
4473
- Emoji2 as Emoji,
122
+ DMChannel,
123
+ Emoji,
4474
124
  Events,
4475
125
  FullPermissions,
4476
- GroupChannel2 as GroupChannel,
126
+ GroupChannel,
4477
127
  Invite,
4478
128
  Mentions,
4479
129
  Message,
@@ -4484,15 +134,15 @@ export {
4484
134
  Role,
4485
135
  RoleManager,
4486
136
  SYSTEM_USER_ID,
4487
- Server2 as Server,
137
+ Server,
4488
138
  ServerChannel,
4489
139
  ServerChannelManager,
4490
140
  ServerManager,
4491
- ServerMember3 as ServerMember,
141
+ ServerMember,
4492
142
  ServerMemberManager,
4493
143
  ServerPermissions,
4494
144
  Status,
4495
- TextChannel2 as TextChannel,
145
+ TextChannel,
4496
146
  UUID,
4497
147
  User,
4498
148
  UserManager,
@@ -4501,6 +151,7 @@ export {
4501
151
  WSEvents,
4502
152
  apiUrl,
4503
153
  cdnUrl,
4504
- client2 as client,
154
+ client,
4505
155
  wsUrl
4506
156
  };
157
+ //# sourceMappingURL=index.js.map