commandkit 0.1.11-dev.20250208091524 → 0.1.11-dev.20250208131735

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 (349) hide show
  1. package/dist/index.d.mts +988 -22
  2. package/dist/index.d.ts +988 -22
  3. package/dist/index.js +3 -3
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +28 -1
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/dist/CommandKit-Cu0lwE15.d.mts +0 -468
  9. package/dist/CommandKit-D13X5t6X.d.ts +0 -468
  10. package/dist/CommandKit.d.mts +0 -10
  11. package/dist/CommandKit.d.ts +0 -10
  12. package/dist/CommandKit.js +0 -11
  13. package/dist/CommandKit.js.map +0 -1
  14. package/dist/CommandKit.mjs +0 -2
  15. package/dist/CommandKit.mjs.map +0 -1
  16. package/dist/async-context-JOhTuMRX.d.mts +0 -143
  17. package/dist/async-context-qeVEbjv5.d.ts +0 -143
  18. package/dist/cache/CacheProvider.d.mts +0 -14
  19. package/dist/cache/CacheProvider.d.ts +0 -14
  20. package/dist/cache/CacheProvider.js +0 -2
  21. package/dist/cache/CacheProvider.js.map +0 -1
  22. package/dist/cache/CacheProvider.mjs +0 -2
  23. package/dist/cache/CacheProvider.mjs.map +0 -1
  24. package/dist/cache/MemoryCache.d.mts +0 -13
  25. package/dist/cache/MemoryCache.d.ts +0 -13
  26. package/dist/cache/MemoryCache.js +0 -2
  27. package/dist/cache/MemoryCache.js.map +0 -1
  28. package/dist/cache/MemoryCache.mjs +0 -2
  29. package/dist/cache/MemoryCache.mjs.map +0 -1
  30. package/dist/cache/cache.d.mts +0 -66
  31. package/dist/cache/cache.d.ts +0 -66
  32. package/dist/cache/cache.js +0 -11
  33. package/dist/cache/cache.js.map +0 -1
  34. package/dist/cache/cache.mjs +0 -2
  35. package/dist/cache/cache.mjs.map +0 -1
  36. package/dist/cache/index.d.mts +0 -13
  37. package/dist/cache/index.d.ts +0 -13
  38. package/dist/cache/index.js +0 -11
  39. package/dist/cache/index.js.map +0 -1
  40. package/dist/cache/index.mjs +0 -2
  41. package/dist/cache/index.mjs.map +0 -1
  42. package/dist/chunk-2F6IEOYN.mjs +0 -1
  43. package/dist/chunk-2F6IEOYN.mjs.map +0 -1
  44. package/dist/chunk-35OSBS47.mjs +0 -2
  45. package/dist/chunk-35OSBS47.mjs.map +0 -1
  46. package/dist/chunk-4VJMT2KT.mjs +0 -1
  47. package/dist/chunk-4VJMT2KT.mjs.map +0 -1
  48. package/dist/chunk-5CQ732SA.mjs +0 -2
  49. package/dist/chunk-5CQ732SA.mjs.map +0 -1
  50. package/dist/chunk-5KLEVIDX.mjs +0 -2
  51. package/dist/chunk-5KLEVIDX.mjs.map +0 -1
  52. package/dist/chunk-6EE35LXH.mjs +0 -2
  53. package/dist/chunk-6EE35LXH.mjs.map +0 -1
  54. package/dist/chunk-73NFQRKA.mjs +0 -7
  55. package/dist/chunk-73NFQRKA.mjs.map +0 -1
  56. package/dist/chunk-75Q5UTDQ.mjs +0 -2
  57. package/dist/chunk-75Q5UTDQ.mjs.map +0 -1
  58. package/dist/chunk-BNTMQC76.mjs +0 -2
  59. package/dist/chunk-BNTMQC76.mjs.map +0 -1
  60. package/dist/chunk-D4IIOMFB.mjs +0 -2
  61. package/dist/chunk-D4IIOMFB.mjs.map +0 -1
  62. package/dist/chunk-DMNZASZO.mjs +0 -2
  63. package/dist/chunk-DMNZASZO.mjs.map +0 -1
  64. package/dist/chunk-DTKEXOZL.mjs +0 -4
  65. package/dist/chunk-DTKEXOZL.mjs.map +0 -1
  66. package/dist/chunk-EWH2DHX5.mjs +0 -2
  67. package/dist/chunk-EWH2DHX5.mjs.map +0 -1
  68. package/dist/chunk-FC5WQLBI.mjs +0 -3
  69. package/dist/chunk-FC5WQLBI.mjs.map +0 -1
  70. package/dist/chunk-HFOCTXRX.mjs +0 -2
  71. package/dist/chunk-HFOCTXRX.mjs.map +0 -1
  72. package/dist/chunk-HN3WQT6R.mjs +0 -2
  73. package/dist/chunk-HN3WQT6R.mjs.map +0 -1
  74. package/dist/chunk-HXRSHVHI.mjs +0 -2
  75. package/dist/chunk-HXRSHVHI.mjs.map +0 -1
  76. package/dist/chunk-ICJ4BBWI.mjs +0 -2
  77. package/dist/chunk-ICJ4BBWI.mjs.map +0 -1
  78. package/dist/chunk-IRBJOQ7G.mjs +0 -2
  79. package/dist/chunk-IRBJOQ7G.mjs.map +0 -1
  80. package/dist/chunk-JPMIJRUL.mjs +0 -2
  81. package/dist/chunk-JPMIJRUL.mjs.map +0 -1
  82. package/dist/chunk-MNPCM4QU.mjs +0 -2
  83. package/dist/chunk-MNPCM4QU.mjs.map +0 -1
  84. package/dist/chunk-P7PNFSAC.mjs +0 -13
  85. package/dist/chunk-P7PNFSAC.mjs.map +0 -1
  86. package/dist/chunk-PDPQ6BZU.mjs +0 -4
  87. package/dist/chunk-PDPQ6BZU.mjs.map +0 -1
  88. package/dist/chunk-PTP2L33V.mjs +0 -2
  89. package/dist/chunk-PTP2L33V.mjs.map +0 -1
  90. package/dist/chunk-QXMWKQIO.mjs +0 -2
  91. package/dist/chunk-QXMWKQIO.mjs.map +0 -1
  92. package/dist/chunk-R4SWJR4N.mjs +0 -2
  93. package/dist/chunk-R4SWJR4N.mjs.map +0 -1
  94. package/dist/chunk-RQ3ABUE3.mjs +0 -2
  95. package/dist/chunk-RQ3ABUE3.mjs.map +0 -1
  96. package/dist/chunk-RVGLG66X.mjs +0 -2
  97. package/dist/chunk-RVGLG66X.mjs.map +0 -1
  98. package/dist/chunk-SI3L34FF.mjs +0 -2
  99. package/dist/chunk-SI3L34FF.mjs.map +0 -1
  100. package/dist/chunk-SRMAJ7IA.mjs +0 -2
  101. package/dist/chunk-SRMAJ7IA.mjs.map +0 -1
  102. package/dist/chunk-Y522NY4J.mjs +0 -2
  103. package/dist/chunk-Y522NY4J.mjs.map +0 -1
  104. package/dist/cli/build.d.mts +0 -4
  105. package/dist/cli/build.d.ts +0 -4
  106. package/dist/cli/build.js +0 -14
  107. package/dist/cli/build.js.map +0 -1
  108. package/dist/cli/build.mjs +0 -2
  109. package/dist/cli/build.mjs.map +0 -1
  110. package/dist/cli/common.d.mts +0 -35
  111. package/dist/cli/common.d.ts +0 -35
  112. package/dist/cli/common.js +0 -3
  113. package/dist/cli/common.js.map +0 -1
  114. package/dist/cli/common.mjs +0 -2
  115. package/dist/cli/common.mjs.map +0 -1
  116. package/dist/cli/development.d.mts +0 -3
  117. package/dist/cli/development.d.ts +0 -3
  118. package/dist/cli/development.js +0 -17
  119. package/dist/cli/development.js.map +0 -1
  120. package/dist/cli/development.mjs +0 -7
  121. package/dist/cli/development.mjs.map +0 -1
  122. package/dist/cli/esbuild-plugins/plugin.d.mts +0 -11
  123. package/dist/cli/esbuild-plugins/plugin.d.ts +0 -11
  124. package/dist/cli/esbuild-plugins/plugin.js +0 -2
  125. package/dist/cli/esbuild-plugins/plugin.js.map +0 -1
  126. package/dist/cli/esbuild-plugins/plugin.mjs +0 -2
  127. package/dist/cli/esbuild-plugins/plugin.mjs.map +0 -1
  128. package/dist/cli/esbuild-plugins/use-cache.d.mts +0 -6
  129. package/dist/cli/esbuild-plugins/use-cache.d.ts +0 -6
  130. package/dist/cli/esbuild-plugins/use-cache.js +0 -2
  131. package/dist/cli/esbuild-plugins/use-cache.js.map +0 -1
  132. package/dist/cli/esbuild-plugins/use-cache.mjs +0 -2
  133. package/dist/cli/esbuild-plugins/use-cache.mjs.map +0 -1
  134. package/dist/cli/init.d.mts +0 -10
  135. package/dist/cli/init.d.ts +0 -10
  136. package/dist/cli/init.js +0 -20
  137. package/dist/cli/init.js.map +0 -1
  138. package/dist/cli/init.mjs +0 -2
  139. package/dist/cli/init.mjs.map +0 -1
  140. package/dist/cli/parse-env.d.mts +0 -3
  141. package/dist/cli/parse-env.d.ts +0 -3
  142. package/dist/cli/parse-env.js +0 -2
  143. package/dist/cli/parse-env.js.map +0 -1
  144. package/dist/cli/parse-env.mjs +0 -2
  145. package/dist/cli/parse-env.mjs.map +0 -1
  146. package/dist/cli/production.d.mts +0 -3
  147. package/dist/cli/production.d.ts +0 -3
  148. package/dist/cli/production.js +0 -4
  149. package/dist/cli/production.js.map +0 -1
  150. package/dist/cli/production.mjs +0 -3
  151. package/dist/cli/production.mjs.map +0 -1
  152. package/dist/components/action-row/ActionRow.d.mts +0 -18
  153. package/dist/components/action-row/ActionRow.d.ts +0 -18
  154. package/dist/components/action-row/ActionRow.js +0 -2
  155. package/dist/components/action-row/ActionRow.js.map +0 -1
  156. package/dist/components/action-row/ActionRow.mjs +0 -2
  157. package/dist/components/action-row/ActionRow.mjs.map +0 -1
  158. package/dist/components/button/Button.d.mts +0 -30
  159. package/dist/components/button/Button.d.ts +0 -30
  160. package/dist/components/button/Button.js +0 -11
  161. package/dist/components/button/Button.js.map +0 -1
  162. package/dist/components/button/Button.mjs +0 -2
  163. package/dist/components/button/Button.mjs.map +0 -1
  164. package/dist/components/button/ButtonKit.d.mts +0 -60
  165. package/dist/components/button/ButtonKit.d.ts +0 -60
  166. package/dist/components/button/ButtonKit.js +0 -11
  167. package/dist/components/button/ButtonKit.js.map +0 -1
  168. package/dist/components/button/ButtonKit.mjs +0 -2
  169. package/dist/components/button/ButtonKit.mjs.map +0 -1
  170. package/dist/components/common/EventInterceptor.d.mts +0 -73
  171. package/dist/components/common/EventInterceptor.d.ts +0 -73
  172. package/dist/components/common/EventInterceptor.js +0 -2
  173. package/dist/components/common/EventInterceptor.js.map +0 -1
  174. package/dist/components/common/EventInterceptor.mjs +0 -2
  175. package/dist/components/common/EventInterceptor.mjs.map +0 -1
  176. package/dist/components/common/element.d.mts +0 -29
  177. package/dist/components/common/element.d.ts +0 -29
  178. package/dist/components/common/element.js +0 -2
  179. package/dist/components/common/element.js.map +0 -1
  180. package/dist/components/common/element.mjs +0 -2
  181. package/dist/components/common/element.mjs.map +0 -1
  182. package/dist/components/common/types.d.mts +0 -3
  183. package/dist/components/common/types.d.ts +0 -3
  184. package/dist/components/common/types.js +0 -2
  185. package/dist/components/common/types.js.map +0 -1
  186. package/dist/components/common/types.mjs +0 -2
  187. package/dist/components/common/types.mjs.map +0 -1
  188. package/dist/components/index.d.mts +0 -9
  189. package/dist/components/index.d.ts +0 -9
  190. package/dist/components/index.js +0 -11
  191. package/dist/components/index.js.map +0 -1
  192. package/dist/components/index.mjs +0 -2
  193. package/dist/components/index.mjs.map +0 -1
  194. package/dist/components/modal/Modal.d.mts +0 -56
  195. package/dist/components/modal/Modal.d.ts +0 -56
  196. package/dist/components/modal/Modal.js +0 -11
  197. package/dist/components/modal/Modal.js.map +0 -1
  198. package/dist/components/modal/Modal.mjs +0 -2
  199. package/dist/components/modal/Modal.mjs.map +0 -1
  200. package/dist/components/modal/ModalKit.d.mts +0 -58
  201. package/dist/components/modal/ModalKit.d.ts +0 -58
  202. package/dist/components/modal/ModalKit.js +0 -11
  203. package/dist/components/modal/ModalKit.js.map +0 -1
  204. package/dist/components/modal/ModalKit.mjs +0 -2
  205. package/dist/components/modal/ModalKit.mjs.map +0 -1
  206. package/dist/config.d.mts +0 -53
  207. package/dist/config.d.ts +0 -53
  208. package/dist/config.js +0 -2
  209. package/dist/config.js.map +0 -1
  210. package/dist/config.mjs +0 -2
  211. package/dist/config.mjs.map +0 -1
  212. package/dist/context/async-context.d.mts +0 -11
  213. package/dist/context/async-context.d.ts +0 -11
  214. package/dist/context/async-context.js +0 -11
  215. package/dist/context/async-context.js.map +0 -1
  216. package/dist/context/async-context.mjs +0 -2
  217. package/dist/context/async-context.mjs.map +0 -1
  218. package/dist/context/environment.d.mts +0 -11
  219. package/dist/context/environment.d.ts +0 -11
  220. package/dist/context/environment.js +0 -2
  221. package/dist/context/environment.js.map +0 -1
  222. package/dist/context/environment.mjs +0 -2
  223. package/dist/context/environment.mjs.map +0 -1
  224. package/dist/handlers/command-handler/CommandHandler.d.mts +0 -10
  225. package/dist/handlers/command-handler/CommandHandler.d.ts +0 -10
  226. package/dist/handlers/command-handler/CommandHandler.js +0 -11
  227. package/dist/handlers/command-handler/CommandHandler.js.map +0 -1
  228. package/dist/handlers/command-handler/CommandHandler.mjs +0 -2
  229. package/dist/handlers/command-handler/CommandHandler.mjs.map +0 -1
  230. package/dist/handlers/command-handler/functions/loadCommandsWithRest.d.mts +0 -40
  231. package/dist/handlers/command-handler/functions/loadCommandsWithRest.d.ts +0 -40
  232. package/dist/handlers/command-handler/functions/loadCommandsWithRest.js +0 -4
  233. package/dist/handlers/command-handler/functions/loadCommandsWithRest.js.map +0 -1
  234. package/dist/handlers/command-handler/functions/loadCommandsWithRest.mjs +0 -2
  235. package/dist/handlers/command-handler/functions/loadCommandsWithRest.mjs.map +0 -1
  236. package/dist/handlers/command-handler/functions/registerCommands.d.mts +0 -25
  237. package/dist/handlers/command-handler/functions/registerCommands.d.ts +0 -25
  238. package/dist/handlers/command-handler/functions/registerCommands.js +0 -7
  239. package/dist/handlers/command-handler/functions/registerCommands.js.map +0 -1
  240. package/dist/handlers/command-handler/functions/registerCommands.mjs +0 -2
  241. package/dist/handlers/command-handler/functions/registerCommands.mjs.map +0 -1
  242. package/dist/handlers/command-handler/typings.d.mts +0 -10
  243. package/dist/handlers/command-handler/typings.d.ts +0 -10
  244. package/dist/handlers/command-handler/typings.js +0 -2
  245. package/dist/handlers/command-handler/typings.js.map +0 -1
  246. package/dist/handlers/command-handler/typings.mjs +0 -1
  247. package/dist/handlers/command-handler/typings.mjs.map +0 -1
  248. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.d.mts +0 -9
  249. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.d.ts +0 -9
  250. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.js +0 -2
  251. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.js.map +0 -1
  252. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.mjs +0 -2
  253. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.mjs.map +0 -1
  254. package/dist/handlers/command-handler/validations/devOnly.d.mts +0 -14
  255. package/dist/handlers/command-handler/validations/devOnly.d.ts +0 -14
  256. package/dist/handlers/command-handler/validations/devOnly.js +0 -2
  257. package/dist/handlers/command-handler/validations/devOnly.js.map +0 -1
  258. package/dist/handlers/command-handler/validations/devOnly.mjs +0 -2
  259. package/dist/handlers/command-handler/validations/devOnly.mjs.map +0 -1
  260. package/dist/handlers/command-handler/validations/index.d.mts +0 -15
  261. package/dist/handlers/command-handler/validations/index.d.ts +0 -15
  262. package/dist/handlers/command-handler/validations/index.js +0 -4
  263. package/dist/handlers/command-handler/validations/index.js.map +0 -1
  264. package/dist/handlers/command-handler/validations/index.mjs +0 -2
  265. package/dist/handlers/command-handler/validations/index.mjs.map +0 -1
  266. package/dist/handlers/command-handler/validations/permissions.d.mts +0 -14
  267. package/dist/handlers/command-handler/validations/permissions.d.ts +0 -14
  268. package/dist/handlers/command-handler/validations/permissions.js +0 -4
  269. package/dist/handlers/command-handler/validations/permissions.js.map +0 -1
  270. package/dist/handlers/command-handler/validations/permissions.mjs +0 -2
  271. package/dist/handlers/command-handler/validations/permissions.mjs.map +0 -1
  272. package/dist/handlers/event-handler/EventHandler.d.mts +0 -10
  273. package/dist/handlers/event-handler/EventHandler.d.ts +0 -10
  274. package/dist/handlers/event-handler/EventHandler.js +0 -2
  275. package/dist/handlers/event-handler/EventHandler.js.map +0 -1
  276. package/dist/handlers/event-handler/EventHandler.mjs +0 -2
  277. package/dist/handlers/event-handler/EventHandler.mjs.map +0 -1
  278. package/dist/handlers/event-handler/typings.d.mts +0 -10
  279. package/dist/handlers/event-handler/typings.d.ts +0 -10
  280. package/dist/handlers/event-handler/typings.js +0 -2
  281. package/dist/handlers/event-handler/typings.js.map +0 -1
  282. package/dist/handlers/event-handler/typings.mjs +0 -1
  283. package/dist/handlers/event-handler/typings.mjs.map +0 -1
  284. package/dist/handlers/index.d.mts +0 -10
  285. package/dist/handlers/index.d.ts +0 -10
  286. package/dist/handlers/index.js +0 -11
  287. package/dist/handlers/index.js.map +0 -1
  288. package/dist/handlers/index.mjs +0 -2
  289. package/dist/handlers/index.mjs.map +0 -1
  290. package/dist/handlers/validation-handler/ValidationHandler.d.mts +0 -14
  291. package/dist/handlers/validation-handler/ValidationHandler.d.ts +0 -14
  292. package/dist/handlers/validation-handler/ValidationHandler.js +0 -2
  293. package/dist/handlers/validation-handler/ValidationHandler.js.map +0 -1
  294. package/dist/handlers/validation-handler/ValidationHandler.mjs +0 -2
  295. package/dist/handlers/validation-handler/ValidationHandler.mjs.map +0 -1
  296. package/dist/handlers/validation-handler/typings.d.mts +0 -14
  297. package/dist/handlers/validation-handler/typings.d.ts +0 -14
  298. package/dist/handlers/validation-handler/typings.js +0 -2
  299. package/dist/handlers/validation-handler/typings.js.map +0 -1
  300. package/dist/handlers/validation-handler/typings.mjs +0 -1
  301. package/dist/handlers/validation-handler/typings.mjs.map +0 -1
  302. package/dist/types.d.mts +0 -10
  303. package/dist/types.d.ts +0 -10
  304. package/dist/types.js +0 -2
  305. package/dist/types.js.map +0 -1
  306. package/dist/types.mjs +0 -2
  307. package/dist/types.mjs.map +0 -1
  308. package/dist/utils/clone.d.mts +0 -3
  309. package/dist/utils/clone.d.ts +0 -3
  310. package/dist/utils/clone.js +0 -2
  311. package/dist/utils/clone.js.map +0 -1
  312. package/dist/utils/clone.mjs +0 -2
  313. package/dist/utils/clone.mjs.map +0 -1
  314. package/dist/utils/colors.d.mts +0 -27
  315. package/dist/utils/colors.d.ts +0 -27
  316. package/dist/utils/colors.js +0 -2
  317. package/dist/utils/colors.js.map +0 -1
  318. package/dist/utils/colors.mjs +0 -2
  319. package/dist/utils/colors.mjs.map +0 -1
  320. package/dist/utils/constants.d.mts +0 -3
  321. package/dist/utils/constants.d.ts +0 -3
  322. package/dist/utils/constants.js +0 -2
  323. package/dist/utils/constants.js.map +0 -1
  324. package/dist/utils/constants.mjs +0 -2
  325. package/dist/utils/constants.mjs.map +0 -1
  326. package/dist/utils/error-codes.d.mts +0 -9
  327. package/dist/utils/error-codes.d.ts +0 -9
  328. package/dist/utils/error-codes.js +0 -2
  329. package/dist/utils/error-codes.js.map +0 -1
  330. package/dist/utils/error-codes.mjs +0 -2
  331. package/dist/utils/error-codes.mjs.map +0 -1
  332. package/dist/utils/get-paths.d.mts +0 -4
  333. package/dist/utils/get-paths.d.ts +0 -4
  334. package/dist/utils/get-paths.js +0 -2
  335. package/dist/utils/get-paths.js.map +0 -1
  336. package/dist/utils/get-paths.mjs +0 -2
  337. package/dist/utils/get-paths.mjs.map +0 -1
  338. package/dist/utils/resolve-file-url.d.mts +0 -8
  339. package/dist/utils/resolve-file-url.d.ts +0 -8
  340. package/dist/utils/resolve-file-url.js +0 -2
  341. package/dist/utils/resolve-file-url.js.map +0 -1
  342. package/dist/utils/resolve-file-url.mjs +0 -2
  343. package/dist/utils/resolve-file-url.mjs.map +0 -1
  344. package/dist/utils/warn-unstable.d.mts +0 -4
  345. package/dist/utils/warn-unstable.d.ts +0 -4
  346. package/dist/utils/warn-unstable.js +0 -2
  347. package/dist/utils/warn-unstable.js.map +0 -1
  348. package/dist/utils/warn-unstable.mjs +0 -2
  349. package/dist/utils/warn-unstable.mjs.map +0 -1
