@buape/carbon 0.1.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 (428) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/.turbo/turbo-dev.log +12 -0
  3. package/.turbo/turbo-docs.log +10 -0
  4. package/CHANGELOG.md +14 -0
  5. package/LICENSE +21 -0
  6. package/README.md +45 -0
  7. package/dist/package.json +18 -0
  8. package/dist/src/abstracts/AnySelectMenu.d.ts +31 -0
  9. package/dist/src/abstracts/AnySelectMenu.d.ts.map +1 -0
  10. package/dist/src/abstracts/AnySelectMenu.js +19 -0
  11. package/dist/src/abstracts/AnySelectMenu.js.map +1 -0
  12. package/dist/src/abstracts/AnySelectMenuInteraction.d.ts +12 -0
  13. package/dist/src/abstracts/AnySelectMenuInteraction.d.ts.map +1 -0
  14. package/dist/src/abstracts/AnySelectMenuInteraction.js +21 -0
  15. package/dist/src/abstracts/AnySelectMenuInteraction.js.map +1 -0
  16. package/dist/src/abstracts/Base.d.ts +10 -0
  17. package/dist/src/abstracts/Base.d.ts.map +1 -0
  18. package/dist/src/abstracts/Base.js +11 -0
  19. package/dist/src/abstracts/Base.js.map +1 -0
  20. package/dist/src/abstracts/BaseChannel.d.ts +44 -0
  21. package/dist/src/abstracts/BaseChannel.d.ts.map +1 -0
  22. package/dist/src/abstracts/BaseChannel.js +58 -0
  23. package/dist/src/abstracts/BaseChannel.js.map +1 -0
  24. package/dist/src/abstracts/BaseCommand.d.ts +58 -0
  25. package/dist/src/abstracts/BaseCommand.d.ts.map +1 -0
  26. package/dist/src/abstracts/BaseCommand.js +69 -0
  27. package/dist/src/abstracts/BaseCommand.js.map +1 -0
  28. package/dist/src/abstracts/BaseComponent.d.ts +34 -0
  29. package/dist/src/abstracts/BaseComponent.d.ts.map +1 -0
  30. package/dist/src/abstracts/BaseComponent.js +30 -0
  31. package/dist/src/abstracts/BaseComponent.js.map +1 -0
  32. package/dist/src/abstracts/BaseComponentInteraction.d.ts +9 -0
  33. package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -0
  34. package/dist/src/abstracts/BaseComponentInteraction.js +14 -0
  35. package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -0
  36. package/dist/src/abstracts/BaseGuildChannel.d.ts +68 -0
  37. package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -0
  38. package/dist/src/abstracts/BaseGuildChannel.js +130 -0
  39. package/dist/src/abstracts/BaseGuildChannel.js.map +1 -0
  40. package/dist/src/abstracts/BaseGuildTextChannel.d.ts +42 -0
  41. package/dist/src/abstracts/BaseGuildTextChannel.d.ts.map +1 -0
  42. package/dist/src/abstracts/BaseGuildTextChannel.js +61 -0
  43. package/dist/src/abstracts/BaseGuildTextChannel.js.map +1 -0
  44. package/dist/src/abstracts/BaseInteraction.d.ts +87 -0
  45. package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -0
  46. package/dist/src/abstracts/BaseInteraction.js +101 -0
  47. package/dist/src/abstracts/BaseInteraction.js.map +1 -0
  48. package/dist/src/abstracts/ButtonInteraction.d.ts +8 -0
  49. package/dist/src/abstracts/ButtonInteraction.d.ts.map +1 -0
  50. package/dist/src/abstracts/ButtonInteraction.js +18 -0
  51. package/dist/src/abstracts/ButtonInteraction.js.map +1 -0
  52. package/dist/src/abstracts/ChannelSelectMenuInteraction.d.ts +7 -0
  53. package/dist/src/abstracts/ChannelSelectMenuInteraction.d.ts.map +1 -0
  54. package/dist/src/abstracts/ChannelSelectMenuInteraction.js +11 -0
  55. package/dist/src/abstracts/ChannelSelectMenuInteraction.js.map +1 -0
  56. package/dist/src/abstracts/CommandHandler.d.ts +6 -0
  57. package/dist/src/abstracts/CommandHandler.d.ts.map +1 -0
  58. package/dist/src/abstracts/CommandHandler.js +65 -0
  59. package/dist/src/abstracts/CommandHandler.js.map +1 -0
  60. package/dist/src/abstracts/CommandInteraction.d.ts +15 -0
  61. package/dist/src/abstracts/CommandInteraction.d.ts.map +1 -0
  62. package/dist/src/abstracts/CommandInteraction.js +60 -0
  63. package/dist/src/abstracts/CommandInteraction.js.map +1 -0
  64. package/dist/src/abstracts/ComponentHandler.d.ts +6 -0
  65. package/dist/src/abstracts/ComponentHandler.d.ts.map +1 -0
  66. package/dist/src/abstracts/ComponentHandler.js +64 -0
  67. package/dist/src/abstracts/ComponentHandler.js.map +1 -0
  68. package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +42 -0
  69. package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -0
  70. package/dist/src/abstracts/GuildThreadOnlyChannel.js +54 -0
  71. package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -0
  72. package/dist/src/abstracts/MentionableSelectMenuInteraction.d.ts +8 -0
  73. package/dist/src/abstracts/MentionableSelectMenuInteraction.d.ts.map +1 -0
  74. package/dist/src/abstracts/MentionableSelectMenuInteraction.js +15 -0
  75. package/dist/src/abstracts/MentionableSelectMenuInteraction.js.map +1 -0
  76. package/dist/src/abstracts/RoleSelectMenuInteraction.d.ts +8 -0
  77. package/dist/src/abstracts/RoleSelectMenuInteraction.d.ts.map +1 -0
  78. package/dist/src/abstracts/RoleSelectMenuInteraction.js +14 -0
  79. package/dist/src/abstracts/RoleSelectMenuInteraction.js.map +1 -0
  80. package/dist/src/abstracts/StringSelectMenuInteraction.d.ts +8 -0
  81. package/dist/src/abstracts/StringSelectMenuInteraction.d.ts.map +1 -0
  82. package/dist/src/abstracts/StringSelectMenuInteraction.js +14 -0
  83. package/dist/src/abstracts/StringSelectMenuInteraction.js.map +1 -0
  84. package/dist/src/abstracts/UserSelectMenuInteraction.d.ts +8 -0
  85. package/dist/src/abstracts/UserSelectMenuInteraction.d.ts.map +1 -0
  86. package/dist/src/abstracts/UserSelectMenuInteraction.js +14 -0
  87. package/dist/src/abstracts/UserSelectMenuInteraction.js.map +1 -0
  88. package/dist/src/classes/Button.d.ts +53 -0
  89. package/dist/src/classes/Button.d.ts.map +1 -0
  90. package/dist/src/classes/Button.js +55 -0
  91. package/dist/src/classes/Button.js.map +1 -0
  92. package/dist/src/classes/ChannelSelectMenu.d.ts +15 -0
  93. package/dist/src/classes/ChannelSelectMenu.d.ts.map +1 -0
  94. package/dist/src/classes/ChannelSelectMenu.js +15 -0
  95. package/dist/src/classes/ChannelSelectMenu.js.map +1 -0
  96. package/dist/src/classes/Client.d.ts +117 -0
  97. package/dist/src/classes/Client.d.ts.map +1 -0
  98. package/dist/src/classes/Client.js +170 -0
  99. package/dist/src/classes/Client.js.map +1 -0
  100. package/dist/src/classes/Command.d.ts +35 -0
  101. package/dist/src/classes/Command.d.ts.map +1 -0
  102. package/dist/src/classes/Command.js +31 -0
  103. package/dist/src/classes/Command.js.map +1 -0
  104. package/dist/src/classes/CommandWithSubcommandGroups.d.ts +22 -0
  105. package/dist/src/classes/CommandWithSubcommandGroups.d.ts.map +1 -0
  106. package/dist/src/classes/CommandWithSubcommandGroups.js +31 -0
  107. package/dist/src/classes/CommandWithSubcommandGroups.js.map +1 -0
  108. package/dist/src/classes/CommandWithSubcommands.d.ts +19 -0
  109. package/dist/src/classes/CommandWithSubcommands.d.ts.map +1 -0
  110. package/dist/src/classes/CommandWithSubcommands.js +21 -0
  111. package/dist/src/classes/CommandWithSubcommands.js.map +1 -0
  112. package/dist/src/classes/MentionableSelectMenu.d.ts +13 -0
  113. package/dist/src/classes/MentionableSelectMenu.d.ts.map +1 -0
  114. package/dist/src/classes/MentionableSelectMenu.js +13 -0
  115. package/dist/src/classes/MentionableSelectMenu.js.map +1 -0
  116. package/dist/src/classes/Paginator.d.ts +3 -0
  117. package/dist/src/classes/Paginator.d.ts.map +1 -0
  118. package/dist/src/classes/Paginator.js +3 -0
  119. package/dist/src/classes/Paginator.js.map +1 -0
  120. package/dist/src/classes/RoleSelectMenu.d.ts +13 -0
  121. package/dist/src/classes/RoleSelectMenu.d.ts.map +1 -0
  122. package/dist/src/classes/RoleSelectMenu.js +13 -0
  123. package/dist/src/classes/RoleSelectMenu.js.map +1 -0
  124. package/dist/src/classes/Row.d.ts +27 -0
  125. package/dist/src/classes/Row.d.ts.map +1 -0
  126. package/dist/src/classes/Row.js +39 -0
  127. package/dist/src/classes/Row.js.map +1 -0
  128. package/dist/src/classes/StringSelectMenu.d.ts +13 -0
  129. package/dist/src/classes/StringSelectMenu.d.ts.map +1 -0
  130. package/dist/src/classes/StringSelectMenu.js +12 -0
  131. package/dist/src/classes/StringSelectMenu.js.map +1 -0
  132. package/dist/src/classes/UserSelectMenu.d.ts +13 -0
  133. package/dist/src/classes/UserSelectMenu.d.ts.map +1 -0
  134. package/dist/src/classes/UserSelectMenu.js +13 -0
  135. package/dist/src/classes/UserSelectMenu.js.map +1 -0
  136. package/dist/src/factories/channelFactory.d.ts +13 -0
  137. package/dist/src/factories/channelFactory.d.ts.map +1 -0
  138. package/dist/src/factories/channelFactory.js +39 -0
  139. package/dist/src/factories/channelFactory.js.map +1 -0
  140. package/dist/src/index.d.ts +49 -0
  141. package/dist/src/index.d.ts.map +1 -0
  142. package/dist/src/index.js +55 -0
  143. package/dist/src/index.js.map +1 -0
  144. package/dist/src/internals/AutocompleteInteraction.d.ts +34 -0
  145. package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -0
  146. package/dist/src/internals/AutocompleteInteraction.js +68 -0
  147. package/dist/src/internals/AutocompleteInteraction.js.map +1 -0
  148. package/dist/src/internals/ButtonInteraction.d.ts +8 -0
  149. package/dist/src/internals/ButtonInteraction.d.ts.map +1 -0
  150. package/dist/src/internals/ButtonInteraction.js +18 -0
  151. package/dist/src/internals/ButtonInteraction.js.map +1 -0
  152. package/dist/src/internals/ChannelSelectMenuInteraction.d.ts +7 -0
  153. package/dist/src/internals/ChannelSelectMenuInteraction.d.ts.map +1 -0
  154. package/dist/src/internals/ChannelSelectMenuInteraction.js +11 -0
  155. package/dist/src/internals/ChannelSelectMenuInteraction.js.map +1 -0
  156. package/dist/src/internals/CommandHandler.d.ts +8 -0
  157. package/dist/src/internals/CommandHandler.d.ts.map +1 -0
  158. package/dist/src/internals/CommandHandler.js +81 -0
  159. package/dist/src/internals/CommandHandler.js.map +1 -0
  160. package/dist/src/internals/CommandInteraction.d.ts +17 -0
  161. package/dist/src/internals/CommandInteraction.d.ts.map +1 -0
  162. package/dist/src/internals/CommandInteraction.js +29 -0
  163. package/dist/src/internals/CommandInteraction.js.map +1 -0
  164. package/dist/src/internals/ComponentHandler.d.ts +6 -0
  165. package/dist/src/internals/ComponentHandler.d.ts.map +1 -0
  166. package/dist/src/internals/ComponentHandler.js +64 -0
  167. package/dist/src/internals/ComponentHandler.js.map +1 -0
  168. package/dist/src/internals/MentionableSelectMenuInteraction.d.ts +8 -0
  169. package/dist/src/internals/MentionableSelectMenuInteraction.d.ts.map +1 -0
  170. package/dist/src/internals/MentionableSelectMenuInteraction.js +15 -0
  171. package/dist/src/internals/MentionableSelectMenuInteraction.js.map +1 -0
  172. package/dist/src/internals/OptionsHandler.d.ts +70 -0
  173. package/dist/src/internals/OptionsHandler.d.ts.map +1 -0
  174. package/dist/src/internals/OptionsHandler.js +115 -0
  175. package/dist/src/internals/OptionsHandler.js.map +1 -0
  176. package/dist/src/internals/RoleSelectMenuInteraction.d.ts +8 -0
  177. package/dist/src/internals/RoleSelectMenuInteraction.d.ts.map +1 -0
  178. package/dist/src/internals/RoleSelectMenuInteraction.js +14 -0
  179. package/dist/src/internals/RoleSelectMenuInteraction.js.map +1 -0
  180. package/dist/src/internals/StringSelectMenuInteraction.d.ts +8 -0
  181. package/dist/src/internals/StringSelectMenuInteraction.d.ts.map +1 -0
  182. package/dist/src/internals/StringSelectMenuInteraction.js +14 -0
  183. package/dist/src/internals/StringSelectMenuInteraction.js.map +1 -0
  184. package/dist/src/internals/UserSelectMenuInteraction.d.ts +8 -0
  185. package/dist/src/internals/UserSelectMenuInteraction.d.ts.map +1 -0
  186. package/dist/src/internals/UserSelectMenuInteraction.js +14 -0
  187. package/dist/src/internals/UserSelectMenuInteraction.js.map +1 -0
  188. package/dist/src/structures/AnySelectMenu.d.ts +31 -0
  189. package/dist/src/structures/AnySelectMenu.d.ts.map +1 -0
  190. package/dist/src/structures/AnySelectMenu.js +19 -0
  191. package/dist/src/structures/AnySelectMenu.js.map +1 -0
  192. package/dist/src/structures/AnySelectMenuInteraction.d.ts +12 -0
  193. package/dist/src/structures/AnySelectMenuInteraction.d.ts.map +1 -0
  194. package/dist/src/structures/AnySelectMenuInteraction.js +21 -0
  195. package/dist/src/structures/AnySelectMenuInteraction.js.map +1 -0
  196. package/dist/src/structures/Base.d.ts +10 -0
  197. package/dist/src/structures/Base.d.ts.map +1 -0
  198. package/dist/src/structures/Base.js +11 -0
  199. package/dist/src/structures/Base.js.map +1 -0
  200. package/dist/src/structures/BaseCommand.d.ts +64 -0
  201. package/dist/src/structures/BaseCommand.d.ts.map +1 -0
  202. package/dist/src/structures/BaseCommand.js +58 -0
  203. package/dist/src/structures/BaseCommand.js.map +1 -0
  204. package/dist/src/structures/BaseComponent.d.ts +34 -0
  205. package/dist/src/structures/BaseComponent.d.ts.map +1 -0
  206. package/dist/src/structures/BaseComponent.js +30 -0
  207. package/dist/src/structures/BaseComponent.js.map +1 -0
  208. package/dist/src/structures/BaseComponentInteraction.d.ts +9 -0
  209. package/dist/src/structures/BaseComponentInteraction.d.ts.map +1 -0
  210. package/dist/src/structures/BaseComponentInteraction.js +14 -0
  211. package/dist/src/structures/BaseComponentInteraction.js.map +1 -0
  212. package/dist/src/structures/BaseInteraction.d.ts +81 -0
  213. package/dist/src/structures/BaseInteraction.d.ts.map +1 -0
  214. package/dist/src/structures/BaseInteraction.js +99 -0
  215. package/dist/src/structures/BaseInteraction.js.map +1 -0
  216. package/dist/src/structures/ButtonInteraction.d.ts +8 -0
  217. package/dist/src/structures/ButtonInteraction.d.ts.map +1 -0
  218. package/dist/src/structures/ButtonInteraction.js +18 -0
  219. package/dist/src/structures/ButtonInteraction.js.map +1 -0
  220. package/dist/src/structures/ChannelSelectMenuInteraction.d.ts +7 -0
  221. package/dist/src/structures/ChannelSelectMenuInteraction.d.ts.map +1 -0
  222. package/dist/src/structures/ChannelSelectMenuInteraction.js +11 -0
  223. package/dist/src/structures/ChannelSelectMenuInteraction.js.map +1 -0
  224. package/dist/src/structures/CommandHandler.d.ts +6 -0
  225. package/dist/src/structures/CommandHandler.d.ts.map +1 -0
  226. package/dist/src/structures/CommandHandler.js +70 -0
  227. package/dist/src/structures/CommandHandler.js.map +1 -0
  228. package/dist/src/structures/CommandInteraction.d.ts +15 -0
  229. package/dist/src/structures/CommandInteraction.d.ts.map +1 -0
  230. package/dist/src/structures/CommandInteraction.js +60 -0
  231. package/dist/src/structures/CommandInteraction.js.map +1 -0
  232. package/dist/src/structures/ComponentHandler.d.ts +6 -0
  233. package/dist/src/structures/ComponentHandler.d.ts.map +1 -0
  234. package/dist/src/structures/ComponentHandler.js +64 -0
  235. package/dist/src/structures/ComponentHandler.js.map +1 -0
  236. package/dist/src/structures/DmChannel.d.ts +18 -0
  237. package/dist/src/structures/DmChannel.d.ts.map +1 -0
  238. package/dist/src/structures/DmChannel.js +24 -0
  239. package/dist/src/structures/DmChannel.js.map +1 -0
  240. package/dist/src/structures/GroupDmChannel.d.ts +67 -0
  241. package/dist/src/structures/GroupDmChannel.d.ts.map +1 -0
  242. package/dist/src/structures/GroupDmChannel.js +109 -0
  243. package/dist/src/structures/GroupDmChannel.js.map +1 -0
  244. package/dist/src/structures/Guild.d.ts +71 -0
  245. package/dist/src/structures/Guild.d.ts.map +1 -0
  246. package/dist/src/structures/Guild.js +123 -0
  247. package/dist/src/structures/Guild.js.map +1 -0
  248. package/dist/src/structures/GuildAnnouncementChannel.d.ts +12 -0
  249. package/dist/src/structures/GuildAnnouncementChannel.d.ts.map +1 -0
  250. package/dist/src/structures/GuildAnnouncementChannel.js +17 -0
  251. package/dist/src/structures/GuildAnnouncementChannel.js.map +1 -0
  252. package/dist/src/structures/GuildCategoryChannel.d.ts +13 -0
  253. package/dist/src/structures/GuildCategoryChannel.d.ts.map +1 -0
  254. package/dist/src/structures/GuildCategoryChannel.js +14 -0
  255. package/dist/src/structures/GuildCategoryChannel.js.map +1 -0
  256. package/dist/src/structures/GuildForumChannel.d.ts +13 -0
  257. package/dist/src/structures/GuildForumChannel.d.ts.map +1 -0
  258. package/dist/src/structures/GuildForumChannel.js +14 -0
  259. package/dist/src/structures/GuildForumChannel.js.map +1 -0
  260. package/dist/src/structures/GuildMediaChannel.d.ts +13 -0
  261. package/dist/src/structures/GuildMediaChannel.d.ts.map +1 -0
  262. package/dist/src/structures/GuildMediaChannel.js +12 -0
  263. package/dist/src/structures/GuildMediaChannel.js.map +1 -0
  264. package/dist/src/structures/GuildStageOrVoiceChannel.d.ts +30 -0
  265. package/dist/src/structures/GuildStageOrVoiceChannel.d.ts.map +1 -0
  266. package/dist/src/structures/GuildStageOrVoiceChannel.js +34 -0
  267. package/dist/src/structures/GuildStageOrVoiceChannel.js.map +1 -0
  268. package/dist/src/structures/GuildTextChannel.d.ts +15 -0
  269. package/dist/src/structures/GuildTextChannel.d.ts.map +1 -0
  270. package/dist/src/structures/GuildTextChannel.js +18 -0
  271. package/dist/src/structures/GuildTextChannel.js.map +1 -0
  272. package/dist/src/structures/GuildThreadChannel.d.ts +89 -0
  273. package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -0
  274. package/dist/src/structures/GuildThreadChannel.js +134 -0
  275. package/dist/src/structures/GuildThreadChannel.js.map +1 -0
  276. package/dist/src/structures/MentionableSelectMenuInteraction.d.ts +8 -0
  277. package/dist/src/structures/MentionableSelectMenuInteraction.d.ts.map +1 -0
  278. package/dist/src/structures/MentionableSelectMenuInteraction.js +15 -0
  279. package/dist/src/structures/MentionableSelectMenuInteraction.js.map +1 -0
  280. package/dist/src/structures/Message.d.ts +52 -0
  281. package/dist/src/structures/Message.d.ts.map +1 -0
  282. package/dist/src/structures/Message.js +93 -0
  283. package/dist/src/structures/Message.js.map +1 -0
  284. package/dist/src/structures/Role.d.ts +106 -0
  285. package/dist/src/structures/Role.d.ts.map +1 -0
  286. package/dist/src/structures/Role.js +181 -0
  287. package/dist/src/structures/Role.js.map +1 -0
  288. package/dist/src/structures/RoleSelectMenuInteraction.d.ts +8 -0
  289. package/dist/src/structures/RoleSelectMenuInteraction.d.ts.map +1 -0
  290. package/dist/src/structures/RoleSelectMenuInteraction.js +14 -0
  291. package/dist/src/structures/RoleSelectMenuInteraction.js.map +1 -0
  292. package/dist/src/structures/StringSelectMenuInteraction.d.ts +8 -0
  293. package/dist/src/structures/StringSelectMenuInteraction.d.ts.map +1 -0
  294. package/dist/src/structures/StringSelectMenuInteraction.js +14 -0
  295. package/dist/src/structures/StringSelectMenuInteraction.js.map +1 -0
  296. package/dist/src/structures/User.d.ts +80 -0
  297. package/dist/src/structures/User.d.ts.map +1 -0
  298. package/dist/src/structures/User.js +133 -0
  299. package/dist/src/structures/User.js.map +1 -0
  300. package/dist/src/structures/UserSelectMenuInteraction.d.ts +8 -0
  301. package/dist/src/structures/UserSelectMenuInteraction.d.ts.map +1 -0
  302. package/dist/src/structures/UserSelectMenuInteraction.js +14 -0
  303. package/dist/src/structures/UserSelectMenuInteraction.js.map +1 -0
  304. package/dist/src/types.d.ts +31 -0
  305. package/dist/src/types.d.ts.map +1 -0
  306. package/dist/src/types.js +33 -0
  307. package/dist/src/types.js.map +1 -0
  308. package/dist/src/utils.d.ts +2 -0
  309. package/dist/src/utils.d.ts.map +1 -0
  310. package/dist/src/utils.js +11 -0
  311. package/dist/src/utils.js.map +1 -0
  312. package/dist/tsconfig.tsbuildinfo +1 -0
  313. package/docs/classes/AnySelectMenu.mdx +114 -0
  314. package/docs/classes/AnySelectMenuInteraction.mdx +161 -0
  315. package/docs/classes/AutocompleteInteraction.mdx +152 -0
  316. package/docs/classes/AutocompleteOptionsHandler.mdx +243 -0
  317. package/docs/classes/BaseChannel.mdx +97 -0
  318. package/docs/classes/BaseCommand.mdx +61 -0
  319. package/docs/classes/BaseComponent.mdx +55 -0
  320. package/docs/classes/BaseComponentInteraction.mdx +146 -0
  321. package/docs/classes/BaseGuildChannel.mdx +262 -0
  322. package/docs/classes/BaseGuildTextChannel.mdx +360 -0
  323. package/docs/classes/BaseInteraction.mdx +127 -0
  324. package/docs/classes/Button.mdx +99 -0
  325. package/docs/classes/ButtonInteraction.mdx +141 -0
  326. package/docs/classes/ChannelSelectMenu.mdx +122 -0
  327. package/docs/classes/ChannelSelectMenuInteraction.mdx +157 -0
  328. package/docs/classes/Client.mdx +48 -0
  329. package/docs/classes/Command.mdx +111 -0
  330. package/docs/classes/CommandHandler.mdx +65 -0
  331. package/docs/classes/CommandInteraction.mdx +141 -0
  332. package/docs/classes/CommandWithSubcommandGroups.mdx +73 -0
  333. package/docs/classes/CommandWithSubcommands.mdx +76 -0
  334. package/docs/classes/ComponentHandler.mdx +49 -0
  335. package/docs/classes/DmChannel.mdx +118 -0
  336. package/docs/classes/GroupDmChannel.mdx +197 -0
  337. package/docs/classes/Guild.mdx +139 -0
  338. package/docs/classes/GuildAnnouncementChannel.mdx +377 -0
  339. package/docs/classes/GuildCategoryChannel.mdx +272 -0
  340. package/docs/classes/GuildForumChannel.mdx +333 -0
  341. package/docs/classes/GuildMediaChannel.mdx +327 -0
  342. package/docs/classes/GuildStageChannel.mdx +276 -0
  343. package/docs/classes/GuildStageOrVoiceChannel.mdx +292 -0
  344. package/docs/classes/GuildTextChannel.mdx +367 -0
  345. package/docs/classes/GuildThreadChannel.mdx +425 -0
  346. package/docs/classes/GuildThreadOnlyChannel.mdx +333 -0
  347. package/docs/classes/GuildVoiceChannel.mdx +276 -0
  348. package/docs/classes/LinkButton.mdx +84 -0
  349. package/docs/classes/MentionableSelectMenu.mdx +120 -0
  350. package/docs/classes/MentionableSelectMenuInteraction.mdx +157 -0
  351. package/docs/classes/Message.mdx +126 -0
  352. package/docs/classes/OptionsHandler.mdx +203 -0
  353. package/docs/classes/PremiumButton.mdx +84 -0
  354. package/docs/classes/Role.mdx +228 -0
  355. package/docs/classes/RoleSelectMenu.mdx +120 -0
  356. package/docs/classes/RoleSelectMenuInteraction.mdx +157 -0
  357. package/docs/classes/Row.mdx +88 -0
  358. package/docs/classes/StringSelectMenu.mdx +120 -0
  359. package/docs/classes/StringSelectMenuInteraction.mdx +157 -0
  360. package/docs/classes/User.mdx +119 -0
  361. package/docs/classes/UserSelectMenu.mdx +120 -0
  362. package/docs/classes/UserSelectMenuInteraction.mdx +157 -0
  363. package/docs/enumerations/ClientMode.mdx +16 -0
  364. package/docs/functions/channelFactory.mdx +16 -0
  365. package/docs/index.mdx +83 -0
  366. package/docs/type-aliases/AnySelectMenuComponentType.mdx +5 -0
  367. package/docs/type-aliases/ClientOptions.mdx +20 -0
  368. package/docs/type-aliases/CommandOptions.mdx +5 -0
  369. package/docs/type-aliases/ComponentAdditionalData.mdx +9 -0
  370. package/docs/type-aliases/InteractionFileData.mdx +15 -0
  371. package/docs/type-aliases/InteractionReplyData.mdx +14 -0
  372. package/docs/type-aliases/InteractionReplyOptions.mdx +13 -0
  373. package/docs/type-aliases/RawOptions.mdx +9 -0
  374. package/docs/type-aliases/meta.json +3 -0
  375. package/package.json +18 -0
  376. package/src/README.md +7 -0
  377. package/src/abstracts/AnySelectMenu.ts +63 -0
  378. package/src/abstracts/AnySelectMenuInteraction.ts +29 -0
  379. package/src/abstracts/Base.ts +12 -0
  380. package/src/abstracts/BaseChannel.ts +73 -0
  381. package/src/abstracts/BaseCommand.ts +95 -0
  382. package/src/abstracts/BaseComponent.ts +49 -0
  383. package/src/abstracts/BaseComponentInteraction.ts +19 -0
  384. package/src/abstracts/BaseGuildChannel.ts +152 -0
  385. package/src/abstracts/BaseGuildTextChannel.ts +77 -0
  386. package/src/abstracts/BaseInteraction.ts +170 -0
  387. package/src/abstracts/GuildThreadOnlyChannel.ts +71 -0
  388. package/src/classes/Button.ts +95 -0
  389. package/src/classes/ChannelSelectMenu.ts +21 -0
  390. package/src/classes/Client.ts +249 -0
  391. package/src/classes/Command.ts +51 -0
  392. package/src/classes/CommandWithSubcommandGroups.ts +47 -0
  393. package/src/classes/CommandWithSubcommands.ts +35 -0
  394. package/src/classes/MentionableSelectMenu.ts +19 -0
  395. package/src/classes/RoleSelectMenu.ts +19 -0
  396. package/src/classes/Row.ts +44 -0
  397. package/src/classes/StringSelectMenu.ts +19 -0
  398. package/src/classes/UserSelectMenu.ts +19 -0
  399. package/src/factories/channelFactory.ts +43 -0
  400. package/src/index.ts +59 -0
  401. package/src/internals/AutocompleteInteraction.ts +107 -0
  402. package/src/internals/ButtonInteraction.ts +26 -0
  403. package/src/internals/ChannelSelectMenuInteraction.ts +15 -0
  404. package/src/internals/CommandHandler.ts +123 -0
  405. package/src/internals/CommandInteraction.ts +49 -0
  406. package/src/internals/ComponentHandler.ts +81 -0
  407. package/src/internals/MentionableSelectMenuInteraction.ts +21 -0
  408. package/src/internals/OptionsHandler.ts +147 -0
  409. package/src/internals/RoleSelectMenuInteraction.ts +20 -0
  410. package/src/internals/StringSelectMenuInteraction.ts +20 -0
  411. package/src/internals/UserSelectMenuInteraction.ts +20 -0
  412. package/src/structures/DmChannel.ts +31 -0
  413. package/src/structures/GroupDmChannel.ts +132 -0
  414. package/src/structures/Guild.ts +142 -0
  415. package/src/structures/GuildAnnouncementChannel.ts +20 -0
  416. package/src/structures/GuildCategoryChannel.ts +16 -0
  417. package/src/structures/GuildForumChannel.ts +20 -0
  418. package/src/structures/GuildMediaChannel.ts +13 -0
  419. package/src/structures/GuildStageOrVoiceChannel.ts +46 -0
  420. package/src/structures/GuildTextChannel.ts +21 -0
  421. package/src/structures/GuildThreadChannel.ts +150 -0
  422. package/src/structures/Message.ts +124 -0
  423. package/src/structures/Role.ts +201 -0
  424. package/src/structures/User.ts +153 -0
  425. package/src/utils.ts +13 -0
  426. package/tests/index.test.ts +4 -0
  427. package/tsconfig.json +12 -0
  428. package/typedoc.json +9 -0
