carbon-proxy 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (520) hide show
  1. package/README.md +237 -0
  2. package/dist/package.json +43 -0
  3. package/dist/src/abstracts/AnySelectMenu.d.ts +40 -0
  4. package/dist/src/abstracts/AnySelectMenu.d.ts.map +1 -0
  5. package/dist/src/abstracts/AnySelectMenu.js +41 -0
  6. package/dist/src/abstracts/AnySelectMenu.js.map +1 -0
  7. package/dist/src/abstracts/AnySelectMenuInteraction.d.ts +12 -0
  8. package/dist/src/abstracts/AnySelectMenuInteraction.d.ts.map +1 -0
  9. package/dist/src/abstracts/AnySelectMenuInteraction.js +19 -0
  10. package/dist/src/abstracts/AnySelectMenuInteraction.js.map +1 -0
  11. package/dist/src/abstracts/Base.d.ts +10 -0
  12. package/dist/src/abstracts/Base.d.ts.map +1 -0
  13. package/dist/src/abstracts/Base.js +11 -0
  14. package/dist/src/abstracts/Base.js.map +1 -0
  15. package/dist/src/abstracts/BaseChannel.d.ts +60 -0
  16. package/dist/src/abstracts/BaseChannel.d.ts.map +1 -0
  17. package/dist/src/abstracts/BaseChannel.js +90 -0
  18. package/dist/src/abstracts/BaseChannel.js.map +1 -0
  19. package/dist/src/abstracts/BaseCommand.d.ts +77 -0
  20. package/dist/src/abstracts/BaseCommand.d.ts.map +1 -0
  21. package/dist/src/abstracts/BaseCommand.js +127 -0
  22. package/dist/src/abstracts/BaseCommand.js.map +1 -0
  23. package/dist/src/abstracts/BaseComponent.d.ts +20 -0
  24. package/dist/src/abstracts/BaseComponent.d.ts.map +1 -0
  25. package/dist/src/abstracts/BaseComponent.js +10 -0
  26. package/dist/src/abstracts/BaseComponent.js.map +1 -0
  27. package/dist/src/abstracts/BaseComponentInteraction.d.ts +18 -0
  28. package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -0
  29. package/dist/src/abstracts/BaseComponentInteraction.js +41 -0
  30. package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -0
  31. package/dist/src/abstracts/BaseGuildChannel.d.ts +61 -0
  32. package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -0
  33. package/dist/src/abstracts/BaseGuildChannel.js +125 -0
  34. package/dist/src/abstracts/BaseGuildChannel.js.map +1 -0
  35. package/dist/src/abstracts/BaseGuildTextChannel.d.ts +53 -0
  36. package/dist/src/abstracts/BaseGuildTextChannel.d.ts.map +1 -0
  37. package/dist/src/abstracts/BaseGuildTextChannel.js +89 -0
  38. package/dist/src/abstracts/BaseGuildTextChannel.js.map +1 -0
  39. package/dist/src/abstracts/BaseInteraction.d.ts +166 -0
  40. package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -0
  41. package/dist/src/abstracts/BaseInteraction.js +274 -0
  42. package/dist/src/abstracts/BaseInteraction.js.map +1 -0
  43. package/dist/src/abstracts/BaseListener.d.ts +13 -0
  44. package/dist/src/abstracts/BaseListener.d.ts.map +1 -0
  45. package/dist/src/abstracts/BaseListener.js +8 -0
  46. package/dist/src/abstracts/BaseListener.js.map +1 -0
  47. package/dist/src/abstracts/BaseMessageInteractiveComponent.d.ts +41 -0
  48. package/dist/src/abstracts/BaseMessageInteractiveComponent.d.ts.map +1 -0
  49. package/dist/src/abstracts/BaseMessageInteractiveComponent.js +35 -0
  50. package/dist/src/abstracts/BaseMessageInteractiveComponent.js.map +1 -0
  51. package/dist/src/abstracts/BaseModalComponent.d.ts +9 -0
  52. package/dist/src/abstracts/BaseModalComponent.d.ts.map +1 -0
  53. package/dist/src/abstracts/BaseModalComponent.js +5 -0
  54. package/dist/src/abstracts/BaseModalComponent.js.map +1 -0
  55. package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +58 -0
  56. package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -0
  57. package/dist/src/abstracts/GuildThreadOnlyChannel.js +102 -0
  58. package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -0
  59. package/dist/src/abstracts/Plugin.d.ts +49 -0
  60. package/dist/src/abstracts/Plugin.d.ts.map +1 -0
  61. package/dist/src/abstracts/Plugin.js +6 -0
  62. package/dist/src/abstracts/Plugin.js.map +1 -0
  63. package/dist/src/adapters/bun/index.d.ts +13 -0
  64. package/dist/src/adapters/bun/index.d.ts.map +1 -0
  65. package/dist/src/adapters/bun/index.js +16 -0
  66. package/dist/src/adapters/bun/index.js.map +1 -0
  67. package/dist/src/adapters/fetch/index.d.ts +11 -0
  68. package/dist/src/adapters/fetch/index.d.ts.map +1 -0
  69. package/dist/src/adapters/fetch/index.js +50 -0
  70. package/dist/src/adapters/fetch/index.js.map +1 -0
  71. package/dist/src/adapters/node/index.d.ts +13 -0
  72. package/dist/src/adapters/node/index.d.ts.map +1 -0
  73. package/dist/src/adapters/node/index.js +17 -0
  74. package/dist/src/adapters/node/index.js.map +1 -0
  75. package/dist/src/classes/Client.d.ts +253 -0
  76. package/dist/src/classes/Client.d.ts.map +1 -0
  77. package/dist/src/classes/Client.js +419 -0
  78. package/dist/src/classes/Client.js.map +1 -0
  79. package/dist/src/classes/Command.d.ts +44 -0
  80. package/dist/src/classes/Command.d.ts.map +1 -0
  81. package/dist/src/classes/Command.js +53 -0
  82. package/dist/src/classes/Command.js.map +1 -0
  83. package/dist/src/classes/CommandWithSubcommandGroups.d.ts +22 -0
  84. package/dist/src/classes/CommandWithSubcommandGroups.d.ts.map +1 -0
  85. package/dist/src/classes/CommandWithSubcommandGroups.js +27 -0
  86. package/dist/src/classes/CommandWithSubcommandGroups.js.map +1 -0
  87. package/dist/src/classes/CommandWithSubcommands.d.ts +19 -0
  88. package/dist/src/classes/CommandWithSubcommands.d.ts.map +1 -0
  89. package/dist/src/classes/CommandWithSubcommands.js +19 -0
  90. package/dist/src/classes/CommandWithSubcommands.js.map +1 -0
  91. package/dist/src/classes/Embed.d.ts +61 -0
  92. package/dist/src/classes/Embed.d.ts.map +1 -0
  93. package/dist/src/classes/Embed.js +75 -0
  94. package/dist/src/classes/Embed.js.map +1 -0
  95. package/dist/src/classes/Listener.d.ts +392 -0
  96. package/dist/src/classes/Listener.d.ts.map +1 -0
  97. package/dist/src/classes/Listener.js +1034 -0
  98. package/dist/src/classes/Listener.js.map +1 -0
  99. package/dist/src/classes/Modal.d.ts +37 -0
  100. package/dist/src/classes/Modal.d.ts.map +1 -0
  101. package/dist/src/classes/Modal.js +28 -0
  102. package/dist/src/classes/Modal.js.map +1 -0
  103. package/dist/src/classes/RequestClient.d.ts +106 -0
  104. package/dist/src/classes/RequestClient.d.ts.map +1 -0
  105. package/dist/src/classes/RequestClient.js +451 -0
  106. package/dist/src/classes/RequestClient.js.map +1 -0
  107. package/dist/src/classes/components/Button.d.ts +52 -0
  108. package/dist/src/classes/components/Button.d.ts.map +1 -0
  109. package/dist/src/classes/components/Button.js +71 -0
  110. package/dist/src/classes/components/Button.js.map +1 -0
  111. package/dist/src/classes/components/ChannelSelectMenu.d.ts +17 -0
  112. package/dist/src/classes/components/ChannelSelectMenu.d.ts.map +1 -0
  113. package/dist/src/classes/components/ChannelSelectMenu.js +22 -0
  114. package/dist/src/classes/components/ChannelSelectMenu.js.map +1 -0
  115. package/dist/src/classes/components/Checkbox.d.ts +12 -0
  116. package/dist/src/classes/components/Checkbox.d.ts.map +1 -0
  117. package/dist/src/classes/components/Checkbox.js +20 -0
  118. package/dist/src/classes/components/Checkbox.js.map +1 -0
  119. package/dist/src/classes/components/CheckboxGroup.d.ts +24 -0
  120. package/dist/src/classes/components/CheckboxGroup.d.ts.map +1 -0
  121. package/dist/src/classes/components/CheckboxGroup.js +37 -0
  122. package/dist/src/classes/components/CheckboxGroup.js.map +1 -0
  123. package/dist/src/classes/components/Container.d.ts +28 -0
  124. package/dist/src/classes/components/Container.d.ts.map +1 -0
  125. package/dist/src/classes/components/Container.js +38 -0
  126. package/dist/src/classes/components/Container.js.map +1 -0
  127. package/dist/src/classes/components/File.d.ts +21 -0
  128. package/dist/src/classes/components/File.d.ts.map +1 -0
  129. package/dist/src/classes/components/File.js +36 -0
  130. package/dist/src/classes/components/File.js.map +1 -0
  131. package/dist/src/classes/components/FileUpload.d.ts +23 -0
  132. package/dist/src/classes/components/FileUpload.d.ts.map +1 -0
  133. package/dist/src/classes/components/FileUpload.js +36 -0
  134. package/dist/src/classes/components/FileUpload.js.map +1 -0
  135. package/dist/src/classes/components/Label.d.ts +31 -0
  136. package/dist/src/classes/components/Label.d.ts.map +1 -0
  137. package/dist/src/classes/components/Label.js +35 -0
  138. package/dist/src/classes/components/Label.js.map +1 -0
  139. package/dist/src/classes/components/MediaGallery.d.ts +22 -0
  140. package/dist/src/classes/components/MediaGallery.d.ts.map +1 -0
  141. package/dist/src/classes/components/MediaGallery.js +32 -0
  142. package/dist/src/classes/components/MediaGallery.js.map +1 -0
  143. package/dist/src/classes/components/MentionableSelectMenu.d.ts +15 -0
  144. package/dist/src/classes/components/MentionableSelectMenu.d.ts.map +1 -0
  145. package/dist/src/classes/components/MentionableSelectMenu.js +20 -0
  146. package/dist/src/classes/components/MentionableSelectMenu.js.map +1 -0
  147. package/dist/src/classes/components/RadioGroup.d.ts +24 -0
  148. package/dist/src/classes/components/RadioGroup.d.ts.map +1 -0
  149. package/dist/src/classes/components/RadioGroup.js +33 -0
  150. package/dist/src/classes/components/RadioGroup.js.map +1 -0
  151. package/dist/src/classes/components/RoleSelectMenu.d.ts +15 -0
  152. package/dist/src/classes/components/RoleSelectMenu.d.ts.map +1 -0
  153. package/dist/src/classes/components/RoleSelectMenu.js +20 -0
  154. package/dist/src/classes/components/RoleSelectMenu.js.map +1 -0
  155. package/dist/src/classes/components/Row.d.ts +28 -0
  156. package/dist/src/classes/components/Row.d.ts.map +1 -0
  157. package/dist/src/classes/components/Row.js +44 -0
  158. package/dist/src/classes/components/Row.js.map +1 -0
  159. package/dist/src/classes/components/Section.d.ts +23 -0
  160. package/dist/src/classes/components/Section.d.ts.map +1 -0
  161. package/dist/src/classes/components/Section.js +37 -0
  162. package/dist/src/classes/components/Section.js.map +1 -0
  163. package/dist/src/classes/components/Separator.d.ts +22 -0
  164. package/dist/src/classes/components/Separator.d.ts.map +1 -0
  165. package/dist/src/classes/components/Separator.js +33 -0
  166. package/dist/src/classes/components/Separator.js.map +1 -0
  167. package/dist/src/classes/components/StringSelectMenu.d.ts +15 -0
  168. package/dist/src/classes/components/StringSelectMenu.d.ts.map +1 -0
  169. package/dist/src/classes/components/StringSelectMenu.js +19 -0
  170. package/dist/src/classes/components/StringSelectMenu.js.map +1 -0
  171. package/dist/src/classes/components/TextDisplay.d.ts +10 -0
  172. package/dist/src/classes/components/TextDisplay.d.ts.map +1 -0
  173. package/dist/src/classes/components/TextDisplay.js +22 -0
  174. package/dist/src/classes/components/TextDisplay.js.map +1 -0
  175. package/dist/src/classes/components/TextInput.d.ts +53 -0
  176. package/dist/src/classes/components/TextInput.d.ts.map +1 -0
  177. package/dist/src/classes/components/TextInput.js +57 -0
  178. package/dist/src/classes/components/TextInput.js.map +1 -0
  179. package/dist/src/classes/components/Thumbnail.d.ts +14 -0
  180. package/dist/src/classes/components/Thumbnail.d.ts.map +1 -0
  181. package/dist/src/classes/components/Thumbnail.js +27 -0
  182. package/dist/src/classes/components/Thumbnail.js.map +1 -0
  183. package/dist/src/classes/components/UserSelectMenu.d.ts +15 -0
  184. package/dist/src/classes/components/UserSelectMenu.d.ts.map +1 -0
  185. package/dist/src/classes/components/UserSelectMenu.js +20 -0
  186. package/dist/src/classes/components/UserSelectMenu.js.map +1 -0
  187. package/dist/src/errors/BaseError.d.ts +3 -0
  188. package/dist/src/errors/BaseError.d.ts.map +1 -0
  189. package/dist/src/errors/BaseError.js +3 -0
  190. package/dist/src/errors/BaseError.js.map +1 -0
  191. package/dist/src/errors/DiscordError.d.ts +25 -0
  192. package/dist/src/errors/DiscordError.d.ts.map +1 -0
  193. package/dist/src/errors/DiscordError.js +31 -0
  194. package/dist/src/errors/DiscordError.js.map +1 -0
  195. package/dist/src/errors/RatelimitError.d.ts +15 -0
  196. package/dist/src/errors/RatelimitError.d.ts.map +1 -0
  197. package/dist/src/errors/RatelimitError.js +18 -0
  198. package/dist/src/errors/RatelimitError.js.map +1 -0
  199. package/dist/src/functions/channelFactory.d.ts +14 -0
  200. package/dist/src/functions/channelFactory.d.ts.map +1 -0
  201. package/dist/src/functions/channelFactory.js +39 -0
  202. package/dist/src/functions/channelFactory.js.map +1 -0
  203. package/dist/src/functions/enforceChoicesLimit.d.ts +3 -0
  204. package/dist/src/functions/enforceChoicesLimit.d.ts.map +1 -0
  205. package/dist/src/functions/enforceChoicesLimit.js +17 -0
  206. package/dist/src/functions/enforceChoicesLimit.js.map +1 -0
  207. package/dist/src/functions/errorsMapper.d.ts +14 -0
  208. package/dist/src/functions/errorsMapper.d.ts.map +1 -0
  209. package/dist/src/functions/errorsMapper.js +46 -0
  210. package/dist/src/functions/errorsMapper.js.map +1 -0
  211. package/dist/src/index.d.ts +93 -0
  212. package/dist/src/index.d.ts.map +1 -0
  213. package/dist/src/index.js +100 -0
  214. package/dist/src/index.js.map +1 -0
  215. package/dist/src/internals/AutocompleteInteraction.d.ts +43 -0
  216. package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -0
  217. package/dist/src/internals/AutocompleteInteraction.js +73 -0
  218. package/dist/src/internals/AutocompleteInteraction.js.map +1 -0
  219. package/dist/src/internals/ButtonInteraction.d.ts +8 -0
  220. package/dist/src/internals/ButtonInteraction.d.ts.map +1 -0
  221. package/dist/src/internals/ButtonInteraction.js +16 -0
  222. package/dist/src/internals/ButtonInteraction.js.map +1 -0
  223. package/dist/src/internals/ChannelSelectMenuInteraction.d.ts +8 -0
  224. package/dist/src/internals/ChannelSelectMenuInteraction.d.ts.map +1 -0
  225. package/dist/src/internals/ChannelSelectMenuInteraction.js +11 -0
  226. package/dist/src/internals/ChannelSelectMenuInteraction.js.map +1 -0
  227. package/dist/src/internals/CommandHandler.d.ts +13 -0
  228. package/dist/src/internals/CommandHandler.d.ts.map +1 -0
  229. package/dist/src/internals/CommandHandler.js +143 -0
  230. package/dist/src/internals/CommandHandler.js.map +1 -0
  231. package/dist/src/internals/CommandInteraction.d.ts +26 -0
  232. package/dist/src/internals/CommandInteraction.d.ts.map +1 -0
  233. package/dist/src/internals/CommandInteraction.js +60 -0
  234. package/dist/src/internals/CommandInteraction.js.map +1 -0
  235. package/dist/src/internals/ComponentHandler.d.ts +14 -0
  236. package/dist/src/internals/ComponentHandler.d.ts.map +1 -0
  237. package/dist/src/internals/ComponentHandler.js +183 -0
  238. package/dist/src/internals/ComponentHandler.js.map +1 -0
  239. package/dist/src/internals/EmojiHandler.d.ts +19 -0
  240. package/dist/src/internals/EmojiHandler.d.ts.map +1 -0
  241. package/dist/src/internals/EmojiHandler.js +34 -0
  242. package/dist/src/internals/EmojiHandler.js.map +1 -0
  243. package/dist/src/internals/EventHandler.d.ts +22 -0
  244. package/dist/src/internals/EventHandler.d.ts.map +1 -0
  245. package/dist/src/internals/EventHandler.js +23 -0
  246. package/dist/src/internals/EventHandler.js.map +1 -0
  247. package/dist/src/internals/EventQueue.d.ts +59 -0
  248. package/dist/src/internals/EventQueue.d.ts.map +1 -0
  249. package/dist/src/internals/EventQueue.js +131 -0
  250. package/dist/src/internals/EventQueue.js.map +1 -0
  251. package/dist/src/internals/FieldsHandler.d.ts +68 -0
  252. package/dist/src/internals/FieldsHandler.d.ts.map +1 -0
  253. package/dist/src/internals/FieldsHandler.js +146 -0
  254. package/dist/src/internals/FieldsHandler.js.map +1 -0
  255. package/dist/src/internals/MentionableSelectMenuInteraction.d.ts +9 -0
  256. package/dist/src/internals/MentionableSelectMenuInteraction.d.ts.map +1 -0
  257. package/dist/src/internals/MentionableSelectMenuInteraction.js +15 -0
  258. package/dist/src/internals/MentionableSelectMenuInteraction.js.map +1 -0
  259. package/dist/src/internals/ModalHandler.d.ts +17 -0
  260. package/dist/src/internals/ModalHandler.d.ts.map +1 -0
  261. package/dist/src/internals/ModalHandler.js +35 -0
  262. package/dist/src/internals/ModalHandler.js.map +1 -0
  263. package/dist/src/internals/ModalInteraction.d.ts +21 -0
  264. package/dist/src/internals/ModalInteraction.d.ts.map +1 -0
  265. package/dist/src/internals/ModalInteraction.js +41 -0
  266. package/dist/src/internals/ModalInteraction.js.map +1 -0
  267. package/dist/src/internals/OptionsHandler.d.ts +108 -0
  268. package/dist/src/internals/OptionsHandler.d.ts.map +1 -0
  269. package/dist/src/internals/OptionsHandler.js +237 -0
  270. package/dist/src/internals/OptionsHandler.js.map +1 -0
  271. package/dist/src/internals/RoleSelectMenuInteraction.d.ts +9 -0
  272. package/dist/src/internals/RoleSelectMenuInteraction.d.ts.map +1 -0
  273. package/dist/src/internals/RoleSelectMenuInteraction.js +14 -0
  274. package/dist/src/internals/RoleSelectMenuInteraction.js.map +1 -0
  275. package/dist/src/internals/StringSelectMenuInteraction.d.ts +9 -0
  276. package/dist/src/internals/StringSelectMenuInteraction.d.ts.map +1 -0
  277. package/dist/src/internals/StringSelectMenuInteraction.js +14 -0
  278. package/dist/src/internals/StringSelectMenuInteraction.js.map +1 -0
  279. package/dist/src/internals/TemporaryListenerManager.d.ts +20 -0
  280. package/dist/src/internals/TemporaryListenerManager.d.ts.map +1 -0
  281. package/dist/src/internals/TemporaryListenerManager.js +59 -0
  282. package/dist/src/internals/TemporaryListenerManager.js.map +1 -0
  283. package/dist/src/internals/UserSelectMenuInteraction.d.ts +9 -0
  284. package/dist/src/internals/UserSelectMenuInteraction.d.ts.map +1 -0
  285. package/dist/src/internals/UserSelectMenuInteraction.js +14 -0
  286. package/dist/src/internals/UserSelectMenuInteraction.js.map +1 -0
  287. package/dist/src/permissions.d.ts +56 -0
  288. package/dist/src/permissions.d.ts.map +1 -0
  289. package/dist/src/permissions.js +4 -0
  290. package/dist/src/permissions.js.map +1 -0
  291. package/dist/src/plugins/client-manager/ClientManager.d.ts +151 -0
  292. package/dist/src/plugins/client-manager/ClientManager.d.ts.map +1 -0
  293. package/dist/src/plugins/client-manager/ClientManager.js +253 -0
  294. package/dist/src/plugins/client-manager/ClientManager.js.map +1 -0
  295. package/dist/src/plugins/client-manager/index.d.ts +2 -0
  296. package/dist/src/plugins/client-manager/index.d.ts.map +1 -0
  297. package/dist/src/plugins/client-manager/index.js +2 -0
  298. package/dist/src/plugins/client-manager/index.js.map +1 -0
  299. package/dist/src/plugins/command-data/CommandDataPlugin.d.ts +16 -0
  300. package/dist/src/plugins/command-data/CommandDataPlugin.d.ts.map +1 -0
  301. package/dist/src/plugins/command-data/CommandDataPlugin.js +43 -0
  302. package/dist/src/plugins/command-data/CommandDataPlugin.js.map +1 -0
  303. package/dist/src/plugins/command-data/index.d.ts +2 -0
  304. package/dist/src/plugins/command-data/index.d.ts.map +1 -0
  305. package/dist/src/plugins/command-data/index.js +2 -0
  306. package/dist/src/plugins/command-data/index.js.map +1 -0
  307. package/dist/src/plugins/gateway/BabyCache.d.ts +16 -0
  308. package/dist/src/plugins/gateway/BabyCache.d.ts.map +1 -0
  309. package/dist/src/plugins/gateway/BabyCache.js +53 -0
  310. package/dist/src/plugins/gateway/BabyCache.js.map +1 -0
  311. package/dist/src/plugins/gateway/GatewayPlugin.d.ts +90 -0
  312. package/dist/src/plugins/gateway/GatewayPlugin.d.ts.map +1 -0
  313. package/dist/src/plugins/gateway/GatewayPlugin.js +516 -0
  314. package/dist/src/plugins/gateway/GatewayPlugin.js.map +1 -0
  315. package/dist/src/plugins/gateway/InteractionEventListener.d.ts +8 -0
  316. package/dist/src/plugins/gateway/InteractionEventListener.d.ts.map +1 -0
  317. package/dist/src/plugins/gateway/InteractionEventListener.js +9 -0
  318. package/dist/src/plugins/gateway/InteractionEventListener.js.map +1 -0
  319. package/dist/src/plugins/gateway/index.d.ts +7 -0
  320. package/dist/src/plugins/gateway/index.d.ts.map +1 -0
  321. package/dist/src/plugins/gateway/index.js +7 -0
  322. package/dist/src/plugins/gateway/index.js.map +1 -0
  323. package/dist/src/plugins/gateway/types.d.ts +130 -0
  324. package/dist/src/plugins/gateway/types.d.ts.map +1 -0
  325. package/dist/src/plugins/gateway/types.js +5 -0
  326. package/dist/src/plugins/gateway/types.js.map +1 -0
  327. package/dist/src/plugins/gateway/utils/heartbeat.d.ts +18 -0
  328. package/dist/src/plugins/gateway/utils/heartbeat.d.ts.map +1 -0
  329. package/dist/src/plugins/gateway/utils/heartbeat.js +33 -0
  330. package/dist/src/plugins/gateway/utils/heartbeat.js.map +1 -0
  331. package/dist/src/plugins/gateway/utils/monitor.d.ts +37 -0
  332. package/dist/src/plugins/gateway/utils/monitor.d.ts.map +1 -0
  333. package/dist/src/plugins/gateway/utils/monitor.js +88 -0
  334. package/dist/src/plugins/gateway/utils/monitor.js.map +1 -0
  335. package/dist/src/plugins/gateway/utils/payload.d.ts +24 -0
  336. package/dist/src/plugins/gateway/utils/payload.d.ts.map +1 -0
  337. package/dist/src/plugins/gateway/utils/payload.js +65 -0
  338. package/dist/src/plugins/gateway/utils/payload.js.map +1 -0
  339. package/dist/src/plugins/gateway/utils/rateLimit.d.ts +41 -0
  340. package/dist/src/plugins/gateway/utils/rateLimit.d.ts.map +1 -0
  341. package/dist/src/plugins/gateway/utils/rateLimit.js +61 -0
  342. package/dist/src/plugins/gateway/utils/rateLimit.js.map +1 -0
  343. package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.d.ts +30 -0
  344. package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.d.ts.map +1 -0
  345. package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.js +80 -0
  346. package/dist/src/plugins/gateway-forwarder/GatewayForwarderPlugin.js.map +1 -0
  347. package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.d.ts +9 -0
  348. package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.d.ts.map +1 -0
  349. package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.js +7 -0
  350. package/dist/src/plugins/gateway-forwarder/ShardedGatewayForwarderPlugin.js.map +1 -0
  351. package/dist/src/plugins/gateway-forwarder/index.d.ts +4 -0
  352. package/dist/src/plugins/gateway-forwarder/index.d.ts.map +1 -0
  353. package/dist/src/plugins/gateway-forwarder/index.js +4 -0
  354. package/dist/src/plugins/gateway-forwarder/index.js.map +1 -0
  355. package/dist/src/plugins/linked-roles/LinkedRoles.d.ts +70 -0
  356. package/dist/src/plugins/linked-roles/LinkedRoles.d.ts.map +1 -0
  357. package/dist/src/plugins/linked-roles/LinkedRoles.js +211 -0
  358. package/dist/src/plugins/linked-roles/LinkedRoles.js.map +1 -0
  359. package/dist/src/plugins/linked-roles/index.d.ts +3 -0
  360. package/dist/src/plugins/linked-roles/index.d.ts.map +1 -0
  361. package/dist/src/plugins/linked-roles/index.js +3 -0
  362. package/dist/src/plugins/linked-roles/index.js.map +1 -0
  363. package/dist/src/plugins/linked-roles/types.d.ts +94 -0
  364. package/dist/src/plugins/linked-roles/types.d.ts.map +1 -0
  365. package/dist/src/plugins/linked-roles/types.js +39 -0
  366. package/dist/src/plugins/linked-roles/types.js.map +1 -0
  367. package/dist/src/plugins/paginator/GoToPageModal.d.ts +18 -0
  368. package/dist/src/plugins/paginator/GoToPageModal.d.ts.map +1 -0
  369. package/dist/src/plugins/paginator/GoToPageModal.js +56 -0
  370. package/dist/src/plugins/paginator/GoToPageModal.js.map +1 -0
  371. package/dist/src/plugins/paginator/Paginator.d.ts +53 -0
  372. package/dist/src/plugins/paginator/Paginator.d.ts.map +1 -0
  373. package/dist/src/plugins/paginator/Paginator.js +183 -0
  374. package/dist/src/plugins/paginator/Paginator.js.map +1 -0
  375. package/dist/src/plugins/paginator/index.d.ts +11 -0
  376. package/dist/src/plugins/paginator/index.d.ts.map +1 -0
  377. package/dist/src/plugins/paginator/index.js +11 -0
  378. package/dist/src/plugins/paginator/index.js.map +1 -0
  379. package/dist/src/plugins/sharding/ShardingPlugin.d.ts +44 -0
  380. package/dist/src/plugins/sharding/ShardingPlugin.d.ts.map +1 -0
  381. package/dist/src/plugins/sharding/ShardingPlugin.js +119 -0
  382. package/dist/src/plugins/sharding/ShardingPlugin.js.map +1 -0
  383. package/dist/src/plugins/sharding/index.d.ts +3 -0
  384. package/dist/src/plugins/sharding/index.d.ts.map +1 -0
  385. package/dist/src/plugins/sharding/index.js +3 -0
  386. package/dist/src/plugins/sharding/index.js.map +1 -0
  387. package/dist/src/plugins/voice/GuildDeleteListener.d.ts +7 -0
  388. package/dist/src/plugins/voice/GuildDeleteListener.d.ts.map +1 -0
  389. package/dist/src/plugins/voice/GuildDeleteListener.js +11 -0
  390. package/dist/src/plugins/voice/GuildDeleteListener.js.map +1 -0
  391. package/dist/src/plugins/voice/VoicePlugin.d.ts +15 -0
  392. package/dist/src/plugins/voice/VoicePlugin.d.ts.map +1 -0
  393. package/dist/src/plugins/voice/VoicePlugin.js +58 -0
  394. package/dist/src/plugins/voice/VoicePlugin.js.map +1 -0
  395. package/dist/src/plugins/voice/VoiceServerUpdateListener.d.ts +10 -0
  396. package/dist/src/plugins/voice/VoiceServerUpdateListener.d.ts.map +1 -0
  397. package/dist/src/plugins/voice/VoiceServerUpdateListener.js +16 -0
  398. package/dist/src/plugins/voice/VoiceServerUpdateListener.js.map +1 -0
  399. package/dist/src/plugins/voice/VoiceStateUpdateListener.d.ts +10 -0
  400. package/dist/src/plugins/voice/VoiceStateUpdateListener.d.ts.map +1 -0
  401. package/dist/src/plugins/voice/VoiceStateUpdateListener.js +21 -0
  402. package/dist/src/plugins/voice/VoiceStateUpdateListener.js.map +1 -0
  403. package/dist/src/plugins/voice/index.d.ts +2 -0
  404. package/dist/src/plugins/voice/index.d.ts.map +1 -0
  405. package/dist/src/plugins/voice/index.js +2 -0
  406. package/dist/src/plugins/voice/index.js.map +1 -0
  407. package/dist/src/structures/DmChannel.d.ts +22 -0
  408. package/dist/src/structures/DmChannel.d.ts.map +1 -0
  409. package/dist/src/structures/DmChannel.js +33 -0
  410. package/dist/src/structures/DmChannel.js.map +1 -0
  411. package/dist/src/structures/Emoji.d.ts +75 -0
  412. package/dist/src/structures/Emoji.d.ts.map +1 -0
  413. package/dist/src/structures/Emoji.js +156 -0
  414. package/dist/src/structures/Emoji.js.map +1 -0
  415. package/dist/src/structures/GroupDmChannel.d.ts +75 -0
  416. package/dist/src/structures/GroupDmChannel.d.ts.map +1 -0
  417. package/dist/src/structures/GroupDmChannel.js +131 -0
  418. package/dist/src/structures/GroupDmChannel.js.map +1 -0
  419. package/dist/src/structures/Guild.d.ts +338 -0
  420. package/dist/src/structures/Guild.d.ts.map +1 -0
  421. package/dist/src/structures/Guild.js +715 -0
  422. package/dist/src/structures/Guild.js.map +1 -0
  423. package/dist/src/structures/GuildAnnouncementChannel.d.ts +21 -0
  424. package/dist/src/structures/GuildAnnouncementChannel.d.ts.map +1 -0
  425. package/dist/src/structures/GuildAnnouncementChannel.js +35 -0
  426. package/dist/src/structures/GuildAnnouncementChannel.js.map +1 -0
  427. package/dist/src/structures/GuildCategoryChannel.d.ts +23 -0
  428. package/dist/src/structures/GuildCategoryChannel.d.ts.map +1 -0
  429. package/dist/src/structures/GuildCategoryChannel.js +34 -0
  430. package/dist/src/structures/GuildCategoryChannel.js.map +1 -0
  431. package/dist/src/structures/GuildForumChannel.d.ts +14 -0
  432. package/dist/src/structures/GuildForumChannel.d.ts.map +1 -0
  433. package/dist/src/structures/GuildForumChannel.js +15 -0
  434. package/dist/src/structures/GuildForumChannel.js.map +1 -0
  435. package/dist/src/structures/GuildMediaChannel.d.ts +9 -0
  436. package/dist/src/structures/GuildMediaChannel.d.ts.map +1 -0
  437. package/dist/src/structures/GuildMediaChannel.js +7 -0
  438. package/dist/src/structures/GuildMediaChannel.js.map +1 -0
  439. package/dist/src/structures/GuildMember.d.ts +145 -0
  440. package/dist/src/structures/GuildMember.d.ts.map +1 -0
  441. package/dist/src/structures/GuildMember.js +320 -0
  442. package/dist/src/structures/GuildMember.js.map +1 -0
  443. package/dist/src/structures/GuildScheduledEvent.d.ts +121 -0
  444. package/dist/src/structures/GuildScheduledEvent.d.ts.map +1 -0
  445. package/dist/src/structures/GuildScheduledEvent.js +228 -0
  446. package/dist/src/structures/GuildScheduledEvent.js.map +1 -0
  447. package/dist/src/structures/GuildStageOrVoiceChannel.d.ts +40 -0
  448. package/dist/src/structures/GuildStageOrVoiceChannel.d.ts.map +1 -0
  449. package/dist/src/structures/GuildStageOrVoiceChannel.js +63 -0
  450. package/dist/src/structures/GuildStageOrVoiceChannel.js.map +1 -0
  451. package/dist/src/structures/GuildTextChannel.d.ts +24 -0
  452. package/dist/src/structures/GuildTextChannel.d.ts.map +1 -0
  453. package/dist/src/structures/GuildTextChannel.js +41 -0
  454. package/dist/src/structures/GuildTextChannel.js.map +1 -0
  455. package/dist/src/structures/GuildThreadChannel.d.ts +90 -0
  456. package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -0
  457. package/dist/src/structures/GuildThreadChannel.js +165 -0
  458. package/dist/src/structures/GuildThreadChannel.js.map +1 -0
  459. package/dist/src/structures/Message.d.ts +174 -0
  460. package/dist/src/structures/Message.d.ts.map +1 -0
  461. package/dist/src/structures/Message.js +417 -0
  462. package/dist/src/structures/Message.js.map +1 -0
  463. package/dist/src/structures/Poll.d.ts +29 -0
  464. package/dist/src/structures/Poll.d.ts.map +1 -0
  465. package/dist/src/structures/Poll.js +51 -0
  466. package/dist/src/structures/Poll.js.map +1 -0
  467. package/dist/src/structures/Role.d.ts +151 -0
  468. package/dist/src/structures/Role.d.ts.map +1 -0
  469. package/dist/src/structures/Role.js +291 -0
  470. package/dist/src/structures/Role.js.map +1 -0
  471. package/dist/src/structures/ThreadMember.d.ts +40 -0
  472. package/dist/src/structures/ThreadMember.d.ts.map +1 -0
  473. package/dist/src/structures/ThreadMember.js +79 -0
  474. package/dist/src/structures/ThreadMember.js.map +1 -0
  475. package/dist/src/structures/User.d.ts +104 -0
  476. package/dist/src/structures/User.d.ts.map +1 -0
  477. package/dist/src/structures/User.js +199 -0
  478. package/dist/src/structures/User.js.map +1 -0
  479. package/dist/src/structures/Webhook.d.ts +160 -0
  480. package/dist/src/structures/Webhook.d.ts.map +1 -0
  481. package/dist/src/structures/Webhook.js +287 -0
  482. package/dist/src/structures/Webhook.js.map +1 -0
  483. package/dist/src/types/index.d.ts +199 -0
  484. package/dist/src/types/index.d.ts.map +1 -0
  485. package/dist/src/types/index.js +2 -0
  486. package/dist/src/types/index.js.map +1 -0
  487. package/dist/src/types/listeners.d.ts +579 -0
  488. package/dist/src/types/listeners.d.ts.map +1 -0
  489. package/dist/src/types/listeners.js +14 -0
  490. package/dist/src/types/listeners.js.map +1 -0
  491. package/dist/src/utils/LRUCache.d.ts +46 -0
  492. package/dist/src/utils/LRUCache.d.ts.map +1 -0
  493. package/dist/src/utils/LRUCache.js +78 -0
  494. package/dist/src/utils/LRUCache.js.map +1 -0
  495. package/dist/src/utils/cdn.d.ts +31 -0
  496. package/dist/src/utils/cdn.d.ts.map +1 -0
  497. package/dist/src/utils/cdn.js +18 -0
  498. package/dist/src/utils/cdn.js.map +1 -0
  499. package/dist/src/utils/customIdParser.d.ts +3 -0
  500. package/dist/src/utils/customIdParser.d.ts.map +1 -0
  501. package/dist/src/utils/customIdParser.js +38 -0
  502. package/dist/src/utils/customIdParser.js.map +1 -0
  503. package/dist/src/utils/index.d.ts +6 -0
  504. package/dist/src/utils/index.d.ts.map +1 -0
  505. package/dist/src/utils/index.js +6 -0
  506. package/dist/src/utils/index.js.map +1 -0
  507. package/dist/src/utils/payload.d.ts +4 -0
  508. package/dist/src/utils/payload.d.ts.map +1 -0
  509. package/dist/src/utils/payload.js +61 -0
  510. package/dist/src/utils/payload.js.map +1 -0
  511. package/dist/src/utils/proxy.d.ts +27 -0
  512. package/dist/src/utils/proxy.d.ts.map +1 -0
  513. package/dist/src/utils/proxy.js +135 -0
  514. package/dist/src/utils/proxy.js.map +1 -0
  515. package/dist/src/utils/verification.d.ts +4 -0
  516. package/dist/src/utils/verification.d.ts.map +1 -0
  517. package/dist/src/utils/verification.js +52 -0
  518. package/dist/src/utils/verification.js.map +1 -0
  519. package/dist/tsconfig.tsbuildinfo +1 -0
  520. package/package.json +43 -0