package/dist/index.d.mts CHANGED
@@ -1,28 +1,994 @@
1
- import { C as CommandKit } from './CommandKit-Cu0lwE15.mjs';
2
- export { A as AutocompleteProps, c as CommandContext, h as CommandData, d as CommandFileObject, b as CommandKitData, a as CommandKitOptions, i as CommandObject, g as CommandOptions, e as CommandProps, f as ContextMenuCommandProps, M as MessageContextMenuCommandProps, R as ReloadOptions, j as ReloadType, S as SlashCommandProps, U as UserContextMenuCommandProps, V as ValidationProps } from './CommandKit-Cu0lwE15.mjs';
3
- export { ActionRow, ActionRowProps } from './components/action-row/ActionRow.mjs';
4
- export { ButtonKit, ButtonKitPredicate, CommandKitButtonBuilderInteractionCollectorDispatch, CommandKitButtonBuilderInteractionCollectorDispatchContextData, CommandKitButtonBuilderOnEnd, OnButtonKitClick, OnButtonKitEnd } from './components/button/ButtonKit.mjs';
5
- export { Button, ButtonChildrenLike, ButtonProps } from './components/button/Button.mjs';
6
- export { CommandKitModalBuilderInteractionCollectorDispatch, CommandKitModalBuilderInteractionCollectorDispatchContextData, CommandKitModalBuilderOnEnd, ModalKit, ModalKitPredicate, OnModalKitEnd, OnModalKitSubmit } from './components/modal/ModalKit.mjs';
7
- export { Modal, ModalProps, ParagraphInput, ShortInput, TextInput, TextInputProps } from './components/modal/Modal.mjs';
8
- export { AnyCommandKitElement, CommandKitElement, CommandKitElementData, ElementType, Fragment, FragmentElementProps, createElement, getElement, isCommandKitElement } from './components/common/element.mjs';
9
- export { MaybeArray } from './components/common/types.mjs';
10
- export { EventInterceptor, EventInterceptorContextData } from './components/common/EventInterceptor.mjs';
11
- export { CommandKitConfig, defineConfig, getConfig } from './config.mjs';
12
- export { c as CommandKitEnvironment, C as CommandKitEnvironmentInternalData, f as CommandKitEnvironmentType, G as GenericFunction, h as after, i as cancelAfter, d as dmOnly, e as exitContext, g as getCommandKit, a as getContext, b as guildOnly, m as makeContextAwareFunction, u as useEnvironment } from './async-context-JOhTuMRX.mjs';
13
- export { CacheEntry, CacheProvider } from './cache/CacheProvider.mjs';
14
- export { MemoryCache } from './cache/MemoryCache.mjs';
15
- export { AsyncFunction, CacheParams, CacheTag, cache, cacheLife, cacheTag, invalidate, revalidate, super_duper_secret_internal_for_use_cache_directive_of_commandkit_cli_do_not_use_it_directly_or_you_will_be_fired_from_your_job_kthxbai } from './cache/cache.mjs';
16
- export { bootstrapCommandkitCLI } from './cli/init.mjs';
17
- import './handlers/validation-handler/ValidationHandler.mjs';
18
- import './handlers/validation-handler/typings.mjs';
19
- import 'discord.js';
20
- import 'node:events';
21
- import 'commander';
1
+ import * as discord_js from 'discord.js';
2
+ import { Client, Interaction, CacheType, ChatInputCommandInteraction, ContextMenuCommandInteraction, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, AutocompleteInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody, ClientEvents, Awaitable, ButtonInteraction, Events, ButtonBuilder, ModalSubmitInteraction, ModalBuilder, ActionRowBuilder, TextInputBuilder, ButtonStyle, ComponentEmojiResolvable, TextInputStyle } from 'discord.js';
3
+ import EventEmitter from 'node:events';
4
+ import * as commander from 'commander';
5
+
6
+ interface CacheEntry<T = unknown> {
7
+ value: T;
8
+ ttl?: number;
9
+ }
10
+ declare abstract class CacheProvider {
11
+ abstract get<T>(key: string): Promise<CacheEntry<T> | undefined>;
12
+ abstract set<T>(key: string, value: T, ttl?: number): Promise<void>;
13
+ abstract exists(key: string): Promise<boolean>;
14
+ abstract delete(key: string): Promise<void>;
15
+ abstract clear(): Promise<void>;
16
+ abstract expire(key: string, ttl: number): Promise<void>;
17
+ }
18
+
19
+ /**
20
+ * Options for instantiating a CommandKit handler.
21
+ */
22
+ interface CommandKitOptions {
23
+ /**
24
+ * The Discord.js client object to use with CommandKit.
25
+ */
26
+ client: Client;
27
+ /**
28
+ * The path to your commands directory.
29
+ */
30
+ commandsPath?: string;
31
+ /**
32
+ * The path to your events directory.
33
+ */
34
+ eventsPath?: string;
35
+ /**
36
+ * The path to the validations directory.
37
+ */
38
+ validationsPath?: string;
39
+ /**
40
+ * List of development guild IDs to restrict devOnly commands to.
41
+ */
42
+ devGuildIds?: string[];
43
+ /**
44
+ * List of developer user IDs to restrict devOnly commands to.
45
+ */
46
+ devUserIds?: string[];
47
+ /**
48
+ * List of developer role IDs to restrict devOnly commands to.
49
+ */
50
+ devRoleIds?: string[];
51
+ /**
52
+ * Skip CommandKit's built-in validations (for devOnly commands).
53
+ */
54
+ skipBuiltInValidations?: boolean;
55
+ /**
56
+ * Bulk register application commands instead of one-by-one.
57
+ */
58
+ bulkRegister?: boolean;
59
+ /**
60
+ * Whether or not to debug the command handler.
61
+ */
62
+ debugCommands?: boolean;
63
+ /**
64
+ * The cache provider to use with CommandKit. Defaults to MemoryCache provider.
65
+ * Set this to `null` to not use any cache provider.
66
+ */
67
+ cacheProvider?: CacheProvider | null;
68
+ }
69
+ /**
70
+ * Private data for the CommandKit class.
71
+ */
72
+ interface CommandKitData extends CommandKitOptions {
73
+ commandHandler?: CommandHandler;
74
+ eventHandler?: EventHandler;
75
+ validationHandler?: ValidationHandler;
76
+ }
77
+ /**
78
+ * Represents a command context.
79
+ */
80
+ interface CommandContext<T extends Interaction, Cached extends CacheType> {
81
+ /**
82
+ * The interaction that triggered this command.
83
+ */
84
+ interaction: Interaction<CacheType>;
85
+ /**
86
+ * The client that instantiated this command.
87
+ */
88
+ client: Client;
89
+ /**
90
+ * The command data.
91
+ */
92
+ handler: CommandKit;
93
+ }
94
+ /**
95
+ * Represents a command file.
96
+ */
97
+ interface CommandFileObject {
98
+ data: CommandData;
99
+ options?: CommandOptions;
100
+ run: <Cached extends CacheType = CacheType>(ctx: CommandContext<Interaction, Cached>) => Awaited<void>;
101
+ autocomplete?: <Cached extends CacheType = CacheType>(ctx: CommandContext<Interaction, Cached>) => Awaited<void>;
102
+ filePath: string;
103
+ category: string | null;
104
+ [key: string]: any;
105
+ }
106
+ /**
107
+ * A reload type for commands.
108
+ */
109
+ type ReloadOptions = 'dev' | 'global' | ReloadType;
110
+ /**
111
+ * Props for command run functions.
112
+ */
113
+ interface CommandProps {
114
+ /**
115
+ * The current command interaction object.
116
+ */
117
+ interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction | UserContextMenuCommandInteraction | MessageContextMenuCommandInteraction | AutocompleteInteraction;
118
+ /**
119
+ * The Discord.js client object that CommandKit is handling.
120
+ */
121
+ client: Client<true>;
122
+ /**
123
+ * The current CommandKit handler instance.
124
+ */
125
+ handler: CommandKit;
126
+ }
127
+ /**
128
+ * Props for autocomplete command run functions.
129
+ */
130
+ interface AutocompleteProps extends CommandProps {
131
+ /**
132
+ * The current autocomplete command interaction object.
133
+ */
134
+ interaction: AutocompleteInteraction;
135
+ }
136
+ /**
137
+ * Props for slash (chat input) command run functions.
138
+ */
139
+ interface SlashCommandProps extends CommandProps {
140
+ /**
141
+ * The current slash (chat input) command interaction object.
142
+ */
143
+ interaction: ChatInputCommandInteraction;
144
+ }
145
+ /**
146
+ * Props for context menu command run functions.
147
+ */
148
+ interface ContextMenuCommandProps extends CommandProps {
149
+ /**
150
+ * The current context menu command interaction object.
151
+ */
152
+ interaction: ContextMenuCommandInteraction;
153
+ }
154
+ /**
155
+ * Props for user context menu command run functions.
156
+ */
157
+ interface UserContextMenuCommandProps extends CommandProps {
158
+ interaction: UserContextMenuCommandInteraction;
159
+ }
160
+ /**
161
+ * Props for message context menu command run functions.
162
+ */
163
+ interface MessageContextMenuCommandProps extends CommandProps {
164
+ interaction: MessageContextMenuCommandInteraction;
165
+ }
166
+ /**
167
+ * Props for command validation functions.
168
+ */
169
+ interface ValidationProps {
170
+ /**
171
+ * The current command interaction object.
172
+ */
173
+ interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction | AutocompleteInteraction;
174
+ /**
175
+ * The Discord.js client object that CommandKit is handling.
176
+ */
177
+ client: Client<true>;
178
+ /**
179
+ * The current (local) target command object.
180
+ */
181
+ commandObj: CommandObject;
182
+ /**
183
+ * The current CommandKit handler instance.
184
+ */
185
+ handler: CommandKit;
186
+ }
187
+ /**
188
+ * Additional command configuration options.
189
+ */
190
+ interface CommandOptions {
191
+ /**
192
+ * A boolean indicating whether the command is guild-only.
193
+ * Used for built-in validation.
194
+ *
195
+ * @deprecated Use `dm_permission` in the command's `data` object instead.
196
+ */
197
+ guildOnly?: boolean;
198
+ /**
199
+ * A boolean indicating whether the command is developer-only.
200
+ * Used for registration and built-in validation.
201
+ */
202
+ devOnly?: boolean;
203
+ /**
204
+ * A boolean indicating whether the command is deleted/ignored on restart/reload.
205
+ */
206
+ deleted?: boolean;
207
+ /**
208
+ * A string or array of permissions that a user needs for the current command to be executed.
209
+ * Used for built-in validation.
210
+ *
211
+ * @example
212
+ * userPermissions: 'BanMembers'
213
+ * or
214
+ * userPermissions: ['BanMembers', 'KickMembers']
215
+ */
216
+ userPermissions?: PermissionsString | PermissionsString[];
217
+ /**
218
+ * A string or array of permissions that the bot needs to execute the current command.
219
+ * Used for built-in validation.
220
+ *
221
+ * @example
222
+ * botPermissions: 'BanMembers'
223
+ * or
224
+ * botPermissions: ['BanMembers', 'KickMembers']
225
+ */
226
+ botPermissions?: PermissionsString | PermissionsString[];
227
+ [key: string]: any;
228
+ }
229
+ type CommandData = RESTPostAPIApplicationCommandsJSONBody;
230
+ type CommandObject = {
231
+ /**
232
+ * An object which defines the structure of the application command.
233
+ */
234
+ data: CommandData;
235
+ /**
236
+ * Additional command configuration options.
237
+ */
238
+ options?: CommandOptions;
239
+ /**
240
+ * The path to the command file.
241
+ */
242
+ filePath: string;
243
+ /**
244
+ * The command's category. Determined based on the command folder.
245
+ *
246
+ * @example
247
+ * ```txt
248
+ * "/src/commands/ping.js" -> null
249
+ * "/src/commands/Misc/ping.js" -> "Misc"
250
+ * ```
251
+ */
252
+ category: string | null;
253
+ [key: string]: any;
254
+ };
255
+ declare enum ReloadType {
256
+ /**
257
+ * Reload developer/guild commands.
258
+ */
259
+ Developer = "dev",
260
+ /**
261
+ * Reload global commands.
262
+ */
263
+ Global = "global"
264
+ }
265
+
266
+ /**
267
+ * Validation handler options (validationsPath).
268
+ */
269
+ interface ValidationHandlerOptions {
270
+ validationsPath: string;
271
+ }
272
+
273
+ /**
274
+ * A handler for command validations.
275
+ */
276
+ declare class ValidationHandler {
277
+ #private;
278
+ constructor({ ...options }: ValidationHandlerOptions);
279
+ init(): Promise<void>;
280
+ get validations(): Function[];
281
+ reloadValidations(): Promise<void>;
282
+ }
283
+
284
+ /**
285
+ * Command handler options.
286
+ * Similar to CommandKit options in structure.
287
+ */
288
+ interface CommandHandlerOptions {
289
+ /**
290
+ * The client created by the user.
291
+ */
292
+ client: Client;
293
+ /**
294
+ * Path to the user's commands.
295
+ */
296
+ commandsPath: string;
297
+ /**
298
+ * An array of developer guild IDs.
299
+ */
300
+ devGuildIds: string[];
301
+ /**
302
+ * An array of developer user IDs.
303
+ */
304
+ devUserIds: string[];
305
+ /**
306
+ * An array of developer role IDs.
307
+ */
308
+ devRoleIds: string[];
309
+ /**
310
+ * A validation handler instance to run validations before commands.
311
+ */
312
+ validationHandler?: ValidationHandler;
313
+ /**
314
+ * A boolean indicating whether to skip CommandKit's built-in validations (permission checking, etc.)
315
+ */
316
+ skipBuiltInValidations: boolean;
317
+ /**
318
+ * The CommandKit handler that instantiated this.
319
+ */
320
+ commandkitInstance: CommandKit;
321
+ /**
322
+ * A boolean indicating whether to register all commands in bulk.
323
+ */
324
+ bulkRegister: boolean;
325
+ }
326
+
327
+ /**
328
+ * A handler for client application commands.
329
+ */
330
+ declare class CommandHandler {
331
+ #private;
332
+ constructor({ ...options }: CommandHandlerOptions);
333
+ init(): Promise<void>;
334
+ handleCommands(): void;
335
+ get commands(): CommandFileObject[];
336
+ reloadCommands(type?: ReloadOptions): Promise<void>;
337
+ }
338
+
339
+ /**
340
+ * Event handler options.
341
+ */
342
+ interface EventHandlerOptions {
343
+ client: Client;
344
+ eventsPath: string;
345
+ commandKitInstance: CommandKit;
346
+ }
347
+
348
+ /**
349
+ * A handler for client events.
350
+ */
351
+ declare class EventHandler {
352
+ #private;
353
+ constructor({ ...options }: EventHandlerOptions);
354
+ init(): Promise<void>;
355
+ get events(): {
356
+ name: string;
357
+ functions: Function[];
358
+ }[];
359
+ reloadEvents(commandHandler?: CommandHandler): Promise<void>;
360
+ }
361
+
362
+ interface EventInterceptorContextData<E extends keyof ClientEvents> {
363
+ /**
364
+ * The filter to use for the collector.
365
+ */
366
+ filter?: (...args: ClientEvents[E]) => Awaitable<boolean>;
367
+ /**
368
+ * The duration (in ms) that the collector should run for.
369
+ */
370
+ time?: number;
371
+ /**
372
+ * If the collector should automatically reset the timer when a button is clicked.
373
+ */
374
+ autoReset?: boolean;
375
+ /**
376
+ * The handler to run when the collector ends.
377
+ */
378
+ onEnd?: (reason: string) => Awaitable<void>;
379
+ }
380
+ declare class EventInterceptor {
381
+ #private;
382
+ readonly client: Client;
383
+ private subscribers;
384
+ private globalHandlers;
385
+ private cleanupTimer;
386
+ /**
387
+ * Creates the event interceptor.
388
+ */
389
+ constructor(client: Client);
390
+ /**
391
+ * Destroys the event interceptor.
392
+ */
393
+ destroy(): void;
394
+ /**
395
+ * Whether the event has subscribers.
396
+ * @param event The event to check.
397
+ */
398
+ hasSubscribers(event: keyof ClientEvents): boolean;
399
+ /**
400
+ * Returns the number of subscribers for the event.
401
+ * @param event The event to check.
402
+ */
403
+ getSubscriberCount(event: keyof ClientEvents): number;
404
+ /**
405
+ * Whether the event has global handlers.
406
+ */
407
+ hasGlobalHandlers(): boolean;
408
+ /**
409
+ * Returns the number of global handlers.
410
+ */
411
+ getGlobalHandlersCount(): number;
412
+ /**
413
+ * Subscribes to an event.
414
+ * @param event The event to subscribe to.
415
+ * @param listener The listener to call when the event is emitted.
416
+ * @returns A function to unsubscribe from the event.
417
+ */
418
+ subscribe<Event extends keyof ClientEvents>(event: Event, listener: (...args: ClientEvents[Event]) => void, options?: EventInterceptorContextData<Event>): () => void;
419
+ /**
420
+ * Unsubscribes from an event.
421
+ * @param event The event to unsubscribe from.
422
+ */
423
+ unsubscribe<Event extends keyof ClientEvents>(event: Event, listener: (...args: ClientEvents[Event]) => void, reason?: string): void;
424
+ /**
425
+ * Creates a global handler for the event.
426
+ * @param event The event to create a global handler for.
427
+ * @returns The global handler.
428
+ */
429
+ private createGlobalHandler;
430
+ }
431
+
432
+ type ButtonKitPredicate = (interaction: ButtonInteraction) => Awaitable<boolean>;
433
+ /**
434
+ * The handler to run when a button is clicked. This handler is called with the interaction as the first argument.
435
+ * If the first argument is null, it means that the interaction collector has been destroyed.
436
+ */
437
+ type OnButtonKitClick = CommandKitButtonBuilderInteractionCollectorDispatch;
438
+ /**
439
+ * The handler to run when the interaction collector ends. This handler is called with the reason as the first argument.
440
+ * If the first argument is null, it means that the interaction collector has been destroyed.
441
+ */
442
+ type OnButtonKitEnd = CommandKitButtonBuilderOnEnd;
443
+ /**
444
+ * The handler to run when a button is clicked. This handler is called with the interaction as the first argument.
445
+ * If the first argument is null, it means that the interaction collector has been destroyed.
446
+ */
447
+ type CommandKitButtonBuilderInteractionCollectorDispatch = (interaction: ButtonInteraction) => Awaitable<void>;
448
+ type CommandKitButtonBuilderOnEnd = (reason: string) => Awaitable<void>;
449
+ type CommandKitButtonBuilderInteractionCollectorDispatchContextData = EventInterceptorContextData<Events.InteractionCreate>;
450
+ declare class ButtonKit extends ButtonBuilder {
451
+ #private;
452
+ /**
453
+ * Sets up an inline interaction collector for this button. This collector by default allows as many interactions as possible if it is actively used.
454
+ * If unused, this expires after 24 hours or custom time if specified.
455
+ * @param handler The handler to run when the button is clicked
456
+ * @param data The context data to use for the interaction collector
457
+ * @returns This button
458
+ * @example
459
+ * ```ts
460
+ * const button = new ButtonKit()
461
+ * .setLabel('Click me')
462
+ * .setStyle(ButtonStyle.Primary)
463
+ * .setCustomId('click_me')
464
+ * .filter((interaction) => interaction.user.id === '1234567890')
465
+ * .onClick(async (interaction) => {
466
+ * await interaction.reply('You clicked me!');
467
+ * });
468
+ *
469
+ * const row = new ActionRowBuilder().addComponents(button);
470
+ *
471
+ * const message = await channel.send({ content: 'Click the button', components: [row] });
472
+ *
473
+ * // Remove onClick handler and destroy the interaction collector
474
+ * button.onClick(null);
475
+ * ```
476
+ */
477
+ onClick(handler: CommandKitButtonBuilderInteractionCollectorDispatch, data?: CommandKitButtonBuilderInteractionCollectorDispatchContextData): this;
478
+ onEnd(handler: CommandKitButtonBuilderOnEnd): this;
479
+ /**
480
+ * Sets a filter for the interaction collector.
481
+ * @param predicate The filter to use for the interaction collector
482
+ */
483
+ filter(predicate: ButtonKitPredicate): this;
484
+ private get customId();
485
+ dispose(): this;
486
+ }
487
+
488
+ type ModalKitPredicate = (interaction: ModalSubmitInteraction) => Awaitable<boolean>;
489
+ /**
490
+ * The handler to run when a modal is submitted. This handler is called with the interaction as the first argument.
491
+ * If the first argument is null, it means that the interaction collector has been destroyed.
492
+ */
493
+ type OnModalKitSubmit = CommandKitModalBuilderInteractionCollectorDispatch;
494
+ /**
495
+ * The handler to run when the interaction collector ends. This handler is called with the reason as the first argument.
496
+ * If the first argument is null, it means that the interaction collector has been destroyed.
497
+ */
498
+ type OnModalKitEnd = CommandKitModalBuilderOnEnd;
499
+ /**
500
+ * The handler to run when a modal is submitted. This handler is called with the interaction as the first argument.
501
+ * If the first argument is null, it means that the interaction collector has been destroyed.
502
+ */
503
+ type CommandKitModalBuilderInteractionCollectorDispatch = (interaction: ModalSubmitInteraction) => Awaitable<void>;
504
+ type CommandKitModalBuilderOnEnd = (reason: string) => Awaitable<void>;
505
+ type CommandKitModalBuilderInteractionCollectorDispatchContextData = EventInterceptorContextData<Events.InteractionCreate>;
506
+ declare class ModalKit extends ModalBuilder {
507
+ #private;
508
+ /**
509
+ * Sets the handler to run when the modal is submitted.
510
+ * @param handler - The handler to run when the modal is submitted.
511
+ * @param data - The context data for the interaction collector.
512
+ * @returns This instance of the modal builder.
513
+ * @example
514
+ * ```ts
515
+ * const modal = new ModalKit()
516
+ * .setTitle('My Modal')
517
+ * .setCustomId('my-modal')
518
+ * .filter((interaction) => interaction.user.id === '1234567890')
519
+ * .onSubmit(async (interaction) => {
520
+ * await interaction.reply('You submitted the modal!');
521
+ * })
522
+ * .addComponents(actionRow1, actionRow2);
523
+ * ```
524
+ */
525
+ onSubmit(handler: CommandKitModalBuilderInteractionCollectorDispatch, data?: CommandKitModalBuilderInteractionCollectorDispatchContextData): this;
526
+ /**
527
+ * Sets the handler to run when the interaction collector ends.
528
+ * @param handler - The handler to run when the interaction collector ends.
529
+ * @returns This instance of the modal builder.
530
+ */
531
+ onEnd(handler: CommandKitModalBuilderOnEnd): this;
532
+ /**
533
+ * Sets a filter for the interaction collector.
534
+ * @param predicate - The filter to use for the interaction collector.
535
+ * @returns This instance of the modal builder.
536
+ */
537
+ filter(predicate: ModalKitPredicate): this;
538
+ private get customId();
539
+ dispose(): this;
540
+ }
541
+
542
+ declare const ElementType: {
543
+ readonly ActionRow: "action-row";
544
+ readonly Button: "button-kit";
545
+ readonly Modal: "modal";
546
+ readonly TextInput: "text-input";
547
+ };
548
+ type ElementType = (typeof ElementType)[keyof typeof ElementType];
549
+ interface CommandKitElementData {
550
+ [ElementType.ActionRow]: ActionRowBuilder;
551
+ [ElementType.Button]: ButtonKit;
552
+ [ElementType.Modal]: ModalKit;
553
+ [ElementType.TextInput]: TextInputBuilder;
554
+ }
555
+ type CommandKitElement<Type extends ElementType> = CommandKitElementData[Type];
556
+ type AnyCommandKitElement = CommandKitElement<ElementType>;
557
+ declare function isCommandKitElement(element: unknown): element is CommandKitElement<ElementType>;
558
+ declare function getElement<T extends ElementType, E extends CommandKitElement<T>>(element: E): CommandKitElementData[T];
559
+ interface FragmentElementProps {
560
+ children: [];
561
+ }
562
+ declare function Fragment(props: FragmentElementProps): CommandKitElementData[ElementType][];
563
+ declare function createElement(type: Function, props: Record<string, unknown>, ...children: any[]): CommandKitElement<ElementType>;
564
+
565
+ interface ActionRowProps {
566
+ children?: AnyCommandKitElement[] | AnyCommandKitElement;
567
+ }
568
+ /**
569
+ * The action row component.
570
+ * @param props The action row properties.
571
+ * @returns The commandkit element.
572
+ * @example <ActionRow><Button label="Click me" style={ButtonStyle.Primary} customId="click_me" /></ActionRow>
573
+ */
574
+ declare function ActionRow(props: ActionRowProps): CommandKitElement<'action-row'>;
575
+
576
+ type MaybeArray<T> = T | T[];
577
+
578
+ type ButtonChildrenLike = string | number | boolean;
579
+ interface ButtonProps {
580
+ label?: string;
581
+ style?: ButtonStyle;
582
+ emoji?: ComponentEmojiResolvable;
583
+ disabled?: boolean;
584
+ customId?: string;
585
+ url?: string;
586
+ skuId?: string;
587
+ onClick?: CommandKitButtonBuilderInteractionCollectorDispatch;
588
+ options?: CommandKitButtonBuilderInteractionCollectorDispatchContextData;
589
+ onEnd?: CommandKitButtonBuilderOnEnd;
590
+ children?: MaybeArray<ButtonChildrenLike>;
591
+ }
592
+ /**
593
+ * The button component.
594
+ * @param props The button properties.
595
+ * @returns The commandkit element.
596
+ * @example <Button style={ButtonStyle.Primary} customId="click_me">Click Me</Button>
597
+ */
598
+ declare function Button(props: ButtonProps): CommandKitElement<'button-kit'>;
599
+
600
+ interface ModalProps {
601
+ customId?: string;
602
+ title: string;
603
+ children?: MaybeArray<TextInputBuilder | ActionRowBuilder>;
604
+ onSubmit?: OnModalKitSubmit;
605
+ onEnd?: OnModalKitEnd;
606
+ options?: CommandKitModalBuilderInteractionCollectorDispatchContextData;
607
+ }
608
+ /**
609
+ * The modal component.
610
+ * @param props The modal properties.
611
+ * @returns The commandkit element.
612
+ * @example <Modal title="My Modal" onSubmit={onSubmit}>...</Modal>
613
+ */
614
+ declare function Modal(props: ModalProps): CommandKitElement<'modal'>;
615
+ interface TextInputProps {
616
+ customId: string;
617
+ label: string;
618
+ placeholder?: string;
619
+ maxLength?: number;
620
+ minLength?: number;
621
+ value?: string;
622
+ required?: boolean;
623
+ }
624
+ /**
625
+ * The text input component.
626
+ * @param props The text input properties.
627
+ * @returns The commandkit element.
628
+ * @example <TextInput customId="input" label="Input" style={TextInputStyle.Short} />
629
+ */
630
+ declare function TextInput(props: TextInputProps & {
631
+ style: TextInputStyle;
632
+ }): CommandKitElement<'text-input'>;
633
+ /**
634
+ * The short text input component.
635
+ * @param props The text input properties.
636
+ * @returns The commandkit element.
637
+ * @example <ShortInput customId="input" label="Input" />
638
+ */
639
+ declare function ShortInput(props: TextInputProps): CommandKitElement<'text-input'>;
640
+ /**
641
+ * The paragraph text input component.
642
+ * @param props The text input properties.
643
+ * @returns The commandkit element.
644
+ * @example <ParagraphInput customId="input" label="Input" />
645
+ */
646
+ declare function ParagraphInput(props: TextInputProps): CommandKitElement<'text-input'>;
647
+
648
+ declare class CommandKit extends EventEmitter {
649
+ #private;
650
+ readonly eventInterceptor: EventInterceptor;
651
+ static readonly createElement: typeof createElement;
652
+ static readonly Fragment: typeof Fragment;
653
+ static instance: CommandKit | undefined;
654
+ /**
655
+ * Create a new command and event handler with CommandKit.
656
+ *
657
+ * @param options - The default CommandKit configuration.
658
+ * @see {@link https://commandkit.js.org/docs/guide/commandkit-setup}
659
+ */
660
+ constructor(options: CommandKitOptions);
661
+ /**
662
+ * Resolves the current cache provider.
663
+ */
664
+ getCacheProvider(): CacheProvider | null;
665
+ /**
666
+ * Whether or not to debug the command handler.
667
+ */
668
+ isDebuggingCommands(): boolean;
669
+ /**
670
+ * Get the client attached to this CommandKit instance.
671
+ */
672
+ get client(): discord_js.Client<boolean>;
673
+ /**
674
+ * Get command handler instance.
675
+ */
676
+ get commandHandler(): CommandHandler | undefined;
677
+ /**
678
+ * Updates application commands with the latest from "commandsPath".
679
+ */
680
+ reloadCommands(type?: ReloadOptions): Promise<void>;
681
+ /**
682
+ * Updates application events with the latest from "eventsPath".
683
+ */
684
+ reloadEvents(): Promise<void>;
685
+ /**
686
+ * Updates application command validations with the latest from "validationsPath".
687
+ */
688
+ reloadValidations(): Promise<void>;
689
+ /**
690
+ * @returns An array of objects of all the commands that CommandKit is handling.
691
+ */
692
+ get commands(): CommandObject[];
693
+ /**
694
+ * @returns The path to the commands folder which was set when instantiating CommandKit.
695
+ */
696
+ get commandsPath(): string | undefined;
697
+ /**
698
+ * @returns The path to the events folder which was set when instantiating CommandKit.
699
+ */
700
+ get eventsPath(): string | undefined;
701
+ /**
702
+ * @returns The path to the validations folder which was set when instantiating CommandKit.
703
+ */
704
+ get validationsPath(): string | undefined;
705
+ /**
706
+ * @returns An array of all the developer user IDs which was set when instantiating CommandKit.
707
+ */
708
+ get devUserIds(): string[];
709
+ /**
710
+ * @returns An array of all the developer guild IDs which was set when instantiating CommandKit.
711
+ */
712
+ get devGuildIds(): string[];
713
+ /**
714
+ * @returns An array of all the developer role IDs which was set when instantiating CommandKit.
715
+ */
716
+ get devRoleIds(): string[];
717
+ /**
718
+ * Increment the client listeners count.
719
+ */
720
+ incrementClientListenersCount(): void;
721
+ /**
722
+ * Decrement the client listeners count.
723
+ */
724
+ decrementClientListenersCount(): void;
725
+ }
726
+
727
+ interface CommandKitConfig {
728
+ /**
729
+ * The source directory of the project.
730
+ */
731
+ src: string;
732
+ /**
733
+ * The main "javascript" file of the project.
734
+ */
735
+ main: string;
736
+ /**
737
+ * Whether or not to use the watch mode. Defaults to `true`.
738
+ */
739
+ watch: boolean;
740
+ /**
741
+ * The output directory of the project. Defaults to `dist`.
742
+ */
743
+ outDir: string;
744
+ /**
745
+ * Whether or not to include extra env utilities. Defaults to `true`.
746
+ */
747
+ envExtra: boolean;
748
+ /**
749
+ * Node.js cli options.
750
+ */
751
+ nodeOptions: string[];
752
+ /**
753
+ * Whether or not to clear default restart logs. Defaults to `true`.
754
+ */
755
+ clearRestartLogs: boolean;
756
+ /**
757
+ * Whether or not to minify the output. Defaults to `false`.
758
+ */
759
+ minify: boolean;
760
+ /**
761
+ * Whether or not to include sourcemaps in production build. Defaults to `false`.
762
+ */
763
+ sourcemap: boolean | 'inline';
764
+ /**
765
+ * Whether or not to include anti-crash handler in production. Defaults to `true`.
766
+ */
767
+ antiCrash: boolean;
768
+ /**
769
+ * Whether or not to polyfill `require` function. Defaults to `true`.
770
+ */
771
+ requirePolyfill: boolean;
772
+ }
773
+ declare function getConfig(): CommandKitConfig;
774
+ declare const requiredProps: readonly ["src", "main"];
775
+ type R = (typeof requiredProps)[number];
776
+ type PartialConfig<T extends CommandKitConfig> = Partial<Omit<T, R>> & Pick<T, R>;
777
+ declare function defineConfig(config: PartialConfig<CommandKitConfig>): Partial<CommandKitConfig>;
778
+
779
+ interface CommandKitEnvironmentInternalData {
780
+ executionError: Error | null;
781
+ type: CommandKitEnvironmentType | null;
782
+ variables: Map<string, any>;
783
+ deferredFunctions: Map<string, GenericFunction<[CommandKitEnvironment]>>;
784
+ marker: string;
785
+ markStart: number;
786
+ markEnd: number;
787
+ }
788
+ declare class CommandKitEnvironment {
789
+ #private;
790
+ readonly commandkit: CommandKit;
791
+ /**
792
+ * Creates the commandkit execution environment.
793
+ * @param commandkit - The commandkit instance.
794
+ */
795
+ constructor(commandkit: CommandKit);
796
+ /**
797
+ * Get the execution error.
798
+ * @internal
799
+ */
800
+ getExecutionError(): Error | null;
801
+ /**
802
+ * Set the execution error.
803
+ * @param error - The error to set.
804
+ * @internal
805
+ */
806
+ setExecutionError(error: Error): void;
807
+ /**
808
+ * Get the environment type.
809
+ */
810
+ getType(): CommandKitEnvironmentType;
811
+ /**
812
+ * Set the environment type.
813
+ * @param type - The environment type to set.
814
+ * @internal
815
+ */
816
+ setType(type: CommandKitEnvironmentType): void;
817
+ /**
818
+ * The variables store for this environment.
819
+ */
820
+ get variables(): Map<string, any>;
821
+ /**
822
+ * Register a deferred function.
823
+ * @param fn - The deferred function to register.
824
+ * @returns The deferred function id.
825
+ * @internal
826
+ */
827
+ registerDeferredFunction(fn: GenericFunction<[CommandKitEnvironment]>): string;
828
+ /**
829
+ * Clear a deferred function by id.
830
+ * @param id - The deferred function id to clear.
831
+ * @internal
832
+ */
833
+ clearDeferredFunction(id: string): void;
834
+ /**
835
+ * Run all deferred functions sequentially.
836
+ * @internal
837
+ */
838
+ runDeferredFunctions(): Promise<void>;
839
+ /**
840
+ * Clear all deferred functions.
841
+ * @internal
842
+ */
843
+ clearAllDeferredFunctions(): void;
844
+ /**
845
+ * Mark the start of a command execution.
846
+ * @param marker - The marker to set.
847
+ * @internal
848
+ */
849
+ markStart(marker: string): void;
850
+ /**
851
+ * Mark the end of a command execution.
852
+ * @internal
853
+ */
854
+ markEnd(): void;
855
+ /**
856
+ * Get the marker.
857
+ * @internal
858
+ */
859
+ getMarker(): string;
860
+ /**
861
+ * Get the execution time in milliseconds.
862
+ * @internal
863
+ */
864
+ getExecutionTime(): number;
865
+ }
866
+ declare enum CommandKitEnvironmentType {
867
+ CommandHandler = "COMMAND_HANDLER"
868
+ }
869
+ /**
870
+ * Runs the given function after the current handler has finished executing.
871
+ * @param fn The function to run after the current handler.
872
+ * @returns The deferred function id. This can be used to cancel the deferred function.
873
+ */
874
+ declare function after(fn: GenericFunction<[CommandKitEnvironment]>): string;
875
+ /**
876
+ * Cancels a deferred function registered with `after`.
877
+ * @param id The deferred function id to cancel.
878
+ */
879
+ declare function cancelAfter(id: string): void;
880
+
881
+ type GenericFunction<A extends any[] = any[]> = (...args: A) => any;
882
+ declare function exitContext<T>(fn: () => T): T;
883
+ /**
884
+ * Returns a context-aware version of the given function.
885
+ * @param env - The commandkit environment data.
886
+ * @param fn - The target function.
887
+ * @param finalizer - An optional finalizer function to run after the target function. This function will be context-aware.
888
+ * @internal
889
+ */
890
+ declare function makeContextAwareFunction<R extends GenericFunction, F extends GenericFunction>(env: CommandKitEnvironment, fn: R, finalizer?: F): R;
891
+ /**
892
+ * Retrieves commandkit
893
+ * @private
894
+ * @internal
895
+ */
896
+ declare function getCommandKit(): CommandKit | undefined;
897
+ declare function getCommandKit(strict: true): CommandKit;
898
+ declare function getCommandKit(strict: false): CommandKit | undefined;
899
+ /**
900
+ * Get the current commandkit context.
901
+ * @internal
902
+ */
903
+ declare function getContext(): CommandKitEnvironment | void;
904
+ /**
905
+ * Use current commandkit context. Throws an error if no context is found.
906
+ */
907
+ declare function useEnvironment(): CommandKitEnvironment;
908
+ /**
909
+ * Ensures the command is only available in guilds.
910
+ * Note: do not wrap this function in a try/catch block.
911
+ */
912
+ declare function guildOnly(): void;
913
+ /**
914
+ * Ensures the command is only available in DMs.
915
+ * Note: do not wrap this function in a try/catch block.
916
+ */
917
+ declare function dmOnly(): void;
918
+
919
+ declare class MemoryCache extends CacheProvider {
920
+ #private;
921
+ get<T>(key: string): Promise<CacheEntry<T> | undefined>;
922
+ set<T>(key: string, value: T, ttl?: number): Promise<void>;
923
+ exists(key: string): Promise<boolean>;
924
+ delete(key: string): Promise<void>;
925
+ clear(): Promise<void>;
926
+ expire(key: string, ttl: number): Promise<void>;
927
+ }
928
+
929
+ type AsyncFunction<R extends any[] = any[], T = any> = (...args: R) => Promise<T>;
930
+ interface CacheTag {
931
+ tag: string;
932
+ ttl: number | string;
933
+ }
934
+ interface CacheParams extends CacheTag {
935
+ target: GenericFunction;
936
+ memo: GenericFunction;
937
+ }
938
+ /**
939
+ * Cache a function with a specific tag and time-to-live.
940
+ * @param fn The function to cache.
941
+ * @param params The cache tag and time-to-live.
942
+ * @returns The memoized function.
943
+ */
944
+ declare function cache<R extends any[], F extends AsyncFunction<R>>(fn: F, params?: Partial<CacheTag>): F;
945
+ /**
946
+ * **DO NOT USE THIS FUNCTION DIRECTLY**
947
+ * @internal
948
+ * @private
949
+ */
950
+ declare function useCache<R extends any[], F extends AsyncFunction<R>>(fn: F, id?: string, tag?: CacheTag): F;
951
+ /**
952
+ * Tags the current function with the given cache tag name
953
+ * @param tag The cache tag name.
954
+ */
955
+ declare function cacheTag(tag: string): void;
956
+ /**
957
+ * Tags the current function with the given cache tag parameters.
958
+ * @param tag The cache tag parameters.
959
+ */
960
+ declare function cacheTag(tag: CacheTag): void;
961
+ /**
962
+ * Sets the time-to-live for the current cache tag.
963
+ * @param life The time-to-live value in milliseconds or a string.
964
+ */
965
+ declare function cacheLife(life: string): void;
966
+ declare function cacheLife(life: number): void;
967
+ /**
968
+ * Invalidates the cache with the given tag.
969
+ * This will immediately remove the cache entry. The next time cache is requested, it will be re-fetched.
970
+ * @param tag The cache tag to invalidate.
971
+ */
972
+ declare function invalidate(tag: string): Promise<void>;
973
+ /**
974
+ * Revalidates the cache with the given tag.
975
+ * This will immediately remove the cache entry and re-fetch the value.
976
+ * @param tag The cache tag to revalidate.
977
+ * @param args The arguments to pass to the memoized function (if any).
978
+ * @returns The new value of the cache.
979
+ */
980
+ declare function revalidate<R = any>(tag: string, ...args: any[]): Promise<R | undefined>;
981
+
982
+ /**
983
+ * Creates a command line interface for CommandKit.
984
+ * @param argv The arguments passed to the CLI.
985
+ * @param options The options passed to the CLI.
986
+ */
987
+ declare function bootstrapCommandkitCLI(argv: string[], options?: commander.ParseOptions | undefined): Promise<void>;
22
988
 
