@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,132 @@
1
+ import {
2
+ type APIGroupDMChannel,
3
+ ChannelType,
4
+ Routes
5
+ } from "discord-api-types/v10"
6
+ import { BaseChannel } from "../abstracts/BaseChannel.js"
7
+ import { Message } from "./Message.js"
8
+ import { User } from "./User.js"
9
+
10
+ /**
11
+ * Represents a group DM channel.
12
+ */
13
+ export class GroupDmChannel extends BaseChannel<ChannelType.GroupDM> {
14
+ /**
15
+ * The name of the channel.
16
+ */
17
+ name?: string | null
18
+ /**
19
+ * The recipients of the channel.
20
+ */
21
+ recipients?: User[]
22
+ type: ChannelType.GroupDM = ChannelType.GroupDM
23
+ /**
24
+ * The ID of the application that created the channel, if it was created by a bot.
25
+ */
26
+ applicationId?: string | null
27
+ /**
28
+ * The icon hash of the channel.
29
+ */
30
+ icon?: string | null
31
+ /**
32
+ * The ID of the user who created the channel.
33
+ */
34
+ ownerId?: string | null
35
+ /**
36
+ * The ID of the last message sent in the channel.
37
+ *
38
+ * @remarks
39
+ * This might not always resolve to a message. The ID still stays a part of the channel's data, even if the message is deleted.
40
+ */
41
+ lastMessageId?: string | null
42
+ /**
43
+ * Whether the channel is managed by an Oauth2 application.
44
+ */
45
+ managed?: boolean | null
46
+
47
+ protected setSpecificData(data: APIGroupDMChannel) {
48
+ this.name = data.name
49
+ this.recipients = data.recipients?.map((x) => new User(this.client, x))
50
+ this.applicationId = data.application_id
51
+ this.icon = data.icon
52
+ this.ownerId = data.owner_id
53
+ this.lastMessageId = data.last_message_id
54
+ this.managed = data.managed
55
+ }
56
+
57
+ /**
58
+ * Get the URL of the channel's icon.
59
+ */
60
+ get iconUrl(): string | null {
61
+ return this.icon
62
+ ? `https://cdn.discordapp.com/channel-icons/${this.id}/${this.icon}.png`
63
+ : null
64
+ }
65
+
66
+ /**
67
+ * Get the owner of the channel.
68
+ */
69
+ get owner(): User {
70
+ if (!this.ownerId) throw new Error("Cannot get owner without owner ID")
71
+ return new User(this.client, this.ownerId)
72
+ }
73
+
74
+ /**
75
+ * The last message sent in the channel.
76
+ *
77
+ * @remarks
78
+ * This might not always resolve to a message. The ID still stays a part of the channel's data, even if the message is deleted.
79
+ * This will always return a partial message, so you can use {@link Message.fetch} to get the full message data.
80
+ *
81
+ */
82
+ get lastMessage() {
83
+ if (!this.lastMessageId) return null
84
+ return new Message(this.client, {
85
+ id: this.lastMessageId,
86
+ channel_id: this.id
87
+ })
88
+ }
89
+
90
+ /**
91
+ * Set the name of the channel
92
+ * @param name The new name of the channel
93
+ */
94
+ async setName(name: string) {
95
+ await this.client.rest.patch(Routes.channel(this.id), {
96
+ body: {
97
+ name
98
+ }
99
+ })
100
+ this.name = name
101
+ }
102
+
103
+ async addRecipient(user: User | string) {
104
+ await this.client.rest.put(
105
+ Routes.channelRecipient(
106
+ this.id,
107
+ typeof user === "string" ? user : user.id
108
+ )
109
+ )
110
+ if (this.recipients)
111
+ this.recipients.push(
112
+ typeof user === "string" ? new User(this.client, user) : user
113
+ )
114
+ else
115
+ this.recipients = [
116
+ typeof user === "string" ? new User(this.client, user) : user
117
+ ]
118
+ }
119
+
120
+ async removeRecipient(user: User | string) {
121
+ await this.client.rest.delete(
122
+ Routes.channelRecipient(
123
+ this.id,
124
+ typeof user === "string" ? user : user.id
125
+ )
126
+ )
127
+ if (this.recipients)
128
+ this.recipients = this.recipients.filter(
129
+ (x) => x.id !== (typeof user === "string" ? user : user.id)
130
+ )
131
+ }
132
+ }
@@ -0,0 +1,142 @@
1
+ import {
2
+ type APIChannel,
3
+ type APIGuild,
4
+ type APIRole,
5
+ type RESTPostAPIGuildRoleJSONBody,
6
+ Routes
7
+ } from "discord-api-types/v10"
8
+ import { Base } from "../abstracts/Base.js"
9
+ import type { Client } from "../classes/Client.js"
10
+ import { channelFactory } from "../factories/channelFactory.js"
11
+ import { Role } from "./Role.js"
12
+
13
+ export class Guild extends Base {
14
+ /**
15
+ * The ID of the guild
16
+ */
17
+ id: string
18
+ /**
19
+ * The name of the guild.
20
+ */
21
+ name?: string
22
+ /**
23
+ * The description of the guild.
24
+ */
25
+ description?: string | null
26
+ /**
27
+ * The icon hash of the guild.
28
+ * You can use {@link Guild.iconUrl} to get the URL of the icon.
29
+ */
30
+ icon?: string | null
31
+ /**
32
+ * The splash hash of the guild.
33
+ * You can use {@link Guild.splashUrl} to get the URL of the splash.
34
+ */
35
+ splash?: string | null
36
+ /**
37
+ * The ID of the owner of the guild.
38
+ */
39
+ ownerId?: string
40
+
41
+ /**
42
+ * Whether the guild is a partial guild (meaning it does not have all the data).
43
+ * If this is true, you should use {@link Guild.fetch} to get the full data of the guild.
44
+ */
45
+ partial: boolean
46
+
47
+ private rawData: APIGuild | null = null
48
+
49
+ constructor(client: Client, rawDataOrId: APIGuild | string) {
50
+ super(client)
51
+ if (typeof rawDataOrId === "string") {
52
+ this.id = rawDataOrId
53
+ this.partial = true
54
+ } else {
55
+ this.rawData = rawDataOrId
56
+ this.id = rawDataOrId.id
57
+ this.partial = false
58
+ this.setData(rawDataOrId)
59
+ }
60
+ }
61
+
62
+ private setData(data: typeof this.rawData) {
63
+ if (!data) throw new Error("Cannot set data without having data... smh")
64
+ this.rawData = data
65
+ this.name = data.name
66
+ this.description = data.description
67
+ this.icon = data.icon
68
+ this.splash = data.splash
69
+ this.ownerId = data.owner_id
70
+ this.partial = false
71
+ }
72
+
73
+ /**
74
+ * Fetch updated data for this guild.
75
+ * If the guild is partial, this will fetch all the data for the guild and populate the fields.
76
+ * If the guild is not partial, all fields will be updated with new values from Discord.
77
+ */
78
+ async fetch() {
79
+ const newData = (await this.client.rest.get(
80
+ Routes.guild(this.id)
81
+ )) as APIGuild
82
+ if (!newData) throw new Error(`Guild ${this.id}not found`)
83
+
84
+ this.setData(newData)
85
+ }
86
+
87
+ /**
88
+ * Leave the guild
89
+ */
90
+ async leave() {
91
+ return await this.client.rest.delete(Routes.guild(this.id))
92
+ }
93
+
94
+ /**
95
+ * Create a role in the guild
96
+ */
97
+ async createRole(data: RESTPostAPIGuildRoleJSONBody) {
98
+ const role = (await this.client.rest.post(Routes.guildRoles(this.id), {
99
+ body: {
100
+ ...data
101
+ }
102
+ })) as APIRole
103
+ return new Role(this.client, role)
104
+ }
105
+
106
+ /**
107
+ * Get the URL of the guild's icon
108
+ */
109
+ get iconUrl(): string | null {
110
+ return this.icon
111
+ ? `https://cdn.discordapp.com/icons/${this.id}/${this.icon}.png`
112
+ : null
113
+ }
114
+
115
+ /**
116
+ * Get the URL of the guild's splash
117
+ */
118
+ get splashUrl(): string | null {
119
+ return this.splash
120
+ ? `https://cdn.discordapp.com/splashes/${this.id}/${this.splash}.png`
121
+ : null
122
+ }
123
+
124
+ /**
125
+ * Get all roles in the guild
126
+ */
127
+ get roles() {
128
+ const roles = this.rawData?.roles
129
+ if (!roles) throw new Error("Cannot get roles without having data... smh")
130
+ return roles.map((role) => new Role(this.client, role))
131
+ }
132
+
133
+ /**
134
+ * Fetch a channel from the guild by ID
135
+ */
136
+ async fetchChannel(channelId: string) {
137
+ const channel = (await this.client.rest.get(
138
+ Routes.channel(channelId)
139
+ )) as APIChannel
140
+ return channelFactory(this.client, channel)
141
+ }
142
+ }
@@ -0,0 +1,20 @@
1
+ import { ChannelType, Routes } from "discord-api-types/v10"
2
+ import { BaseGuildTextChannel } from "../abstracts/BaseGuildTextChannel.js"
3
+ import type { GuildTextChannel } from "./GuildTextChannel.js"
4
+
5
+ /**
6
+ * Represents a guild announcement channel.
7
+ */
8
+ export class GuildAnnouncementChannel extends BaseGuildTextChannel<ChannelType.GuildAnnouncement> {
9
+ type: ChannelType.GuildAnnouncement = ChannelType.GuildAnnouncement
10
+ protected setMoreSpecificData() {}
11
+
12
+ async follow(targetChannel: GuildTextChannel | string) {
13
+ await this.client.rest.put(Routes.channelFollowers(this.id), {
14
+ body: {
15
+ webhook_channel_id:
16
+ typeof targetChannel === "string" ? targetChannel : targetChannel.id
17
+ }
18
+ })
19
+ }
20
+ }
@@ -0,0 +1,16 @@
1
+ import type { ChannelType } from "discord-api-types/v10"
2
+ import { BaseGuildChannel } from "../abstracts/BaseGuildChannel.js"
3
+
4
+ /**
5
+ * Represents a guild category channel.
6
+ */
7
+ export class GuildCategoryChannel extends BaseGuildChannel<ChannelType.GuildCategory> {
8
+ protected setSpecificData() {}
9
+
10
+ /**
11
+ * You cannot send a message to a category channel, so this method throws an error
12
+ */
13
+ override async send(): Promise<void> {
14
+ throw new Error("Category channels cannot be sent to")
15
+ }
16
+ }
@@ -0,0 +1,20 @@
1
+ import type {
2
+ APIGuildForumChannel,
3
+ ChannelType,
4
+ ForumLayoutType
5
+ } from "discord-api-types/v10"
6
+ import { GuildThreadOnlyChannel } from "../abstracts/GuildThreadOnlyChannel.js"
7
+
8
+ /**
9
+ * Represents a guild forum channel.
10
+ */
11
+ export class GuildForumChannel extends GuildThreadOnlyChannel<ChannelType.GuildForum> {
12
+ /**
13
+ * The default forum layout of the channel.
14
+ */
15
+ defaultForumLayout?: ForumLayoutType
16
+
17
+ protected setMoreSpecificData(data: APIGuildForumChannel) {
18
+ this.defaultForumLayout = data.default_forum_layout
19
+ }
20
+ }
@@ -0,0 +1,13 @@
1
+ import type { ChannelType, ForumLayoutType } from "discord-api-types/v10"
2
+ import { GuildThreadOnlyChannel } from "../abstracts/GuildThreadOnlyChannel.js"
3
+
4
+ /**
5
+ * Represents a guild media channel (a forum channel )
6
+ */
7
+ export class GuildMediaChannel extends GuildThreadOnlyChannel<ChannelType.GuildMedia> {
8
+ /**
9
+ * The default forum layout of the channel.
10
+ */
11
+ defaultForumLayout?: ForumLayoutType
12
+ protected setMoreSpecificData() {}
13
+ }
@@ -0,0 +1,46 @@
1
+ import type {
2
+ APIGuildStageVoiceChannel,
3
+ APIGuildVoiceChannel,
4
+ ChannelType,
5
+ VideoQualityMode
6
+ } from "discord-api-types/v10"
7
+ import { BaseGuildChannel } from "../abstracts/BaseGuildChannel.js"
8
+
9
+ export abstract class GuildStageOrVoiceChannel<
10
+ Type extends ChannelType.GuildStageVoice | ChannelType.GuildVoice
11
+ > extends BaseGuildChannel<Type> {
12
+ /**
13
+ * The bitrate of the channel.
14
+ */
15
+ bitrate?: number | null
16
+ /**
17
+ * The user limit of the channel.
18
+ */
19
+ userLimit?: number | null
20
+ /**
21
+ * The RTC region of the channel.
22
+ * This is automatic when set to `null`.
23
+ */
24
+ rtcRegion?: string | null
25
+ /**
26
+ * The video quality mode of the channel.
27
+ * 1 when not present.
28
+ */
29
+ videoQualityMode?: VideoQualityMode | null
30
+
31
+ protected setSpecificData(
32
+ data: APIGuildStageVoiceChannel | APIGuildVoiceChannel
33
+ ) {
34
+ this.bitrate = data.bitrate
35
+ this.userLimit = data.user_limit
36
+ this.rtcRegion = data.rtc_region
37
+ this.videoQualityMode = data.video_quality_mode
38
+ }
39
+ }
40
+
41
+ export class GuildStageChannel extends BaseGuildChannel<ChannelType.GuildStageVoice> {
42
+ protected setSpecificData() {}
43
+ }
44
+ export class GuildVoiceChannel extends BaseGuildChannel<ChannelType.GuildVoice> {
45
+ protected setSpecificData() {}
46
+ }
@@ -0,0 +1,21 @@
1
+ import { type APIGuildTextChannel, ChannelType } from "discord-api-types/v10"
2
+ import { BaseGuildTextChannel } from "../abstracts/BaseGuildTextChannel.js"
3
+
4
+ export class GuildTextChannel extends BaseGuildTextChannel<ChannelType.GuildText> {
5
+ type: ChannelType.GuildText = ChannelType.GuildText
6
+ /**
7
+ * The default auto archive duration of threads in the channel.
8
+ */
9
+ defaultAutoArchiveDuration?: number | null
10
+ /**
11
+ * The default thread rate limit per user of the channel.
12
+ */
13
+ defaultThreadRateLimitPerUser?: number | null
14
+
15
+ protected setMoreSpecificData(
16
+ data: APIGuildTextChannel<ChannelType.GuildText>
17
+ ) {
18
+ this.defaultAutoArchiveDuration = data.default_auto_archive_duration
19
+ this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user
20
+ }
21
+ }
@@ -0,0 +1,150 @@
1
+ import {
2
+ type APIThreadChannel,
3
+ Routes,
4
+ type ThreadChannelType
5
+ } from "discord-api-types/v10"
6
+ import { BaseGuildChannel } from "../abstracts/BaseGuildChannel.js"
7
+
8
+ export class GuildThreadChannel<
9
+ Type extends ThreadChannelType
10
+ > extends BaseGuildChannel<Type> {
11
+ /**
12
+ * Whether the thread is archived.
13
+ */
14
+ archived?: boolean
15
+ /**
16
+ * The duration until the thread is auto archived.
17
+ */
18
+ autoArchiveDuration?: number
19
+ /**
20
+ * The timestamp of when the thread was archived.
21
+ */
22
+ archiveTimestamp?: string
23
+ /**
24
+ * Whether the thread is locked.
25
+ */
26
+ locked?: boolean
27
+ /**
28
+ * Whether non-moderators can add other non-moderators to a thread; only available on private threads
29
+ */
30
+ invitable?: boolean
31
+ /**
32
+ * The timestamp of when the thread was created.
33
+ */
34
+ createTimestamp?: string
35
+ /**
36
+ * The number of messages in the thread.
37
+ */
38
+ messageCount?: number
39
+ /**
40
+ * The number of members in the thread.
41
+ *
42
+ * @remarks
43
+ * This is only accurate until 50, after that, Discord stops counting.
44
+ */
45
+ memberCount?: number
46
+ /**
47
+ * The ID of the owner of the thread.
48
+ */
49
+ ownerId?: string
50
+ /**
51
+ * The number of messages sent in the thread.
52
+ */
53
+ totalMessageSent?: number
54
+ /**
55
+ * The tags applied to the thread.
56
+ */
57
+ appliedTags?: string[]
58
+
59
+ protected setSpecificData(data: APIThreadChannel) {
60
+ this.archived = data.thread_metadata?.archived
61
+ this.autoArchiveDuration = data.thread_metadata?.auto_archive_duration
62
+ this.archiveTimestamp = data.thread_metadata?.archive_timestamp
63
+ this.locked = data.thread_metadata?.locked
64
+ this.invitable = data.thread_metadata?.invitable
65
+ this.createTimestamp = data.thread_metadata?.create_timestamp
66
+ this.messageCount = data.message_count
67
+ this.memberCount = data.member_count
68
+ this.ownerId = data.owner_id
69
+ this.totalMessageSent = data.total_message_sent
70
+ this.appliedTags = data.applied_tags
71
+ }
72
+
73
+ /**
74
+ * Join the thread
75
+ */
76
+ async join() {
77
+ await this.addMember("@me")
78
+ }
79
+
80
+ /**
81
+ * Add a member to the thread
82
+ */
83
+ async addMember(userId: string) {
84
+ await this.client.rest.put(Routes.threadMembers(this.id, userId))
85
+ }
86
+
87
+ /**
88
+ * Leave the thread
89
+ */
90
+ async leave() {
91
+ await this.removeMember("@me")
92
+ }
93
+
94
+ /**
95
+ * Get the pinned messages in the thread
96
+ */
97
+ async removeMember(userId: string) {
98
+ await this.client.rest.delete(Routes.threadMembers(this.id, userId))
99
+ }
100
+
101
+ /**
102
+ * Archive the thread
103
+ */
104
+ async archive() {
105
+ await this.client.rest.patch(Routes.channel(this.id), {
106
+ body: { archive: true }
107
+ })
108
+ this.archived = true
109
+ }
110
+
111
+ /**
112
+ * Unarchive the thread
113
+ */
114
+ async unarchive() {
115
+ await this.client.rest.patch(Routes.channel(this.id), {
116
+ body: { archive: false }
117
+ })
118
+ this.archived = false
119
+ }
120
+
121
+ /**
122
+ * Set the auto archive duration of the thread
123
+ */
124
+ async setAutoArchiveDuration(duration: number) {
125
+ await this.client.rest.patch(Routes.channel(this.id), {
126
+ body: { auto_archive_duration: duration }
127
+ })
128
+ this.autoArchiveDuration = duration
129
+ }
130
+
131
+ /**
132
+ * Lock the thread
133
+ */
134
+ async lock() {
135
+ await this.client.rest.put(Routes.channel(this.id), {
136
+ body: { locked: true }
137
+ })
138
+ this.locked = true
139
+ }
140
+
141
+ /**
142
+ * Unlock the thread
143
+ */
144
+ async unlock() {
145
+ await this.client.rest.put(Routes.channel(this.id), {
146
+ body: { locked: false }
147
+ })
148
+ this.locked = false
149
+ }
150
+ }
@@ -0,0 +1,124 @@
1
+ import {
2
+ type APIChannel,
3
+ type APIMessage,
4
+ type APIThreadChannel,
5
+ type RESTPostAPIChannelThreadsJSONBody,
6
+ Routes
7
+ } from "discord-api-types/v10"
8
+ import { Base } from "../abstracts/Base.js"
9
+ import type { Client } from "../classes/Client.js"
10
+ import { channelFactory } from "../factories/channelFactory.js"
11
+ import { GuildThreadChannel } from "./GuildThreadChannel.js"
12
+ import { User } from "./User.js"
13
+
14
+ export class Message extends Base {
15
+ /**
16
+ * The ID of the message
17
+ */
18
+ id: string
19
+ /**
20
+ * The ID of the channel the message is in
21
+ */
22
+ channelId: string
23
+ /**
24
+ * Whether the message is a partial message (meaning it does not have all the data).
25
+ * If this is true, you should use {@link Message.fetch} to get the full data of the message.
26
+ */
27
+ partial: boolean
28
+
29
+ private rawData: APIMessage | null = null
30
+
31
+ constructor(
32
+ client: Client,
33
+ rawDataOrIds:
34
+ | APIMessage
35
+ | {
36
+ id: string
37
+ channel_id: string
38
+ }
39
+ ) {
40
+ super(client)
41
+ this.id = rawDataOrIds.id
42
+ this.channelId = rawDataOrIds.channel_id
43
+ if (Object.keys(rawDataOrIds).length === 2) {
44
+ this.partial = true
45
+ } else {
46
+ this.partial = false
47
+ this.setData(rawDataOrIds as APIMessage)
48
+ }
49
+ }
50
+
51
+ private setData(data: typeof this.rawData) {
52
+ this.rawData = data
53
+ if (!data) throw new Error("Cannot set data without having data... smh")
54
+ }
55
+
56
+ /**
57
+ * Fetch updated data for this message.
58
+ * If the message is partial, this will fetch all the data for the message and populate the fields.
59
+ * If the message is not partial, all fields will be updated with new values from Discord.
60
+ */
61
+ async fetch() {
62
+ const newData = (await this.client.rest.get(
63
+ Routes.channelMessage(this.channelId, this.id)
64
+ )) as APIMessage
65
+ if (!newData) throw new Error(`Message ${this.id} not found`)
66
+
67
+ this.setData(newData)
68
+ }
69
+
70
+ /**
71
+ * Delete this message from Discord
72
+ */
73
+ async delete() {
74
+ return await this.client.rest.delete(
75
+ Routes.channelMessage(this.channelId, this.id)
76
+ )
77
+ }
78
+
79
+ get author(): User | null {
80
+ if (this.rawData?.webhook_id) return null // TODO: Add webhook user
81
+ // Check if we have an additional property on the author object, in which case we have a full user object
82
+ if (this.rawData?.author.username)
83
+ return new User(this.client, this.rawData.author)
84
+ // This means we only have a partial user object
85
+ if (this.rawData?.author.id)
86
+ return new User(this.client, this.rawData.author.id)
87
+ return null
88
+ }
89
+
90
+ async fetchChannel() {
91
+ const data = (await this.client.rest.get(
92
+ Routes.channel(this.channelId)
93
+ )) as APIChannel
94
+ return channelFactory(this.client, data)
95
+ }
96
+
97
+ /**
98
+ * Pin this message
99
+ */
100
+ async pin() {
101
+ await this.client.rest.put(Routes.channelPin(this.channelId, this.id))
102
+ }
103
+
104
+ /**
105
+ * Unpin this message
106
+ */
107
+ async unpin() {
108
+ await this.client.rest.delete(Routes.channelPin(this.channelId, this.id))
109
+ }
110
+
111
+ /**
112
+ * Start a thread with this message as the associated start message.
113
+ * If you want to start a thread without a start message, use {@link BaseGuildTextChannel.startThread}
114
+ */
115
+ async startThread(data: RESTPostAPIChannelThreadsJSONBody) {
116
+ const thread = (await this.client.rest.post(
117
+ Routes.threads(this.channelId, this.id),
118
+ {
119
+ body: { ...data }
120
+ }
121
+ )) as APIThreadChannel
122
+ return new GuildThreadChannel(this.client, thread)
123
+ }
124
+ }