@@ -0,0 +1,253 @@
1
+ import { type APIApplicationCommand, type APIInteraction } from "discord-api-types/v10";
2
+ import type { BaseCommand } from "../abstracts/BaseCommand.js";
3
+ import type { BaseListener } from "../abstracts/BaseListener.js";
4
+ import type { BaseMessageInteractiveComponent } from "../abstracts/BaseMessageInteractiveComponent.js";
5
+ import type { Context, Plugin, Route } from "../abstracts/Plugin.js";
6
+ import { CommandHandler } from "../internals/CommandHandler.js";
7
+ import { ComponentHandler } from "../internals/ComponentHandler.js";
8
+ import { EmojiHandler } from "../internals/EmojiHandler.js";
9
+ import { EventHandler } from "../internals/EventHandler.js";
10
+ import type { EventQueueOptions } from "../internals/EventQueue.js";
11
+ import { ModalHandler } from "../internals/ModalHandler.js";
12
+ import { TemporaryListenerManager } from "../internals/TemporaryListenerManager.js";
13
+ import { Guild } from "../structures/Guild.js";
14
+ import { GuildMember } from "../structures/GuildMember.js";
15
+ import { Message } from "../structures/Message.js";
16
+ import { Role } from "../structures/Role.js";
17
+ import { User } from "../structures/User.js";
18
+ import { Webhook, type WebhookInput } from "../structures/Webhook.js";
19
+ import type { Modal } from "./Modal.js";
20
+ import { RequestClient, type RequestClientOptions } from "./RequestClient.js";
21
+ /**
22
+ * The options used for initializing the client
23
+ */
24
+ export interface ClientOptions {
25
+ /**
26
+ * The base URL of the app
27
+ */
28
+ baseUrl: string;
29
+ /**
30
+ * The client ID of the app
31
+ */
32
+ clientId: string;
33
+ /**
34
+ * The deploy secret of the app, used for protecting the deploy route
35
+ */
36
+ deploySecret?: string;
37
+ /**
38
+ * The public key of the app, used for interaction verification
39
+ * Can be a single key or an array of keys
40
+ */
41
+ publicKey: string | string[];
42
+ /**
43
+ * The token of the bot
44
+ */
45
+ token: string;
46
+ /**
47
+ * The options used to initialize the request client, if you want to customize it.
48
+ */
49
+ requestOptions?: RequestClientOptions;
50
+ /**
51
+ * Whether the commands should be deployed to Discord automatically.
52
+ * @default false
53
+ */
54
+ autoDeploy?: boolean;
55
+ /**
56
+ * Whether the deploy route should be disabled.
57
+ * @default false
58
+ */
59
+ disableDeployRoute?: boolean;
60
+ /**
61
+ * Whether the interactions route should be disabled
62
+ * @default false
63
+ */
64
+ disableInteractionsRoute?: boolean;
65
+ /**
66
+ * Whether the events route should be disabled
67
+ * @default false
68
+ */
69
+ disableEventsRoute?: boolean;
70
+ /**
71
+ * A list of guild IDs to deploy all commands to during development (guild command deployment is instant and rate-limited higher).
72
+ * If set, all commands will be deployed to these guilds instead of globally.
73
+ */
74
+ devGuilds?: string[];
75
+ /**
76
+ * Configuration for the event queue worker pool
77
+ */
78
+ eventQueue?: EventQueueOptions;
79
+ }
80
+ /**
81
+ * The main client used to interact with Discord
82
+ */
83
+ export declare class Client {
84
+ /**
85
+ * The routes that the client will handle
86
+ */
87
+ routes: Route[];
88
+ /**
89
+ * The plugins that the client has registered
90
+ */
91
+ plugins: {
92
+ id: string;
93
+ plugin: Plugin;
94
+ }[];
95
+ /**
96
+ * The options used to initialize the client
97
+ */
98
+ options: ClientOptions;
99
+ /**
100
+ * The commands that the client has registered
101
+ */
102
+ commands: BaseCommand[];
103
+ /**
104
+ * The event listeners that the client has registered
105
+ */
106
+ listeners: BaseListener[];
107
+ /**
108
+ * The rest client used to interact with the Discord API
109
+ */
110
+ rest: RequestClient;
111
+ /**
112
+ * The handler for the component interactions sent from Discord
113
+ * @internal
114
+ */
115
+ componentHandler: ComponentHandler;
116
+ /**
117
+ * The handler for the modal interactions sent from Discord
118
+ * @internal
119
+ */
120
+ commandHandler: CommandHandler;
121
+ /**
122
+ * The handler for the modal interactions sent from Discord
123
+ * @internal
124
+ */
125
+ modalHandler: ModalHandler;
126
+ /**
127
+ * The handler for events sent from Discord
128
+ * @internal
129
+ */
130
+ eventHandler: EventHandler;
131
+ /**
132
+ * The manager for temporary event listeners with automatic cleanup
133
+ */
134
+ temporaryListeners: TemporaryListenerManager;
135
+ /**
136
+ * The handler for application emojis for this application
137
+ */
138
+ emoji: EmojiHandler;
139
+ private cachedGlobalCommands;
140
+ /**
141
+ * The ID of the shard this client is running on, if sharding is enabled
142
+ */
143
+ shardId?: number;
144
+ /**
145
+ * The total number of shards, if sharding is enabled
146
+ */
147
+ totalShards?: number;
148
+ /**
149
+ * Creates a new client
150
+ * @param options The options used to initialize the client
151
+ * @param handlers The handlers that the client has registered
152
+ * @param plugins The plugins that the client should use
153
+ */
154
+ constructor(options: ClientOptions, handlers: {
155
+ commands?: BaseCommand[];
156
+ listeners?: BaseListener[];
157
+ components?: BaseMessageInteractiveComponent[];
158
+ modals?: Modal[];
159
+ }, plugins?: Plugin[]);
160
+ getPlugin<T extends Plugin>(id: string): T | undefined;
161
+ private appendRoutes;
162
+ /**
163
+ * Handle a request to deploy the commands to Discord
164
+ * @returns A response
165
+ */
166
+ handleDeployRequest(): Promise<Response>;
167
+ /**
168
+ * Handle an interaction request from Discord
169
+ * @param req The request to handle
170
+ * @returns A response
171
+ */
172
+ handleEventsRequest(req: Request): Promise<Response>;
173
+ /**
174
+ * Handle an interaction request from Discord
175
+ * @param req The request to handle
176
+ * @param ctx The context for the request
177
+ * @returns A response
178
+ */
179
+ handleInteractionsRequest(req: Request, ctx: Context): Promise<Response>;
180
+ /**
181
+ * Handle an interaction request from Discord
182
+ * @param interaction The interaction to handle
183
+ * @param ctx The context for the request
184
+ * @returns A response
185
+ */
186
+ handleInteraction(interaction: APIInteraction, ctx: Context): Promise<void>;
187
+ /**
188
+ * Validate a request from Discord
189
+ * @param req The request to validate
190
+ */
191
+ protected validateDiscordRequest(req: Request): Promise<boolean>;
192
+ /**
193
+ * Register an event listener with the client.
194
+ * This method provides type-safe listener registration without requiring
195
+ * manual type casting at the call site.
196
+ * @param listener The listener to register
197
+ */
198
+ registerListener<T extends BaseListener>(listener: T): void;
199
+ /**
200
+ * Fetch a user from the Discord API
201
+ * @param id The ID of the user to fetch
202
+ * @returns The user data
203
+ */
204
+ fetchUser(id: string): Promise<User<false>>;
205
+ /**
206
+ * Fetch a guild from the Discord API
207
+ * @param id The ID of the guild to fetch
208
+ * @returns The guild data
209
+ */
210
+ fetchGuild(id: string): Promise<Guild<false>>;
211
+ /**
212
+ * Fetch a channel from the Discord API
213
+ * @param id The ID of the channel to fetch
214
+ * @returns The channel data
215
+ */
216
+ fetchChannel(id: string): Promise<import("../index.js").DmChannel<false> | import("../index.js").GroupDmChannel<false> | import("../index.js").GuildTextChannel<false> | import("../index.js").GuildVoiceChannel<false> | import("../index.js").GuildCategoryChannel<false> | import("../index.js").GuildAnnouncementChannel<false> | import("../index.js").GuildThreadChannel<import("discord-api-types/v10").ChannelType.AnnouncementThread | import("discord-api-types/v10").ChannelType.PublicThread | import("discord-api-types/v10").ChannelType.PrivateThread, false> | import("../index.js").GuildStageChannel<false> | import("../index.js").GuildForumChannel<false> | import("../index.js").GuildMediaChannel | null>;
217
+ /**
218
+ * Fetch a role from the Discord API
219
+ * @param guildId The ID of the guild the role is in
220
+ * @param id The ID of the role to fetch
221
+ * @returns The role data
222
+ */
223
+ fetchRole(guildId: string, id: string): Promise<Role<false>>;
224
+ /**
225
+ * Fetch a member from the Discord API
226
+ * @param guildId The ID of the guild the member is in
227
+ * @param id The ID of the member to fetch
228
+ * @returns The member data
229
+ */
230
+ fetchMember(guildId: string, id: string): Promise<GuildMember<false, true>>;
231
+ /**
232
+ * Fetch a message from the Discord API
233
+ * @param channelId The ID of the channel the message is in
234
+ * @param messageId The ID of the message to fetch
235
+ * @returns The message data
236
+ */
237
+ fetchMessage(channelId: string, messageId: string): Promise<Message<false>>;
238
+ /**
239
+ * Fetch a webhook from the Discord API
240
+ * @param input The webhook data, ID and token, or webhook URL
241
+ * @returns The webhook data
242
+ */
243
+ fetchWebhook(input: WebhookInput): Promise<Webhook<false>>;
244
+ getDiscordCommands(force?: boolean): Promise<APIApplicationCommand[]>;
245
+ private updateCommandIdsFromDeployment;
246
+ }
247
+ /**
248
+ * @hidden
249
+ */
250
+ export interface ExecutionContext {
251
+ waitUntil(promise: Promise<any>): void;
252
+ }
253
+ //# sourceMappingURL=Client.d.ts.map
@@ -0,0 +1 @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AAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAO7C;;;;;OAKG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAOvD;;;;OAIG;IACG,YAAY,CAAC,KAAK,EAAE,YAAY;IAKzB,kBAAkB,CAAC,KAAK,UAAQ;IAY7C,OAAO,CAAC,8BAA8B;CAmBtC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAEhC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;CACtC"}
@@ -0,0 +1,419 @@
1
+ import { ApplicationWebhookType, InteractionResponseType, InteractionType, Routes } from "discord-api-types/v10";
2
+ import { channelFactory } from "../functions/channelFactory.js";
3
+ import { CommandHandler } from "../internals/CommandHandler.js";
4
+ import { ComponentHandler } from "../internals/ComponentHandler.js";
5
+ import { EmojiHandler } from "../internals/EmojiHandler.js";
6
+ import { EventHandler } from "../internals/EventHandler.js";
7
+ import { ModalHandler } from "../internals/ModalHandler.js";
8
+ import { TemporaryListenerManager } from "../internals/TemporaryListenerManager.js";
9
+ import { Guild } from "../structures/Guild.js";
10
+ import { GuildMember } from "../structures/GuildMember.js";
11
+ import { Message } from "../structures/Message.js";
12
+ import { Role } from "../structures/Role.js";
13
+ import { User } from "../structures/User.js";
14
+ import { Webhook } from "../structures/Webhook.js";
15
+ import { concatUint8Arrays, subtleCrypto, valueToUint8Array } from "../utils/index.js";
16
+ import { RequestClient } from "./RequestClient.js";
17
+ /**
18
+ * The main client used to interact with Discord
19
+ */
20
+ export class Client {
21
+ /**
22
+ * The routes that the client will handle
23
+ */
24
+ routes = [];
25
+ /**
26
+ * The plugins that the client has registered
27
+ */
28
+ plugins = [];
29
+ /**
30
+ * The options used to initialize the client
31
+ */
32
+ options;
33
+ /**
34
+ * The commands that the client has registered
35
+ */
36
+ commands;
37
+ /**
38
+ * The event listeners that the client has registered
39
+ */
40
+ listeners = [];
41
+ /**
42
+ * The rest client used to interact with the Discord API
43
+ */
44
+ rest;
45
+ /**
46
+ * The handler for the component interactions sent from Discord
47
+ * @internal
48
+ */
49
+ componentHandler;
50
+ /**
51
+ * The handler for the modal interactions sent from Discord
52
+ * @internal
53
+ */
54
+ commandHandler;
55
+ /**
56
+ * The handler for the modal interactions sent from Discord
57
+ * @internal
58
+ */
59
+ modalHandler;
60
+ /**
61
+ * The handler for events sent from Discord
62
+ * @internal
63
+ */
64
+ eventHandler;
65
+ /**
66
+ * The manager for temporary event listeners with automatic cleanup
67
+ */
68
+ temporaryListeners;
69
+ /**
70
+ * The handler for application emojis for this application
71
+ */
72
+ emoji;
73
+ cachedGlobalCommands = null;
74
+ /**
75
+ * The ID of the shard this client is running on, if sharding is enabled
76
+ */
77
+ shardId;
78
+ /**
79
+ * The total number of shards, if sharding is enabled
80
+ */
81
+ totalShards;
82
+ /**
83
+ * Creates a new client
84
+ * @param options The options used to initialize the client
85
+ * @param handlers The handlers that the client has registered
86
+ * @param plugins The plugins that the client should use
87
+ */
88
+ constructor(options, handlers, plugins = []) {
89
+ if (!options.clientId)
90
+ throw new Error("Missing client ID");
91
+ if (!options.publicKey)
92
+ throw new Error("Missing public key");
93
+ if (!options.token)
94
+ throw new Error("Missing token");
95
+ if (!options.deploySecret && !options.disableDeployRoute)
96
+ throw new Error("Missing deploy secret");
97
+ this.options = options;
98
+ this.commands = handlers.commands ?? [];
99
+ this.listeners = handlers.listeners ?? [];
100
+ // Remove trailing slashes from the base URL
101
+ options.baseUrl = options.baseUrl.replace(/\/+$/, "");
102
+ this.commandHandler = new CommandHandler(this);
103
+ this.componentHandler = new ComponentHandler(this);
104
+ this.modalHandler = new ModalHandler(this);
105
+ this.eventHandler = new EventHandler(this);
106
+ this.temporaryListeners = new TemporaryListenerManager(this);
107
+ this.emoji = new EmojiHandler(this);
108
+ for (const component of handlers.components ?? []) {
109
+ this.componentHandler.registerComponent(component);
110
+ }
111
+ for (const command of this.commands) {
112
+ for (const component of command.components ?? []) {
113
+ this.componentHandler.registerComponent(component);
114
+ }
115
+ }
116
+ for (const modal of handlers.modals ?? []) {
117
+ this.modalHandler.registerModal(modal);
118
+ }
119
+ this.rest = new RequestClient(options.token, options.requestOptions);
120
+ this.appendRoutes();
121
+ for (const plugin of plugins) {
122
+ plugin.registerClient?.(this);
123
+ plugin.registerRoutes?.(this);
124
+ this.plugins.push({ id: plugin.id, plugin });
125
+ }
126
+ if (options.autoDeploy) {
127
+ this.handleDeployRequest();
128
+ }
129
+ }
130
+ getPlugin(id) {
131
+ return this.plugins.find((p) => p.id === id)?.plugin;
132
+ }
133
+ appendRoutes() {
134
+ this.routes.push({
135
+ method: "GET",
136
+ path: "/deploy",
137
+ handler: this.handleDeployRequest.bind(this),
138
+ protected: true,
139
+ disabled: this.options.disableDeployRoute
140
+ });
141
+ this.routes.push({
142
+ method: "POST",
143
+ path: "/interactions",
144
+ handler: this.handleInteractionsRequest.bind(this),
145
+ disabled: this.options.disableInteractionsRoute
146
+ });
147
+ this.routes.push({
148
+ method: "POST",
149
+ path: "/events",
150
+ handler: this.handleEventsRequest.bind(this),
151
+ disabled: this.options.disableEventsRoute
152
+ });
153
+ }
154
+ /**
155
+ * Handle a request to deploy the commands to Discord
156
+ * @returns A response
157
+ */
158
+ async handleDeployRequest() {
159
+ const commands = this.commands.filter((c) => c.name !== "*");
160
+ const globalCommands = commands.filter((c) => !c.guildIds);
161
+ const guildCommandsMap = {};
162
+ for (const command of commands) {
163
+ if (command.guildIds) {
164
+ for (const guildId of command.guildIds) {
165
+ if (!guildCommandsMap[guildId])
166
+ guildCommandsMap[guildId] = [];
167
+ guildCommandsMap[guildId].push(command.serialize());
168
+ }
169
+ }
170
+ }
171
+ // If devGuilds is set, deploy all commands to those guilds (for development)
172
+ if (this.options.devGuilds && this.options.devGuilds.length > 0) {
173
+ for (const guildId of this.options.devGuilds) {
174
+ const deployed = (await this.rest.put(Routes.applicationGuildCommands(this.options.clientId, guildId), { body: commands.map((c) => c.serialize()) }));
175
+ this.updateCommandIdsFromDeployment(deployed);
176
+ }
177
+ return new Response("OK (devGuilds)", { status: 202 });
178
+ }
179
+ // Deploy guild-specific commands
180
+ for (const [guildId, cmds] of Object.entries(guildCommandsMap)) {
181
+ const deployed = (await this.rest.put(Routes.applicationGuildCommands(this.options.clientId, guildId), { body: cmds }));
182
+ this.updateCommandIdsFromDeployment(deployed);
183
+ }
184
+ // Deploy global commands
185
+ if (globalCommands.length > 0) {
186
+ const deployed = (await this.rest.put(Routes.applicationCommands(this.options.clientId), {
187
+ body: globalCommands.map((c) => c.serialize())
188
+ }));
189
+ this.updateCommandIdsFromDeployment(deployed);
190
+ this.cachedGlobalCommands = deployed;
191
+ }
192
+ return new Response("OK", { status: 202 });
193
+ }
194
+ /**
195
+ * Handle an interaction request from Discord
196
+ * @param req The request to handle
197
+ * @returns A response
198
+ */
199
+ async handleEventsRequest(req) {
200
+ const isValid = await this.validateDiscordRequest(req);
201
+ if (!isValid)
202
+ return new Response("Unauthorized", { status: 401 });
203
+ const payload = (await req.json());
204
+ if (payload.type === ApplicationWebhookType.Ping)
205
+ return new Response(null, { status: 204 });
206
+ const enqueued = this.eventHandler.handleEvent({ ...payload.event.data, clientId: this.options.clientId }, payload.event.type);
207
+ if (!enqueued) {
208
+ return new Response("Event queue full, retry later", { status: 429 });
209
+ }
210
+ return new Response(null, { status: 204 });
211
+ }
212
+ /**
213
+ * Handle an interaction request from Discord
214
+ * @param req The request to handle
215
+ * @param ctx The context for the request
216
+ * @returns A response
217
+ */
218
+ async handleInteractionsRequest(req, ctx) {
219
+ const isValid = await this.validateDiscordRequest(req);
220
+ if (!isValid)
221
+ return new Response("Unauthorized", { status: 401 });
222
+ const interaction = (await req.json());
223
+ if (interaction.type === InteractionType.Ping) {
224
+ return Response.json({ type: InteractionResponseType.Pong });
225
+ }
226
+ await this.handleInteraction(interaction, ctx);
227
+ return new Response("OK", { status: 202 });
228
+ }
229
+ /**
230
+ * Handle an interaction request from Discord
231
+ * @param interaction The interaction to handle
232
+ * @param ctx The context for the request
233
+ * @returns A response
234
+ */
235
+ async handleInteraction(interaction, ctx) {
236
+ if (interaction.type === InteractionType.ApplicationCommand) {
237
+ const promise = this.commandHandler.handleCommandInteraction(interaction);
238
+ if (ctx?.waitUntil)
239
+ ctx.waitUntil(promise);
240
+ else
241
+ await promise;
242
+ }
243
+ if (interaction.type === InteractionType.ApplicationCommandAutocomplete) {
244
+ const promise = this.commandHandler.handleAutocompleteInteraction(interaction);
245
+ if (ctx?.waitUntil)
246
+ ctx.waitUntil(promise);
247
+ else
248
+ await promise;
249
+ }
250
+ if (interaction.type === InteractionType.MessageComponent) {
251
+ const promise = this.componentHandler.handleInteraction(interaction);
252
+ if (ctx?.waitUntil)
253
+ ctx.waitUntil(promise);
254
+ else
255
+ await promise;
256
+ }
257
+ if (interaction.type === InteractionType.ModalSubmit) {
258
+ const promise = this.modalHandler.handleInteraction(interaction);
259
+ if (ctx?.waitUntil)
260
+ ctx.waitUntil(promise);
261
+ else
262
+ await promise;
263
+ }
264
+ }
265
+ /**
266
+ * Validate a request from Discord
267
+ * @param req The request to validate
268
+ */
269
+ async validateDiscordRequest(req) {
270
+ const body = await req.clone().text();
271
+ const signature = req.headers.get("X-Signature-Ed25519");
272
+ const timestamp = req.headers.get("X-Signature-Timestamp");
273
+ if (!timestamp || !signature || req.method !== "POST" || !body)
274
+ return false;
275
+ try {
276
+ const timestampData = valueToUint8Array(timestamp);
277
+ const bodyData = valueToUint8Array(body);
278
+ const message = concatUint8Arrays(timestampData, bodyData);
279
+ // Convert single key to array for consistent handling
280
+ const publicKeys = Array.isArray(this.options.publicKey)
281
+ ? this.options.publicKey
282
+ : [this.options.publicKey];
283
+ // Try each public key until one works
284
+ for (const publicKey of publicKeys) {
285
+ try {
286
+ const publicKeyBuffer = valueToUint8Array(publicKey, "hex");
287
+ const signatureBuffer = valueToUint8Array(signature, "hex");
288
+ // Create proper ArrayBuffer for Web Crypto API
289
+ const publicKeyArrayBuffer = new ArrayBuffer(publicKeyBuffer.length);
290
+ new Uint8Array(publicKeyArrayBuffer).set(publicKeyBuffer);
291
+ const signatureArrayBuffer = new ArrayBuffer(signatureBuffer.length);
292
+ new Uint8Array(signatureArrayBuffer).set(signatureBuffer);
293
+ const messageArrayBuffer = new ArrayBuffer(message.length);
294
+ new Uint8Array(messageArrayBuffer).set(message);
295
+ const isValid = await subtleCrypto.verify({
296
+ name: "ed25519"
297
+ }, await subtleCrypto.importKey("raw", publicKeyArrayBuffer, {
298
+ name: "ed25519",
299
+ namedCurve: "ed25519"
300
+ }, false, ["verify"]), signatureArrayBuffer, messageArrayBuffer);
301
+ if (isValid)
302
+ return true;
303
+ }
304
+ catch {
305
+ // Skip to next key if this one fails
306
+ }
307
+ }
308
+ return false;
309
+ }
310
+ catch (_) {
311
+ return false;
312
+ }
313
+ }
314
+ /**
315
+ * Register an event listener with the client.
316
+ * This method provides type-safe listener registration without requiring
317
+ * manual type casting at the call site.
318
+ * @param listener The listener to register
319
+ */
320
+ registerListener(listener) {
321
+ this.listeners.push(listener);
322
+ }
323
+ // ======================== Begin Fetchers ================================================
324
+ /**
325
+ * Fetch a user from the Discord API
326
+ * @param id The ID of the user to fetch
327
+ * @returns The user data
328
+ */
329
+ async fetchUser(id) {
330
+ const user = (await this.rest.get(Routes.user(id)));
331
+ return new User(this, user);
332
+ }
333
+ /**
334
+ * Fetch a guild from the Discord API
335
+ * @param id The ID of the guild to fetch
336
+ * @returns The guild data
337
+ */
338
+ async fetchGuild(id) {
339
+ const guild = (await this.rest.get(Routes.guild(id)));
340
+ return new Guild(this, guild);
341
+ }
342
+ /**
343
+ * Fetch a channel from the Discord API
344
+ * @param id The ID of the channel to fetch
345
+ * @returns The channel data
346
+ */
347
+ async fetchChannel(id) {
348
+ const channel = (await this.rest.get(Routes.channel(id)));
349
+ return channelFactory(this, channel);
350
+ }
351
+ /**
352
+ * Fetch a role from the Discord API
353
+ * @param guildId The ID of the guild the role is in
354
+ * @param id The ID of the role to fetch
355
+ * @returns The role data
356
+ */
357
+ async fetchRole(guildId, id) {
358
+ const role = (await this.rest.get(Routes.guildRole(guildId, id)));
359
+ return new Role(this, role, guildId);
360
+ }
361
+ /**
362
+ * Fetch a member from the Discord API
363
+ * @param guildId The ID of the guild the member is in
364
+ * @param id The ID of the member to fetch
365
+ * @returns The member data
366
+ */
367
+ async fetchMember(guildId, id) {
368
+ const member = (await this.rest.get(Routes.guildMember(guildId, id)));
369
+ return new GuildMember(this, member, new Guild(this, guildId));
370
+ }
371
+ /**
372
+ * Fetch a message from the Discord API
373
+ * @param channelId The ID of the channel the message is in
374
+ * @param messageId The ID of the message to fetch
375
+ * @returns The message data
376
+ */
377
+ async fetchMessage(channelId, messageId) {
378
+ const message = (await this.rest.get(Routes.channelMessage(channelId, messageId)));
379
+ return new Message(this, message);
380
+ }
381
+ /**
382
+ * Fetch a webhook from the Discord API
383
+ * @param input The webhook data, ID and token, or webhook URL
384
+ * @returns The webhook data
385
+ */
386
+ async fetchWebhook(input) {
387
+ const webhook = new Webhook(input);
388
+ return webhook.fetch();
389
+ }
390
+ async getDiscordCommands(force = false) {
391
+ if (!force && this.cachedGlobalCommands) {
392
+ return this.cachedGlobalCommands;
393
+ }
394
+ const commands = (await this.rest.get(Routes.applicationCommands(this.options.clientId)));
395
+ this.cachedGlobalCommands = commands;
396
+ this.updateCommandIdsFromDeployment(commands);
397
+ return commands;
398
+ }
399
+ updateCommandIdsFromDeployment(commands) {
400
+ for (const deployed of commands) {
401
+ const match = this.commands.find((command) => {
402
+ if (command.name !== deployed.name)
403
+ return false;
404
+ if (command.type !== deployed.type)
405
+ return false;
406
+ if (deployed.guild_id) {
407
+ if (!command.guildIds || command.guildIds.length === 0)
408
+ return true;
409
+ return command.guildIds.includes(deployed.guild_id);
410
+ }
411
+ return !command.guildIds || command.guildIds.length === 0;
412
+ });
413
+ if (match) {
414
+ match.id = deployed.id;
415
+ }
416
+ }
417
+ }
418
+ }
419
+ //# sourceMappingURL=Client.js.map