@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,60 @@
1
+ import { ApplicationCommandOptionType, ApplicationCommandType, InteractionType } from "discord-api-types/v10";
2
+ import { Command } from "../classes/Command.js";
3
+ import { BaseInteraction } from "./BaseInteraction.js";
4
+ /**
5
+ * Represents a command interaction
6
+ */
7
+ export class CommandInteraction extends BaseInteraction {
8
+ options = {};
9
+ constructor(client, data, command) {
10
+ super(client, data);
11
+ if (data.type !== InteractionType.ApplicationCommand) {
12
+ throw new Error("Invalid interaction type was used to create this class");
13
+ }
14
+ if (data.data.type !== ApplicationCommandType.ChatInput) {
15
+ throw new Error("Invalid command type was used to create this class");
16
+ }
17
+ if (command &&
18
+ command instanceof Command &&
19
+ data.data.type === ApplicationCommandType.ChatInput) {
20
+ this.options = this.parseOptions(command, (data.data.options ??
21
+ []));
22
+ }
23
+ }
24
+ parseOptions = (command, options) => {
25
+ const result = {};
26
+ for (const option of options) {
27
+ const optionData = command.options?.find((x) => x.name === option.name);
28
+ if (!optionData) {
29
+ result[option.name] = undefined;
30
+ }
31
+ else {
32
+ switch (optionData.type) {
33
+ case ApplicationCommandOptionType.String:
34
+ result[option.name] = option.value;
35
+ break;
36
+ case ApplicationCommandOptionType.Integer:
37
+ result[option.name] = option.value;
38
+ break;
39
+ case ApplicationCommandOptionType.Boolean:
40
+ result[option.name] = option.value;
41
+ break;
42
+ case ApplicationCommandOptionType.User:
43
+ result[option.name] = option.value;
44
+ break;
45
+ case ApplicationCommandOptionType.Channel:
46
+ result[option.name] = option.value;
47
+ break;
48
+ case ApplicationCommandOptionType.Role:
49
+ result[option.name] = option.value;
50
+ break;
51
+ case ApplicationCommandOptionType.Mentionable:
52
+ result[option.name] = option.value;
53
+ break;
54
+ }
55
+ }
56
+ }
57
+ return result;
58
+ };
59
+ }
60
+ //# sourceMappingURL=CommandInteraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandInteraction.js","sourceRoot":"","sources":["../../../src/structures/CommandInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,4BAA4B,EAC5B,sBAAsB,EACtB,eAAe,EAEf,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;A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A4B,CAAC,MAAM;wBACvC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAe,CAAA;wBAC5C,MAAK;oBACN,KAAK,4BAA4B,CAAC,OAAO;wBACxC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAe,CAAA;wBAC5C,MAAK;oBACN,KAAK,4BAA4B,CAAC,OAAO;wBACxC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAgB,CAAA;wBAC7C,MAAK;oBACN,KAAK,4BAA4B,CAAC,IAAI;wBACrC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAe,CAAA;wBAC5C,MAAK;oBACN,KAAK,4BAA4B,CAAC,OAAO;wBACxC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAe,CAAA;wBAC5C,MAAK;oBACN,KAAK,4BAA4B,CAAC,IAAI;wBACrC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAe,CAAA;wBAC5C,MAAK;oBACN,KAAK,4BAA4B,CAAC,WAAW;wBAC5C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAe,CAAA;wBAC5C,MAAK;gBACP,CAAC;YACF,CAAC;QACF,CAAC;QACD,OAAO,MAAM,CAAA;IACd,CAAC,CAAA;CACD"}
@@ -0,0 +1,6 @@
1
+ import { Base } from "./Base.js";
2
+ import type { APIMessageComponentInteraction } from "discord-api-types/v10";
3
+ export declare class ComponentHandler extends Base {
4
+ handleInteraction(data: APIMessageComponentInteraction): Promise<false | undefined>;
5
+ }
6
+ //# sourceMappingURL=ComponentHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentHandler.d.ts","sourceRoot":"","sources":["../../../src/structures/ComponentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,OAAO,KAAK,EAEX,8BAA8B,EAE9B,MAAM,uBAAuB,CAAA;AAa9B,qBAAa,gBAAiB,SAAQ,IAAI;IACnC,iBAAiB,CAAC,IAAI,EAAE,8BAA8B;CA2D5D"}
@@ -0,0 +1,64 @@
1
+ import { Base } from "./Base.js";
2
+ import { Button } from "../classes/Button.js";
3
+ import { ButtonInteraction } from "./ButtonInteraction.js";
4
+ import { RoleSelectMenu } from "../classes/RoleSelectMenu.js";
5
+ import { ChannelSelectMenu } from "../classes/ChannelSelectMenu.js";
6
+ import { MentionableSelectMenu } from "../classes/MentionableSelectMenu.js";
7
+ import { StringSelectMenu } from "../classes/StringSelectMenu.js";
8
+ import { UserSelectMenu } from "../classes/UserSelectMenu.js";
9
+ import { RoleSelectMenuInteraction } from "./RoleSelectMenuInteraction.js";
10
+ import { UserSelectMenuInteraction } from "./UserSelectMenuInteraction.js";
11
+ import { StringSelectMenuInteraction } from "./StringSelectMenuInteraction.js";
12
+ import { MentionableSelectMenuInteraction } from "./MentionableSelectMenuInteraction.js";
13
+ import { ChannelSelectMenuInteraction } from "./ChannelSelectMenuInteraction.js";
14
+ export class ComponentHandler extends Base {
15
+ async handleInteraction(data) {
16
+ const allComponents = this.client.commands
17
+ .filter((x) => x.components && x.components.length > 0)
18
+ .flatMap((x) => x.components);
19
+ const component = allComponents.find((x) => x.customId === data.data.custom_id &&
20
+ x.type === data.data.component_type);
21
+ if (!component)
22
+ return false;
23
+ if (component instanceof Button) {
24
+ const interaction = new ButtonInteraction(this.client, data);
25
+ if (component.defer)
26
+ await interaction.defer();
27
+ await component.run(interaction);
28
+ }
29
+ else if (component instanceof RoleSelectMenu) {
30
+ const interaction = new RoleSelectMenuInteraction(this.client, data);
31
+ if (component.defer)
32
+ await interaction.defer();
33
+ await component.run(interaction);
34
+ }
35
+ else if (component instanceof ChannelSelectMenu) {
36
+ const interaction = new ChannelSelectMenuInteraction(this.client, data);
37
+ if (component.defer)
38
+ await interaction.defer();
39
+ await component.run(interaction);
40
+ }
41
+ else if (component instanceof MentionableSelectMenu) {
42
+ const interaction = new MentionableSelectMenuInteraction(this.client, data);
43
+ if (component.defer)
44
+ await interaction.defer();
45
+ await component.run(interaction);
46
+ }
47
+ else if (component instanceof StringSelectMenu) {
48
+ const interaction = new StringSelectMenuInteraction(this.client, data);
49
+ if (component.defer)
50
+ await interaction.defer();
51
+ await component.run(interaction);
52
+ }
53
+ else if (component instanceof UserSelectMenu) {
54
+ const interaction = new UserSelectMenuInteraction(this.client, data);
55
+ if (component.defer)
56
+ await interaction.defer();
57
+ await component.run(interaction);
58
+ }
59
+ else {
60
+ throw new Error(`Unknown component with type ${data.data.component_type} and custom ID ${data.data.custom_id}`);
61
+ }
62
+ }
63
+ }
64
+ //# sourceMappingURL=ComponentHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentHandler.js","sourceRoot":"","sources":["../../../src/structures/ComponentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAO1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,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import { type APIDMChannel, type APIMessage, ChannelType } from "discord-api-types/v10";
2
+ import { BaseChannel } from "../abstracts/BaseChannel.js";
3
+ /**
4
+ * Represents a DM between two users.
5
+ */
6
+ export declare class DmChannel extends BaseChannel<ChannelType.DM> {
7
+ /**
8
+ * The name of the channel. This is always null for DM channels.
9
+ */
10
+ name?: null;
11
+ type: ChannelType.DM;
12
+ protected setSpecificData(data: APIDMChannel): void;
13
+ /**
14
+ * Send a message to the channel
15
+ */
16
+ send(message: APIMessage): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=DmChannel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DmChannel.d.ts","sourceRoot":"","sources":["../../../src/structures/DmChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,WAAW,EAEX,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEzD;;GAEG;AACH,qBAAa,SAAU,SAAQ,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;IACzD;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,CAAO;IAClB,IAAI,EAAE,WAAW,CAAC,EAAE,CAAiB;IAErC,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,YAAY;IAI5C;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,UAAU;CAK9B"}
@@ -0,0 +1,24 @@
1
+ import { ChannelType, Routes } from "discord-api-types/v10";
2
+ import { BaseChannel } from "../abstracts/BaseChannel.js";
3
+ /**
4
+ * Represents a DM between two users.
5
+ */
6
+ export class DmChannel extends BaseChannel {
7
+ /**
8
+ * The name of the channel. This is always null for DM channels.
9
+ */
10
+ name = null;
11
+ type = ChannelType.DM;
12
+ setSpecificData(data) {
13
+ this.name = data.name;
14
+ }
15
+ /**
16
+ * Send a message to the channel
17
+ */
18
+ async send(message) {
19
+ this.client.rest.post(Routes.channelMessages(this.id), {
20
+ body: { ...message }
21
+ });
22
+ }
23
+ }
24
+ //# sourceMappingURL=DmChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DmChannel.js","sourceRoot":"","sources":["../../../src/structures/DmChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,WAAW,EACX,MAAM,EACN,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEzD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,WAA2B;IACzD;;OAEG;IACH,IAAI,GAAU,IAAI,CAAA;IAClB,IAAI,GAAmB,WAAW,CAAC,EAAE,CAAA;IAE3B,eAAe,CAAC,IAAkB;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;IACtB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,OAAmB;QAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YACtD,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE;SACpB,CAAC,CAAA;IACH,CAAC;CACD"}
@@ -0,0 +1,67 @@
1
+ import { type APIGroupDMChannel, ChannelType } from "discord-api-types/v10";
2
+ import { BaseChannel } from "../abstracts/BaseChannel.js";
3
+ import { Message } from "./Message.js";
4
+ import { User } from "./User.js";
5
+ /**
6
+ * Represents a group DM channel.
7
+ */
8
+ export declare class GroupDmChannel extends BaseChannel<ChannelType.GroupDM> {
9
+ /**
10
+ * The name of the channel.
11
+ */
12
+ name?: string | null;
13
+ /**
14
+ * The recipients of the channel.
15
+ */
16
+ recipients?: User[];
17
+ type: ChannelType.GroupDM;
18
+ /**
19
+ * The ID of the application that created the channel, if it was created by a bot.
20
+ */
21
+ applicationId?: string | null;
22
+ /**
23
+ * The icon hash of the channel.
24
+ */
25
+ icon?: string | null;
26
+ /**
27
+ * The ID of the user who created the channel.
28
+ */
29
+ ownerId?: string | null;
30
+ /**
31
+ * The ID of the last message sent in the channel.
32
+ *
33
+ * @remarks
34
+ * 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.
35
+ */
36
+ lastMessageId?: string | null;
37
+ /**
38
+ * Whether the channel is managed by an Oauth2 application.
39
+ */
40
+ managed?: boolean | null;
41
+ protected setSpecificData(data: APIGroupDMChannel): void;
42
+ /**
43
+ * Get the URL of the channel's icon.
44
+ */
45
+ get iconUrl(): string | null;
46
+ /**
47
+ * Get the owner of the channel.
48
+ */
49
+ get owner(): User;
50
+ /**
51
+ * The last message sent in the channel.
52
+ *
53
+ * @remarks
54
+ * 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.
55
+ * This will always return a partial message, so you can use {@link Message.fetch} to get the full message data.
56
+ *
57
+ */
58
+ get lastMessage(): Message | null;
59
+ /**
60
+ * Set the name of the channel
61
+ * @param name The new name of the channel
62
+ */
63
+ setName(name: string): Promise<void>;
64
+ addRecipient(user: User | string): Promise<void>;
65
+ removeRecipient(user: User | string): Promise<void>;
66
+ }
67
+ //# sourceMappingURL=GroupDmChannel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupDmChannel.d.ts","sourceRoot":"","sources":["../../../src/structures/GroupDmChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,iBAAiB,EACtB,WAAW,EAEX,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC;IACnE;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,EAAE,CAAA;IACnB,IAAI,EAAE,WAAW,CAAC,OAAO,CAAsB;IAC/C;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IAExB,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,iBAAiB;IAUjD;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAI3B;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,IAAI,CAGhB;IAED;;;;;;;OAOG;IACH,IAAI,WAAW,mBAMd;IAED;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM;IASpB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAiBhC,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;CAYzC"}
@@ -0,0 +1,109 @@
1
+ import { ChannelType, Routes } from "discord-api-types/v10";
2
+ import { BaseChannel } from "../abstracts/BaseChannel.js";
3
+ import { Message } from "./Message.js";
4
+ import { User } from "./User.js";
5
+ /**
6
+ * Represents a group DM channel.
7
+ */
8
+ export class GroupDmChannel extends BaseChannel {
9
+ /**
10
+ * The name of the channel.
11
+ */
12
+ name;
13
+ /**
14
+ * The recipients of the channel.
15
+ */
16
+ recipients;
17
+ type = ChannelType.GroupDM;
18
+ /**
19
+ * The ID of the application that created the channel, if it was created by a bot.
20
+ */
21
+ applicationId;
22
+ /**
23
+ * The icon hash of the channel.
24
+ */
25
+ icon;
26
+ /**
27
+ * The ID of the user who created the channel.
28
+ */
29
+ ownerId;
30
+ /**
31
+ * The ID of the last message sent in the channel.
32
+ *
33
+ * @remarks
34
+ * 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.
35
+ */
36
+ lastMessageId;
37
+ /**
38
+ * Whether the channel is managed by an Oauth2 application.
39
+ */
40
+ managed;
41
+ setSpecificData(data) {
42
+ this.name = data.name;
43
+ this.recipients = data.recipients?.map((x) => new User(this.client, x));
44
+ this.applicationId = data.application_id;
45
+ this.icon = data.icon;
46
+ this.ownerId = data.owner_id;
47
+ this.lastMessageId = data.last_message_id;
48
+ this.managed = data.managed;
49
+ }
50
+ /**
51
+ * Get the URL of the channel's icon.
52
+ */
53
+ get iconUrl() {
54
+ return this.icon
55
+ ? `https://cdn.discordapp.com/channel-icons/${this.id}/${this.icon}.png`
56
+ : null;
57
+ }
58
+ /**
59
+ * Get the owner of the channel.
60
+ */
61
+ get owner() {
62
+ if (!this.ownerId)
63
+ throw new Error("Cannot get owner without owner ID");
64
+ return new User(this.client, this.ownerId);
65
+ }
66
+ /**
67
+ * The last message sent in the channel.
68
+ *
69
+ * @remarks
70
+ * 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.
71
+ * This will always return a partial message, so you can use {@link Message.fetch} to get the full message data.
72
+ *
73
+ */
74
+ get lastMessage() {
75
+ if (!this.lastMessageId)
76
+ return null;
77
+ return new Message(this.client, {
78
+ id: this.lastMessageId,
79
+ channel_id: this.id
80
+ });
81
+ }
82
+ /**
83
+ * Set the name of the channel
84
+ * @param name The new name of the channel
85
+ */
86
+ async setName(name) {
87
+ await this.client.rest.patch(Routes.channel(this.id), {
88
+ body: {
89
+ name
90
+ }
91
+ });
92
+ this.name = name;
93
+ }
94
+ async addRecipient(user) {
95
+ await this.client.rest.put(Routes.channelRecipient(this.id, typeof user === "string" ? user : user.id));
96
+ if (this.recipients)
97
+ this.recipients.push(typeof user === "string" ? new User(this.client, user) : user);
98
+ else
99
+ this.recipients = [
100
+ typeof user === "string" ? new User(this.client, user) : user
101
+ ];
102
+ }
103
+ async removeRecipient(user) {
104
+ await this.client.rest.delete(Routes.channelRecipient(this.id, typeof user === "string" ? user : user.id));
105
+ if (this.recipients)
106
+ this.recipients = this.recipients.filter((x) => x.id !== (typeof user === "string" ? user : user.id));
107
+ }
108
+ }
109
+ //# sourceMappingURL=GroupDmChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupDmChannel.js","sourceRoot":"","sources":["../../../src/structures/GroupDmChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,WAAW,EACX,MAAM,EACN,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,WAAgC;IACnE;;OAEG;IACH,IAAI,CAAgB;IACpB;;OAEG;IACH,UAAU,CAAS;IACnB,IAAI,GAAwB,WAAW,CAAC,OAAO,CAAA;IAC/C;;OAEG;IACH,aAAa,CAAgB;IAC7B;;OAEG;IACH,IAAI,CAAgB;IACpB;;OAEG;IACH,OAAO,CAAgB;IACvB;;;;;OAKG;IACH,aAAa,CAAgB;IAC7B;;OAEG;IACH,OAAO,CAAiB;IAEd,eAAe,CAAC,IAAuB;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;QACvE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,cAAc,CAAA;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC5B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,eAAe,CAAA;QACzC,IAAI,CAAC,OAAO,GAA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AAC,UAAU,CAAC,IAAI,CACnB,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAC7D,CAAA;;YAED,IAAI,CAAC,UAAU,GAAG;gBACjB,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;aAC7D,CAAA;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,IAAmB;QACxC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAC5B,MAAM,CAAC,gBAAgB,CACtB,IAAI,CAAC,EAAE,EACP,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CACzC,CACD,CAAA;QACD,IAAI,IAAI,CAAC,UAAU;YAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAC3D,CAAA;IACH,CAAC;CACD"}
@@ -0,0 +1,71 @@
1
+ import { type APIGuild, type RESTPostAPIGuildRoleJSONBody } from "discord-api-types/v10";
2
+ import { Base } from "../abstracts/Base.js";
3
+ import type { Client } from "../classes/Client.js";
4
+ import { Role } from "./Role.js";
5
+ export declare class Guild extends Base {
6
+ /**
7
+ * The ID of the guild
8
+ */
9
+ id: string;
10
+ /**
11
+ * The name of the guild.
12
+ */
13
+ name?: string;
14
+ /**
15
+ * The description of the guild.
16
+ */
17
+ description?: string | null;
18
+ /**
19
+ * The icon hash of the guild.
20
+ * You can use {@link Guild.iconUrl} to get the URL of the icon.
21
+ */
22
+ icon?: string | null;
23
+ /**
24
+ * The splash hash of the guild.
25
+ * You can use {@link Guild.splashUrl} to get the URL of the splash.
26
+ */
27
+ splash?: string | null;
28
+ /**
29
+ * The ID of the owner of the guild.
30
+ */
31
+ ownerId?: string;
32
+ /**
33
+ * Whether the guild is a partial guild (meaning it does not have all the data).
34
+ * If this is true, you should use {@link Guild.fetch} to get the full data of the guild.
35
+ */
36
+ partial: boolean;
37
+ private rawData;
38
+ constructor(client: Client, rawDataOrId: APIGuild | string);
39
+ private setData;
40
+ /**
41
+ * Fetch updated data for this guild.
42
+ * If the guild is partial, this will fetch all the data for the guild and populate the fields.
43
+ * If the guild is not partial, all fields will be updated with new values from Discord.
44
+ */
45
+ fetch(): Promise<void>;
46
+ /**
47
+ * Leave the guild
48
+ */
49
+ leave(): Promise<unknown>;
50
+ /**
51
+ * Create a role in the guild
52
+ */
53
+ createRole(data: RESTPostAPIGuildRoleJSONBody): Promise<Role>;
54
+ /**
55
+ * Get the URL of the guild's icon
56
+ */
57
+ get iconUrl(): string | null;
58
+ /**
59
+ * Get the URL of the guild's splash
60
+ */
61
+ get splashUrl(): string | null;
62
+ /**
63
+ * Get all roles in the guild
64
+ */
65
+ get roles(): Role[];
66
+ /**
67
+ * Fetch a channel from the guild by ID
68
+ */
69
+ fetchChannel(channelId: string): Promise<import("./DmChannel.js").DmChannel | import("./GroupDmChannel.js").GroupDmChannel | import("./GuildTextChannel.js").GuildTextChannel | import("./GuildStageOrVoiceChannel.js").GuildVoiceChannel | import("./GuildCategoryChannel.js").GuildCategoryChannel | import("./GuildAnnouncementChannel.js").GuildAnnouncementChannel | import("./GuildThreadChannel.js").GuildThreadChannel<import("discord-api-types/v10").ThreadChannelType> | import("./GuildStageOrVoiceChannel.js").GuildStageChannel | import("./GuildForumChannel.js").GuildForumChannel | import("./GuildMediaChannel.js").GuildMediaChannel | null>;
70
+ }
71
+ //# sourceMappingURL=Guild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Guild.d.ts","sourceRoot":"","sources":["../../../src/structures/Guild.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,QAAQ,EAEb,KAAK,4BAA4B,EAEjC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,qBAAa,KAAM,SAAQ,IAAI;IAC9B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAA;IAEhB,OAAO,CAAC,OAAO,CAAwB;gBAE3B,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,MAAM;IAa1D,OAAO,CAAC,OAAO;IAWf;;;;OAIG;IACG,KAAK;IASX;;OAEG;IACG,KAAK;IAIX;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,4BAA4B;IASnD;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAI3B;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,GAAG,IAAI,CAI7B;IAED;;OAEG;IACH,IAAI,KAAK,WAIR;IAED;;OAEG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM;CAMpC"}
@@ -0,0 +1,123 @@
1
+ import { Routes } from "discord-api-types/v10";
2
+ import { Base } from "../abstracts/Base.js";
3
+ import { channelFactory } from "../factories/channelFactory.js";
4
+ import { Role } from "./Role.js";
5
+ export class Guild extends Base {
6
+ /**
7
+ * The ID of the guild
8
+ */
9
+ id;
10
+ /**
11
+ * The name of the guild.
12
+ */
13
+ name;
14
+ /**
15
+ * The description of the guild.
16
+ */
17
+ description;
18
+ /**
19
+ * The icon hash of the guild.
20
+ * You can use {@link Guild.iconUrl} to get the URL of the icon.
21
+ */
22
+ icon;
23
+ /**
24
+ * The splash hash of the guild.
25
+ * You can use {@link Guild.splashUrl} to get the URL of the splash.
26
+ */
27
+ splash;
28
+ /**
29
+ * The ID of the owner of the guild.
30
+ */
31
+ ownerId;
32
+ /**
33
+ * Whether the guild is a partial guild (meaning it does not have all the data).
34
+ * If this is true, you should use {@link Guild.fetch} to get the full data of the guild.
35
+ */
36
+ partial;
37
+ rawData = null;
38
+ constructor(client, rawDataOrId) {
39
+ super(client);
40
+ if (typeof rawDataOrId === "string") {
41
+ this.id = rawDataOrId;
42
+ this.partial = true;
43
+ }
44
+ else {
45
+ this.rawData = rawDataOrId;
46
+ this.id = rawDataOrId.id;
47
+ this.partial = false;
48
+ this.setData(rawDataOrId);
49
+ }
50
+ }
51
+ setData(data) {
52
+ if (!data)
53
+ throw new Error("Cannot set data without having data... smh");
54
+ this.rawData = data;
55
+ this.name = data.name;
56
+ this.description = data.description;
57
+ this.icon = data.icon;
58
+ this.splash = data.splash;
59
+ this.ownerId = data.owner_id;
60
+ this.partial = false;
61
+ }
62
+ /**
63
+ * Fetch updated data for this guild.
64
+ * If the guild is partial, this will fetch all the data for the guild and populate the fields.
65
+ * If the guild is not partial, all fields will be updated with new values from Discord.
66
+ */
67
+ async fetch() {
68
+ const newData = (await this.client.rest.get(Routes.guild(this.id)));
69
+ if (!newData)
70
+ throw new Error(`Guild ${this.id}not found`);
71
+ this.setData(newData);
72
+ }
73
+ /**
74
+ * Leave the guild
75
+ */
76
+ async leave() {
77
+ return await this.client.rest.delete(Routes.guild(this.id));
78
+ }
79
+ /**
80
+ * Create a role in the guild
81
+ */
82
+ async createRole(data) {
83
+ const role = (await this.client.rest.post(Routes.guildRoles(this.id), {
84
+ body: {
85
+ ...data
86
+ }
87
+ }));
88
+ return new Role(this.client, role);
89
+ }
90
+ /**
91
+ * Get the URL of the guild's icon
92
+ */
93
+ get iconUrl() {
94
+ return this.icon
95
+ ? `https://cdn.discordapp.com/icons/${this.id}/${this.icon}.png`
96
+ : null;
97
+ }
98
+ /**
99
+ * Get the URL of the guild's splash
100
+ */
101
+ get splashUrl() {
102
+ return this.splash
103
+ ? `https://cdn.discordapp.com/splashes/${this.id}/${this.splash}.png`
104
+ : null;
105
+ }
106
+ /**
107
+ * Get all roles in the guild
108
+ */
109
+ get roles() {
110
+ const roles = this.rawData?.roles;
111
+ if (!roles)
112
+ throw new Error("Cannot get roles without having data... smh");
113
+ return roles.map((role) => new Role(this.client, role));
114
+ }
115
+ /**
116
+ * Fetch a channel from the guild by ID
117
+ */
118
+ async fetchChannel(channelId) {
119
+ const channel = (await this.client.rest.get(Routes.channel(channelId)));
120
+ return channelFactory(this.client, channel);
121
+ }
122
+ }
123
+ //# sourceMappingURL=Guild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Guild.js","sourceRoot":"","sources":["../../../src/structures/Guild.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,MAAM,EACN,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,OAAO,KAAM,SAAQ,IAAI;IAC9B;;OAEG;IACH,EAAE,CAAQ;IACV;;OAEG;IACH,IAAI,CAAS;IACb;;OAEG;IACH,WAAW,CAAgB;IAC3B;;;OAGG;IACH,IAAI,CAAgB;IACpB;;;OAGG;IACH,MAAM,CAAgB;IACtB;;OAEG;IACH,OAAO,CAAS;IAEhB;;;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AED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,SAAiB;QACnC,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAC1C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CACzB,CAAe,CAAA;QAChB,OAAO,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5C,CAAC;CACD"}
@@ -0,0 +1,12 @@
1
+ import { ChannelType } from "discord-api-types/v10";
2
+ import { BaseGuildTextChannel } from "../abstracts/BaseGuildTextChannel.js";
3
+ import type { GuildTextChannel } from "./GuildTextChannel.js";
4
+ /**
5
+ * Represents a guild announcement channel.
6
+ */
7
+ export declare class GuildAnnouncementChannel extends BaseGuildTextChannel<ChannelType.GuildAnnouncement> {
8
+ type: ChannelType.GuildAnnouncement;
9
+ protected setMoreSpecificData(): void;
10
+ follow(targetChannel: GuildTextChannel | string): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=GuildAnnouncementChannel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GuildAnnouncementChannel.d.ts","sourceRoot":"","sources":["../../../src/structures/GuildAnnouncementChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAU,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAA;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,oBAAoB,CAAC,WAAW,CAAC,iBAAiB,CAAC;IAChG,IAAI,EAAE,WAAW,CAAC,iBAAiB,CAAgC;IACnE,SAAS,CAAC,mBAAmB;IAEvB,MAAM,CAAC,aAAa,EAAE,gBAAgB,GAAG,MAAM;CAQrD"}
@@ -0,0 +1,17 @@
1
+ import { ChannelType, Routes } from "discord-api-types/v10";
2
+ import { BaseGuildTextChannel } from "../abstracts/BaseGuildTextChannel.js";
3
+ /**
4
+ * Represents a guild announcement channel.
5
+ */
6
+ export class GuildAnnouncementChannel extends BaseGuildTextChannel {
7
+ type = ChannelType.GuildAnnouncement;
8
+ setMoreSpecificData() { }
9
+ async follow(targetChannel) {
10
+ await this.client.rest.put(Routes.channelFollowers(this.id), {
11
+ body: {
12
+ webhook_channel_id: typeof targetChannel === "string" ? targetChannel : targetChannel.id
13
+ }
14
+ });
15
+ }
16
+ }
17
+ //# sourceMappingURL=GuildAnnouncementChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GuildAnnouncementChannel.js","sourceRoot":"","sources":["../../../src/structures/GuildAnnouncementChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAA;AAG3E;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,oBAAmD;IAChG,IAAI,GAAkC,WAAW,CAAC,iBAAiB,CAAA;IACzD,mBAAmB,KAAI,CAAC;IAElC,KAAK,CAAC,MAAM,CAAC,aAAwC;QACpD,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YAC5D,IAAI,EAAE;gBACL,kBAAkB,EACjB,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE;aACrE;SACD,CAAC,CAAA;IACH,CAAC;CACD"}
@@ -0,0 +1,13 @@
1
+ import type { ChannelType } from "discord-api-types/v10";
2
+ import { BaseGuildChannel } from "../abstracts/BaseGuildChannel.js";
3
+ /**
4
+ * Represents a guild category channel.
5
+ */
6
+ export declare class GuildCategoryChannel extends BaseGuildChannel<ChannelType.GuildCategory> {
7
+ protected setSpecificData(): void;
8
+ /**
9
+ * You cannot send a message to a category channel, so this method throws an error
10
+ */
11
+ send(): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=GuildCategoryChannel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GuildCategoryChannel.d.ts","sourceRoot":"","sources":["../../../src/structures/GuildCategoryChannel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAEnE;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,gBAAgB,CAAC,WAAW,CAAC,aAAa,CAAC;IACpF,SAAS,CAAC,eAAe;IAEzB;;OAEG;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC"}