23
989
  /**
24
990
  * The current version of CommandKit.
25
991
  */
26
992
  declare const version: string;
27
993
 
28
- export { CommandKit, CommandKit as default, version };
994
+ export { ActionRow, type ActionRowProps, type AnyCommandKitElement, type AsyncFunction, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheEntry, type CacheParams, CacheProvider, type CacheTag, type CommandContext, type CommandData, type CommandFileObject, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfig, type CommandKitData, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandObject, type CommandOptions, type CommandProps, type ContextMenuCommandProps, ElementType, EventInterceptor, type EventInterceptorContextData, Fragment, type FragmentElementProps, type GenericFunction, type MaybeArray, MemoryCache, type MessageContextMenuCommandProps, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnModalKitEnd, type OnModalKitSubmit, ParagraphInput, type ReloadOptions, ReloadType, ShortInput, type SlashCommandProps, TextInput, type TextInputProps, type UserContextMenuCommandProps, type ValidationProps, after, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfter, createElement, CommandKit as default, defineConfig, dmOnly, exitContext, getCommandKit, getConfig, getContext, getElement, guildOnly, invalidate, isCommandKitElement, makeContextAwareFunction, revalidate, useCache as super_duper_secret_internal_for_use_cache_directive_of_commandkit_cli_do_not_use_it_directly_or_you_will_be_fired_from_your_job_kthxbai, useEnvironment, version };