@@ -0,0 +1,249 @@
1
+ import { RequestClient, type RequestClientOptions } from "@buape/carbon-request"
2
+ import {
3
+ type APIInteraction,
4
+ InteractionResponseType,
5
+ InteractionType,
6
+ Routes
7
+ } from "discord-api-types/v10"
8
+ import { PlatformAlgorithm, isValidRequest } from "discord-verify"
9
+ import { AutoRouter, type IRequestStrict, StatusError, json } from "itty-router"
10
+ import type { BaseCommand } from "../abstracts/BaseCommand.js"
11
+ import { CommandHandler } from "../internals/CommandHandler.js"
12
+ import { ComponentHandler } from "../internals/ComponentHandler.js"
13
+
14
+ /**
15
+ * The mode that the client is running in.
16
+ * Different platforms have different requirements for how processes are handled.
17
+ */
18
+ export enum ClientMode {
19
+ NodeJS = "node",
20
+ CloudflareWorkers = "cloudflare",
21
+ Bun = "bun",
22
+ Vercel = "vercel",
23
+ Web = "web"
24
+ }
25
+
26
+ /**
27
+ * The options used for initializing the client
28
+ */
29
+ export type ClientOptions = {
30
+ /**
31
+ * If you want to have the root route for the interaction handler redirect to a different URL, you can set this.
32
+ */
33
+ redirectUrl?: string
34
+ /**
35
+ * The client ID of the bot
36
+ */
37
+ clientId: string
38
+ /**
39
+ * The public key of the bot, used for interaction verification
40
+ */
41
+ publicKey: string
42
+ /**
43
+ * The token of the bot
44
+ */
45
+ token: string
46
+ /**
47
+ * The mode of the client, generally where you are hosting the bot. If you have a different mode for your local development, make sure to set it to the local one.
48
+ * @example
49
+ * ```ts
50
+ * import { Client, ClientMode } from "@buape/carbon"
51
+ *
52
+ * const client = new Client({
53
+ * clientId: "12345678901234567890",
54
+ * publicKey: "c1a2f941ae8ce6d776f7704d0bb3d46b863e21fda491cdb2bdba6b8bc5fe7269",
55
+ * token: "MTA4NjEwNTYxMDUxMDE1NTg1Nw.GNt-U8.OSHy-g-5FlfESnu3Z9MEEMJLHiRthXajiXNwiE",
56
+ * mode: process.env.NODE_ENV === "development" ? ClientMode.NodeJS : ClientMode.CloudflareWorkers
57
+ * })
58
+ * ```
59
+ */
60
+ mode: ClientMode
61
+ /**
62
+ * The options used to initialize the request client, if you want to customize it.
63
+ */
64
+ requestOptions?: RequestClientOptions
65
+ /**
66
+ * The port to run the server on, if you are using {@link ClientMode.Bun} mode.
67
+ */
68
+ port?: number
69
+ /**
70
+ * Whether the commands should be deployed to Discord automatically.
71
+ */
72
+ autoDeploy?: boolean
73
+ }
74
+
75
+ /**
76
+ * The main client used to interact with Discord
77
+ */
78
+ export class Client {
79
+ /**
80
+ * The options used to initialize the client
81
+ */
82
+ options: ClientOptions
83
+ /**
84
+ * The commands that the client has registered
85
+ */
86
+ commands: BaseCommand[]
87
+ /**
88
+ * The router used to handle requests
89
+ */
90
+ router: ReturnType<typeof AutoRouter<IRequestStrict>>
91
+ /**
92
+ * The rest client used to interact with the Discord API
93
+ */
94
+ rest: RequestClient
95
+ /**
96
+ * The handler for the component interactions sent from Discord
97
+ */
98
+ componentHandler: ComponentHandler
99
+ commandHandler: CommandHandler
100
+
101
+ /**
102
+ * Creates a new client
103
+ * @param options The options used to initialize the client
104
+ * @param commands The commands that the client has registered
105
+ */
106
+ constructor(options: ClientOptions, commands: BaseCommand[]) {
107
+ if (!options.clientId) throw new Error("Missing client ID")
108
+ if (!options.publicKey) throw new Error("Missing public key")
109
+ if (!options.token) throw new Error("Missing token")
110
+ this.options = options
111
+ this.commands = commands
112
+ const routerData =
113
+ this.options.mode === ClientMode.Bun && this.options.port
114
+ ? { port: this.options.port }
115
+ : {}
116
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
117
+ this.router = AutoRouter<IRequestStrict, any[], Response>(routerData)
118
+ this.rest = new RequestClient(options.token, options.requestOptions)
119
+ this.componentHandler = new ComponentHandler(this)
120
+ this.commandHandler = new CommandHandler(this)
121
+ this.setupRoutes()
122
+ if (this.options.autoDeploy) this.deployCommands()
123
+ }
124
+
125
+ /**
126
+ * Deploy the commands registered to Discord.
127
+ * This is automatically called when running in NodeJS mode.
128
+ */
129
+ async deployCommands() {
130
+ try {
131
+ const commands = this.commands.map((command) => {
132
+ return command.serialize()
133
+ })
134
+ await this.rest.put(Routes.applicationCommands(this.options.clientId), {
135
+ body: commands
136
+ })
137
+ console.log(`Deployed ${commands.length} commands to Discord`)
138
+ } catch (err) {
139
+ console.error("Failed to deploy commands")
140
+ console.error(err)
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Setup the routes for the client
146
+ */
147
+ private setupRoutes() {
148
+ this.router.get("/", () => {
149
+ if (this.options.redirectUrl)
150
+ return Response.redirect(this.options.redirectUrl, 302)
151
+ throw new StatusError(404)
152
+ })
153
+ this.router.post("/interaction", async (req, ctx?: ExecutionContext) => {
154
+ const isValid = await this.validateInteraction(req)
155
+ if (!isValid) {
156
+ return new Response("Invalid request signature", { status: 401 })
157
+ }
158
+
159
+ const rawInteraction = (await req.json()) as unknown as APIInteraction
160
+ if (rawInteraction.type === InteractionType.Ping) {
161
+ return json({
162
+ type: InteractionResponseType.Pong
163
+ })
164
+ }
165
+
166
+ if (rawInteraction.type === InteractionType.ApplicationCommand) {
167
+ if (ctx?.waitUntil) {
168
+ ctx.waitUntil(
169
+ (async () => {
170
+ await this.commandHandler.handleCommandInteraction(rawInteraction)
171
+ })()
172
+ )
173
+ } else {
174
+ await this.commandHandler.handleCommandInteraction(rawInteraction)
175
+ }
176
+ }
177
+ if (
178
+ rawInteraction.type === InteractionType.ApplicationCommandAutocomplete
179
+ ) {
180
+ if (ctx?.waitUntil) {
181
+ ctx.waitUntil(
182
+ (async () => {
183
+ await this.commandHandler.handleAutocompleteInteraction(
184
+ rawInteraction
185
+ )
186
+ })()
187
+ )
188
+ } else {
189
+ await this.commandHandler.handleAutocompleteInteraction(
190
+ rawInteraction
191
+ )
192
+ }
193
+ }
194
+ if (rawInteraction.type === InteractionType.ApplicationCommand) {
195
+ if (ctx?.waitUntil) {
196
+ ctx.waitUntil(
197
+ (async () => {
198
+ await this.commandHandler.handleCommandInteraction(rawInteraction)
199
+ })()
200
+ )
201
+ } else {
202
+ await this.commandHandler.handleCommandInteraction(rawInteraction)
203
+ }
204
+ }
205
+ if (rawInteraction.type === InteractionType.MessageComponent) {
206
+ if (ctx?.waitUntil) {
207
+ ctx.waitUntil(
208
+ (async () => {
209
+ await this.componentHandler.handleInteraction(rawInteraction)
210
+ })()
211
+ )
212
+ } else {
213
+ await this.componentHandler.handleInteraction(rawInteraction)
214
+ }
215
+ }
216
+ return new Response(null, { status: 202 })
217
+ })
218
+ }
219
+
220
+ /**
221
+ * Validate the interaction request
222
+ * @param req The request to validate
223
+ */
224
+ private async validateInteraction(req: IRequestStrict) {
225
+ if (req.method !== "POST") {
226
+ throw new StatusError(405)
227
+ }
228
+ const isValid = await isValidRequest(
229
+ req,
230
+ this.options.publicKey,
231
+ this.options.mode === ClientMode.CloudflareWorkers
232
+ ? PlatformAlgorithm.Cloudflare
233
+ : this.options.mode === ClientMode.Vercel
234
+ ? PlatformAlgorithm.VercelProd
235
+ : this.options.mode === ClientMode.Web
236
+ ? PlatformAlgorithm.Web
237
+ : PlatformAlgorithm.NewNode
238
+ )
239
+ return isValid
240
+ }
241
+ }
242
+
243
+ /**
244
+ * @hidden
245
+ */
246
+ export interface ExecutionContext {
247
+ // biome-ignore lint/suspicious/noExplicitAny: true any
248
+ waitUntil(promise: Promise<any>): void
249
+ }
@@ -0,0 +1,51 @@
1
+ import {
2
+ type APIApplicationCommandBasicOption,
3
+ ApplicationCommandType
4
+ } from "discord-api-types/v10"
5
+ import { BaseCommand } from "../abstracts/BaseCommand.js"
6
+ import type { CommandInteraction } from "../internals/CommandInteraction.js"
7
+ import type { AutocompleteInteraction } from "../internals/AutocompleteInteraction.js"
8
+
9
+ export type CommandOptions = APIApplicationCommandBasicOption[]
10
+
11
+ /**
12
+ * Represents a standard command that the user creates
13
+ */
14
+ export abstract class Command extends BaseCommand {
15
+ /**
16
+ * The options that the user passes along with the command in Discord
17
+ */
18
+ options?: CommandOptions
19
+
20
+ /**
21
+ * The type of command, either ChatInput, User, or Message. User and Message are context menu commands.
22
+ * @default ChatInput
23
+ */
24
+ type: ApplicationCommandType = ApplicationCommandType.ChatInput
25
+
26
+ /**
27
+ * The function that is called when the command is ran
28
+ * @param interaction The interaction that triggered the command
29
+ */
30
+ abstract run(interaction: CommandInteraction): Promise<void>
31
+
32
+ /**
33
+ * The function that is called when the command's autocomplete is triggered.
34
+ * @param interaction The interaction that triggered the autocomplete
35
+ * @remarks You are expected to `override` this function to provide your own autocomplete functionality.
36
+ */
37
+ public async autocomplete(
38
+ interaction: AutocompleteInteraction
39
+ ): Promise<void> {
40
+ throw new Error(
41
+ `The ${interaction.rawData.data.name} command does not support autocomplete`
42
+ )
43
+ }
44
+
45
+ /**
46
+ * @internal
47
+ */
48
+ serializeOptions() {
49
+ return this.options
50
+ }
51
+ }
@@ -0,0 +1,47 @@
1
+ import {
2
+ type APIApplicationCommandBasicOption,
3
+ type APIApplicationCommandSubcommandGroupOption,
4
+ type APIApplicationCommandSubcommandOption,
5
+ ApplicationCommandOptionType
6
+ } from "discord-api-types/v10"
7
+ import type { Command } from "./Command.js"
8
+ import { CommandWithSubcommands } from "./CommandWithSubcommands.js"
9
+
10
+ /**
11
+ * Represents a subcommand group command that the user creates.
12
+ * You make this instead of a {@link Command} class when you want to have subcommand groups in your options.
13
+ */
14
+ export abstract class CommandWithSubcommandGroups extends CommandWithSubcommands {
15
+ /**
16
+ * The subcommands that the user can use
17
+ */
18
+ subcommands: Command[] = []
19
+
20
+ /**
21
+ * The subcommands that the user can use
22
+ */
23
+ abstract subcommandGroups: CommandWithSubcommands[]
24
+
25
+ /**
26
+ * @internal
27
+ */
28
+ serializeOptions() {
29
+ const subcommands = this.subcommands.map((subcommand) => ({
30
+ name: subcommand.name,
31
+ description: subcommand.description,
32
+ type: ApplicationCommandOptionType.Subcommand,
33
+ options:
34
+ subcommand.serializeOptions() as APIApplicationCommandBasicOption[]
35
+ })) as APIApplicationCommandSubcommandOption[]
36
+
37
+ const subcommandGroups = this.subcommandGroups.map((subcommandGroup) => ({
38
+ name: subcommandGroup.name,
39
+ description: subcommandGroup.description,
40
+ type: ApplicationCommandOptionType.SubcommandGroup,
41
+ options:
42
+ subcommandGroup.serializeOptions() as APIApplicationCommandSubcommandOption[]
43
+ })) as APIApplicationCommandSubcommandGroupOption[]
44
+
45
+ return [...subcommands, ...subcommandGroups]
46
+ }
47
+ }
@@ -0,0 +1,35 @@
1
+ import {
2
+ type APIApplicationCommandBasicOption,
3
+ type APIApplicationCommandSubcommandOption,
4
+ ApplicationCommandOptionType,
5
+ ApplicationCommandType,
6
+ type RESTPostAPIApplicationCommandsJSONBody
7
+ } from "discord-api-types/v10"
8
+ import { BaseCommand } from "../abstracts/BaseCommand.js"
9
+ import type { Command } from "./Command.js"
10
+
11
+ /**
12
+ * Represents a subcommand command that the user creates.
13
+ * You make this instead of a {@link Command} class when you want to have subcommands in your options.
14
+ */
15
+ export abstract class CommandWithSubcommands extends BaseCommand {
16
+ type = ApplicationCommandType.ChatInput
17
+
18
+ /**
19
+ * The subcommands that the user can use
20
+ */
21
+ abstract subcommands: Command[]
22
+
23
+ /**
24
+ * @internal
25
+ */
26
+ serializeOptions(): RESTPostAPIApplicationCommandsJSONBody["options"] {
27
+ return this.subcommands.map((subcommand) => ({
28
+ name: subcommand.name,
29
+ description: subcommand.description,
30
+ type: ApplicationCommandOptionType.Subcommand,
31
+ options:
32
+ subcommand.serializeOptions() as APIApplicationCommandBasicOption[]
33
+ })) as APIApplicationCommandSubcommandOption[]
34
+ }
35
+ }
@@ -0,0 +1,19 @@
1
+ import {
2
+ type APIMentionableSelectComponent,
3
+ ComponentType
4
+ } from "discord-api-types/v10"
5
+ import { AnySelectMenu } from "../abstracts/AnySelectMenu.js"
6
+ import type { MentionableSelectMenuInteraction } from "../internals/MentionableSelectMenuInteraction.js"
7
+
8
+ export abstract class MentionableSelectMenu extends AnySelectMenu {
9
+ type: ComponentType.MentionableSelect = ComponentType.MentionableSelect
10
+ defaultValues?: APIMentionableSelectComponent["default_values"]
11
+ abstract run(interaction: MentionableSelectMenuInteraction): Promise<void>
12
+
13
+ serializeOptions() {
14
+ return {
15
+ type: this.type,
16
+ default_values: this.defaultValues
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,19 @@
1
+ import {
2
+ type APIRoleSelectComponent,
3
+ ComponentType
4
+ } from "discord-api-types/v10"
5
+ import { AnySelectMenu } from "../abstracts/AnySelectMenu.js"
6
+ import type { RoleSelectMenuInteraction } from "../internals/RoleSelectMenuInteraction.js"
7
+
8
+ export abstract class RoleSelectMenu extends AnySelectMenu {
9
+ type: ComponentType.RoleSelect = ComponentType.RoleSelect
10
+ defaultValues?: APIRoleSelectComponent["default_values"]
11
+ abstract run(interaction: RoleSelectMenuInteraction): Promise<void>
12
+
13
+ serializeOptions() {
14
+ return {
15
+ type: this.type,
16
+ default_values: this.defaultValues
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,44 @@
1
+ import type { BaseComponent } from "../abstracts/BaseComponent.js"
2
+
3
+ export class Row {
4
+ /**
5
+ * The components in the action row
6
+ */
7
+ components: BaseComponent[]
8
+
9
+ constructor(components: BaseComponent[]) {
10
+ this.components = components
11
+ }
12
+
13
+ /**
14
+ * Add a component to the action row
15
+ * @param component The component to add
16
+ */
17
+ addComponent(component: BaseComponent) {
18
+ this.components.push(component)
19
+ }
20
+
21
+ /**
22
+ * Remove a component from the action row
23
+ * @param component The component to remove
24
+ */
25
+ removeComponent(component: BaseComponent) {
26
+ const index = this.components.indexOf(component)
27
+ if (index === -1) return
28
+ this.components.splice(index, 1)
29
+ }
30
+
31
+ /**
32
+ * Remove all components from the action row
33
+ */
34
+ removeAllComponents() {
35
+ this.components = []
36
+ }
37
+
38
+ serialize() {
39
+ return {
40
+ type: 1,
41
+ components: this.components.map((component) => component.serialize())
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,19 @@
1
+ import {
2
+ type APIStringSelectComponent,
3
+ ComponentType
4
+ } from "discord-api-types/v10"
5
+ import { AnySelectMenu } from "../abstracts/AnySelectMenu.js"
6
+ import type { StringSelectMenuInteraction } from "../internals/StringSelectMenuInteraction.js"
7
+
8
+ export abstract class StringSelectMenu extends AnySelectMenu {
9
+ type: ComponentType.StringSelect = ComponentType.StringSelect
10
+ abstract options: APIStringSelectComponent["options"]
11
+ abstract run(interaction: StringSelectMenuInteraction): Promise<void>
12
+
13
+ serializeOptions() {
14
+ return {
15
+ type: this.type,
16
+ options: this.options
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,19 @@
1
+ import {
2
+ type APIUserSelectComponent,
3
+ ComponentType
4
+ } from "discord-api-types/v10"
5
+ import { AnySelectMenu } from "../abstracts/AnySelectMenu.js"
6
+ import type { UserSelectMenuInteraction } from "../internals/UserSelectMenuInteraction.js"
7
+
8
+ export abstract class UserSelectMenu extends AnySelectMenu {
9
+ type: ComponentType.UserSelect = ComponentType.UserSelect
10
+ defaultValues?: APIUserSelectComponent["default_values"]
11
+ abstract run(interaction: UserSelectMenuInteraction): Promise<void>
12
+
13
+ serializeOptions() {
14
+ return {
15
+ type: this.type,
16
+ default_values: this.defaultValues
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,43 @@
1
+ import { type APIChannel, ChannelType } from "discord-api-types/v10"
2
+ import type { Client } from "../classes/Client.js"
3
+ import { DmChannel } from "../structures/DmChannel.js"
4
+ import { GroupDmChannel } from "../structures/GroupDmChannel.js"
5
+ import { GuildAnnouncementChannel } from "../structures/GuildAnnouncementChannel.js"
6
+ import { GuildCategoryChannel } from "../structures/GuildCategoryChannel.js"
7
+ import { GuildForumChannel } from "../structures/GuildForumChannel.js"
8
+ import { GuildMediaChannel } from "../structures/GuildMediaChannel.js"
9
+ import {
10
+ GuildStageChannel,
11
+ GuildVoiceChannel
12
+ } from "../structures/GuildStageOrVoiceChannel.js"
13
+ import { GuildTextChannel } from "../structures/GuildTextChannel.js"
14
+ import { GuildThreadChannel } from "../structures/GuildThreadChannel.js"
15
+
16
+ export const channelFactory = (client: Client, channelData: APIChannel) => {
17
+ switch (channelData.type) {
18
+ case ChannelType.DM:
19
+ return new DmChannel(client, channelData)
20
+ case ChannelType.GroupDM:
21
+ return new GroupDmChannel(client, channelData)
22
+ case ChannelType.GuildText:
23
+ return new GuildTextChannel(client, channelData)
24
+ case ChannelType.GuildVoice:
25
+ return new GuildVoiceChannel(client, channelData)
26
+ case ChannelType.GuildCategory:
27
+ return new GuildCategoryChannel(client, channelData)
28
+ case ChannelType.GuildAnnouncement:
29
+ return new GuildAnnouncementChannel(client, channelData)
30
+ case ChannelType.AnnouncementThread:
31
+ case ChannelType.PublicThread:
32
+ case ChannelType.PrivateThread:
33
+ return new GuildThreadChannel(client, channelData)
34
+ case ChannelType.GuildStageVoice:
35
+ return new GuildStageChannel(client, channelData)
36
+ case ChannelType.GuildForum:
37
+ return new GuildForumChannel(client, channelData)
38
+ case ChannelType.GuildMedia:
39
+ return new GuildMediaChannel(client, channelData)
40
+ default:
41
+ return null
42
+ }
43
+ }
package/src/index.ts ADDED
@@ -0,0 +1,59 @@
1
+ // ----- Abstracts -----
2
+ export * from "./abstracts/AnySelectMenu.js"
3
+ export * from "./abstracts/AnySelectMenuInteraction.js"
4
+ export * from "./abstracts/Base.js"
5
+ export * from "./abstracts/BaseChannel.js"
6
+ export * from "./abstracts/BaseCommand.js"
7
+ export * from "./abstracts/BaseComponent.js"
8
+ export * from "./abstracts/BaseComponentInteraction.js"
9
+ export * from "./abstracts/BaseGuildChannel.js"
10
+ export * from "./abstracts/BaseGuildTextChannel.js"
11
+ export * from "./abstracts/BaseInteraction.js"
12
+ export * from "./abstracts/GuildThreadOnlyChannel.js"
13
+
14
+ // ----- Classes -----
15
+ export * from "./classes/Button.js"
16
+ export * from "./classes/ChannelSelectMenu.js"
17
+ export * from "./classes/Client.js"
18
+ export * from "./classes/Command.js"
19
+ export * from "./classes/CommandWithSubcommandGroups.js"
20
+ export * from "./classes/CommandWithSubcommands.js"
21
+ export * from "./classes/MentionableSelectMenu.js"
22
+ export * from "./classes/RoleSelectMenu.js"
23
+ export * from "./classes/Row.js"
24
+ export * from "./classes/StringSelectMenu.js"
25
+ export * from "./classes/UserSelectMenu.js"
26
+
27
+ // ----- Factories -----
28
+ export * from "./factories/channelFactory.js"
29
+
30
+ // ----- Internals -----
31
+ export * from "./internals/AutocompleteInteraction.js"
32
+ export * from "./internals/ButtonInteraction.js"
33
+ export * from "./internals/ChannelSelectMenuInteraction.js"
34
+ export * from "./internals/CommandHandler.js"
35
+ export * from "./internals/CommandInteraction.js"
36
+ export * from "./internals/ComponentHandler.js"
37
+ export * from "./internals/MentionableSelectMenuInteraction.js"
38
+ export * from "./internals/OptionsHandler.js"
39
+ export * from "./internals/RoleSelectMenuInteraction.js"
40
+ export * from "./internals/StringSelectMenuInteraction.js"
41
+ export * from "./internals/UserSelectMenuInteraction.js"
42
+
43
+ // ----- Structures -----
44
+ export * from "./structures/DmChannel.js"
45
+ export * from "./structures/GroupDmChannel.js"
46
+ export * from "./structures/Guild.js"
47
+ export * from "./structures/GuildAnnouncementChannel.js"
48
+ export * from "./structures/GuildCategoryChannel.js"
49
+ export * from "./structures/GuildForumChannel.js"
50
+ export * from "./structures/GuildMediaChannel.js"
51
+ export * from "./structures/GuildStageOrVoiceChannel.js"
52
+ export * from "./structures/GuildTextChannel.js"
53
+ export * from "./structures/GuildThreadChannel.js"
54
+ export * from "./structures/Message.js"
55
+ export * from "./structures/Role.js"
56
+ export * from "./structures/User.js"
57
+
58
+ // ----- Types -----
59
+ export * from "discord-api-types/v10"