commandkit 1.2.0-dev.20260228121941 → 1.2.0-dev.20260301122036

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 (336) hide show
  1. package/dist/{ActionRow-CT-uyxW0.d.ts → ActionRow-Bt9qi0Mb.d.ts} +2 -2
  2. package/dist/{Button-oMnlpF6W.d.ts → Button-DxJLcZIU.d.ts} +5 -5
  3. package/dist/{ButtonKit-DKu0VAe4.d.ts → ButtonKit-BfcyvWfj.d.ts} +35 -35
  4. package/dist/{ChannelSelectMenuKit-HQZ4hH5s.d.ts → ChannelSelectMenuKit-DYkudikb.d.ts} +33 -33
  5. package/dist/{CommandsRouter-C7dZEepB.d.ts → CommandsRouter-DiNoF0dq.d.ts} +48 -48
  6. package/dist/{EventInterceptor-CZmWpS08.d.ts → EventInterceptor-D9JKMcfi.d.ts} +39 -39
  7. package/dist/{EventsRouter-DZ37r54v.d.ts → EventsRouter-EuuSu6NH.d.ts} +34 -34
  8. package/dist/{MentionableSelectMenuKit-7URDUM3-.d.ts → MentionableSelectMenuKit-Mu4xqP6B.d.ts} +33 -33
  9. package/dist/MessageCommandParser-DPCbHXCS.d.ts +194 -0
  10. package/dist/{Modal--iMEUqSm.d.ts → Modal-v9rrcMl-.d.ts} +7 -7
  11. package/dist/{ModalKit-BWXI3Z26.d.ts → ModalKit-XJSM65SV.d.ts} +32 -32
  12. package/dist/{RoleSelectMenuKit-BY-JJ18w.d.ts → RoleSelectMenuKit-CCjcp3HY.d.ts} +33 -33
  13. package/dist/{SelectMenu-DQbmOp1Y.d.ts → SelectMenu-CY0vvoSu.d.ts} +8 -8
  14. package/dist/{StringSelectMenuKit-lVhUMc3g.d.ts → StringSelectMenuKit-G5nBTicX.d.ts} +33 -33
  15. package/dist/{UserSelectMenuKit-CCj4Fpkr.d.ts → UserSelectMenuKit-D3SO_fXA.d.ts} +33 -33
  16. package/dist/analytics/analytics-engine.d.ts +1 -1
  17. package/dist/analytics/analytics-engine.js +2 -19
  18. package/dist/analytics/analytics-provider.d.ts +1 -1
  19. package/dist/analytics/analytics-provider.js +1 -0
  20. package/dist/analytics/constants.js +26 -3
  21. package/dist/analytics/constants.js.map +1 -0
  22. package/dist/analytics/utils.js +2 -19
  23. package/dist/{analytics-engine-_urJ5QTH.d.ts → analytics-engine-DnRsHBId.d.ts} +843 -843
  24. package/dist/app/commands/AppCommandRunner.d.ts +1 -1
  25. package/dist/app/commands/AppCommandRunner.js +2 -19
  26. package/dist/app/commands/Context.d.ts +1 -1
  27. package/dist/app/commands/Context.js +2 -19
  28. package/dist/app/commands/MessageCommandParser.d.ts +1 -1
  29. package/dist/app/commands/MessageCommandParser.js +261 -3
  30. package/dist/app/commands/MessageCommandParser.js.map +1 -0
  31. package/dist/app/commands/helpers.d.ts +1 -1
  32. package/dist/app/commands/helpers.js +25 -3
  33. package/dist/app/commands/helpers.js.map +1 -0
  34. package/dist/app/events/EventWorkerContext.d.ts +2 -2
  35. package/dist/app/events/EventWorkerContext.js +48 -5
  36. package/dist/app/events/EventWorkerContext.js.map +1 -0
  37. package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
  38. package/dist/app/handlers/AppCommandHandler.js +2 -19
  39. package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
  40. package/dist/app/handlers/AppEventsHandler.js +2 -19
  41. package/dist/app/index.d.ts +4 -4
  42. package/dist/app/index.js +13 -27
  43. package/dist/app/interrupt/signals.d.ts +1 -1
  44. package/dist/app/interrupt/signals.js +54 -6
  45. package/dist/app/interrupt/signals.js.map +1 -0
  46. package/dist/app/middlewares/permissions.d.ts +1 -1
  47. package/dist/app/middlewares/permissions.js +2 -19
  48. package/dist/app/register/CommandRegistrar.d.ts +1 -1
  49. package/dist/app/register/CommandRegistrar.js +2 -19
  50. package/dist/app/router/CommandsRouter.d.ts +1 -1
  51. package/dist/app/router/CommandsRouter.js +210 -2
  52. package/dist/app/router/CommandsRouter.js.map +1 -0
  53. package/dist/app/router/EventsRouter.d.ts +1 -1
  54. package/dist/app/router/EventsRouter.js +128 -2
  55. package/dist/app/router/EventsRouter.js.map +1 -0
  56. package/dist/app/router/index.d.ts +2 -2
  57. package/dist/app/router/index.js +5 -5
  58. package/dist/{chunk-kSYXY2_d.js → chunk-BE-pF4vm.js} +1 -1
  59. package/dist/cli/app-process.d.ts +2 -2
  60. package/dist/cli/app-process.js +6 -8
  61. package/dist/cli/app-process.js.map +1 -1
  62. package/dist/cli/build.d.ts +2 -2
  63. package/dist/cli/build.js +14 -29
  64. package/dist/cli/build.js.map +1 -1
  65. package/dist/cli/common.d.ts +5 -5
  66. package/dist/cli/common.js +182 -12
  67. package/dist/cli/common.js.map +1 -0
  68. package/dist/cli/development.d.ts +3 -3
  69. package/dist/cli/development.js +38 -54
  70. package/dist/cli/development.js.map +1 -1
  71. package/dist/cli/env.js +73 -9
  72. package/dist/cli/env.js.map +1 -0
  73. package/dist/cli/generators.js +10 -10
  74. package/dist/cli/generators.js.map +1 -1
  75. package/dist/cli/information.js +9 -8
  76. package/dist/cli/information.js.map +1 -1
  77. package/dist/cli/init.d.ts +2 -2
  78. package/dist/cli/init.js +14 -28
  79. package/dist/cli/init.js.map +1 -1
  80. package/dist/cli/production.d.ts +2 -2
  81. package/dist/cli/production.js +11 -28
  82. package/dist/cli/production.js.map +1 -1
  83. package/dist/cli/type-checker.js +83 -6
  84. package/dist/cli/type-checker.js.map +1 -0
  85. package/dist/cli/utils.js +1 -0
  86. package/dist/cli/utils.js.map +1 -1
  87. package/dist/{commandkit-B1_NP74k.js → commandkit--k6yDJEr.js} +192 -192
  88. package/dist/{commandkit-B1_NP74k.js.map → commandkit--k6yDJEr.js.map} +1 -1
  89. package/dist/commandkit.d.ts +1 -1
  90. package/dist/commandkit.js +2 -19
  91. package/dist/{common-DnwCYit8.d.ts → common-CCvvgnxi.d.ts} +2 -2
  92. package/dist/components/common/EventInterceptor.d.ts +1 -1
  93. package/dist/components/common/EventInterceptor.js +137 -2
  94. package/dist/components/common/EventInterceptor.js.map +1 -0
  95. package/dist/components/common/element.d.ts +1 -1
  96. package/dist/components/common/element.js +2 -19
  97. package/dist/components/common/types.d.ts +1 -1
  98. package/dist/components/common/types.js +1 -0
  99. package/dist/components/display/common.js +2 -19
  100. package/dist/components/display/container.d.ts +1 -1
  101. package/dist/components/display/container.js +2 -19
  102. package/dist/components/display/file.d.ts +1 -1
  103. package/dist/components/display/file.js +23 -2
  104. package/dist/components/display/file.js.map +1 -0
  105. package/dist/components/display/index.d.ts +8 -8
  106. package/dist/components/display/index.js +12 -25
  107. package/dist/components/display/label.d.ts +1 -1
  108. package/dist/components/display/label.js +2 -19
  109. package/dist/components/display/media-gallery.d.ts +1 -1
  110. package/dist/components/display/media-gallery.js +2 -19
  111. package/dist/components/display/poll.d.ts +1 -1
  112. package/dist/components/display/poll.js +85 -4
  113. package/dist/{poll-ziQQQbMU.js.map → components/display/poll.js.map} +1 -1
  114. package/dist/components/display/section.d.ts +1 -1
  115. package/dist/components/display/section.js +2 -19
  116. package/dist/components/display/separator.d.ts +1 -1
  117. package/dist/components/display/separator.js +21 -2
  118. package/dist/components/display/separator.js.map +1 -0
  119. package/dist/components/display/text-display.d.ts +1 -1
  120. package/dist/components/display/text-display.js +26 -2
  121. package/dist/components/display/text-display.js.map +1 -0
  122. package/dist/components/index.d.ts +22 -22
  123. package/dist/components/index.js +14 -26
  124. package/dist/components/interactive/action-row/ActionRow.d.ts +1 -1
  125. package/dist/components/interactive/action-row/ActionRow.js +20 -2
  126. package/dist/{ActionRow-CSN_UKmM.js.map → components/interactive/action-row/ActionRow.js.map} +1 -1
  127. package/dist/components/interactive/button/Button.d.ts +1 -1
  128. package/dist/components/interactive/button/Button.js +2 -19
  129. package/dist/components/interactive/button/ButtonKit.d.ts +1 -1
  130. package/dist/components/interactive/button/ButtonKit.js +2 -19
  131. package/dist/components/interactive/modal/Modal.d.ts +1 -1
  132. package/dist/components/interactive/modal/Modal.js +2 -19
  133. package/dist/components/interactive/modal/ModalKit.d.ts +1 -1
  134. package/dist/components/interactive/modal/ModalKit.js +2 -19
  135. package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -1
  136. package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +2 -19
  137. package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -1
  138. package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +2 -19
  139. package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -1
  140. package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +2 -19
  141. package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -1
  142. package/dist/components/interactive/select-menu/SelectMenu.js +2 -19
  143. package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -1
  144. package/dist/components/interactive/select-menu/StringSelectMenuKit.js +2 -19
  145. package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -1
  146. package/dist/components/interactive/select-menu/UserSelectMenuKit.js +2 -19
  147. package/dist/components/interactive/select-menu/common.d.ts +1 -1
  148. package/dist/components/interactive/select-menu/common.js +1 -0
  149. package/dist/config/config.d.ts +1 -1
  150. package/dist/config/config.js +2 -19
  151. package/dist/config/default.d.ts +1 -1
  152. package/dist/config/default.js +2 -19
  153. package/dist/config/loader.d.ts +1 -1
  154. package/dist/config/loader.js +2 -19
  155. package/dist/config/types.d.ts +1 -1
  156. package/dist/config/types.js +1 -0
  157. package/dist/config/utils.d.ts +1 -1
  158. package/dist/config/utils.js +29 -2
  159. package/dist/config/utils.js.map +1 -0
  160. package/dist/{constants-EpKcj0dH.d.ts → constants-DqtJY0t-.d.ts} +2 -2
  161. package/dist/{constants-CuYW0K10.d.ts → constants-DwxpkIeH.d.ts} +7 -7
  162. package/dist/{container-DYcb7zGw.d.ts → container-CYojOA9d.d.ts} +1 -1
  163. package/dist/context/async-context.d.ts +1 -1
  164. package/dist/context/async-context.js +2 -19
  165. package/dist/context/environment.d.ts +1 -1
  166. package/dist/context/environment.js +2 -19
  167. package/dist/{element-DZeqbSTk.d.ts → element-DeLvTMfZ.d.ts} +3 -3
  168. package/dist/events/CommandKitEventsChannel.d.ts +1 -1
  169. package/dist/events/CommandKitEventsChannel.js +83 -2
  170. package/dist/events/CommandKitEventsChannel.js.map +1 -0
  171. package/dist/{file-CrV4lSnl.d.ts → file-DLO1zEcH.d.ts} +1 -1
  172. package/dist/flags/FlagProvider.d.ts +1 -1
  173. package/dist/flags/FlagProvider.js +1 -0
  174. package/dist/flags/FlagProvider.js.map +1 -1
  175. package/dist/flags/feature-flags.d.ts +1 -1
  176. package/dist/flags/feature-flags.js +2 -19
  177. package/dist/flags/store.d.ts +1 -1
  178. package/dist/flags/store.js +13 -2
  179. package/dist/flags/store.js.map +1 -0
  180. package/dist/{helpers-AQPLVY35.d.ts → helpers-zmC44Mcu.d.ts} +1 -1
  181. package/dist/index.d.ts +30 -30
  182. package/dist/index.js +61 -67
  183. package/dist/kv/constants.d.ts +1 -1
  184. package/dist/kv/constants.js +22 -2
  185. package/dist/kv/constants.js.map +1 -0
  186. package/dist/kv/dotprops.js +1 -0
  187. package/dist/kv/dotprops.js.map +1 -1
  188. package/dist/kv/kv.d.ts +288 -288
  189. package/dist/kv/kv.js +2 -1
  190. package/dist/kv/kv.js.map +1 -1
  191. package/dist/kv/serde.d.ts +1 -1
  192. package/dist/kv/serde.js +29 -28
  193. package/dist/kv/serde.js.map +1 -1
  194. package/dist/{label-37kaNWMH.d.ts → label-DqGRqodo.d.ts} +3 -3
  195. package/dist/logger/DefaultLogger.d.ts +19 -19
  196. package/dist/logger/DefaultLogger.js +2 -19
  197. package/dist/logger/ILogger.d.ts +35 -35
  198. package/dist/logger/ILogger.js +1 -0
  199. package/dist/logger/Logger.d.ts +5 -5
  200. package/dist/logger/Logger.js +2 -19
  201. package/dist/logger/NoopLogger.d.ts +35 -35
  202. package/dist/logger/NoopLogger.js +1 -0
  203. package/dist/logger/NoopLogger.js.map +1 -1
  204. package/dist/{media-gallery-Ci3I4ElH.d.ts → media-gallery-Ca8es-eB.d.ts} +1 -1
  205. package/dist/plugins/CompilerPlugin.d.ts +1 -1
  206. package/dist/plugins/CompilerPlugin.js +33 -3
  207. package/dist/plugins/CompilerPlugin.js.map +1 -0
  208. package/dist/plugins/PluginCommon.d.ts +1 -1
  209. package/dist/plugins/PluginCommon.js +55 -4
  210. package/dist/plugins/PluginCommon.js.map +1 -0
  211. package/dist/plugins/RuntimePlugin.d.ts +1 -1
  212. package/dist/plugins/RuntimePlugin.js +124 -3
  213. package/dist/plugins/RuntimePlugin.js.map +1 -0
  214. package/dist/plugins/index.d.ts +1 -1
  215. package/dist/plugins/index.js +8 -25
  216. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
  217. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +2 -19
  218. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
  219. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +2 -19
  220. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
  221. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +2 -19
  222. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
  223. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +2 -19
  224. package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
  225. package/dist/plugins/plugin-runtime/runtime.js +1 -0
  226. package/dist/plugins/types.d.ts +1 -1
  227. package/dist/plugins/types.js +1 -0
  228. package/dist/{poll-Ddtapd6n.d.ts → poll-DQ6DX_Tt.d.ts} +8 -8
  229. package/dist/{section-DkUKULnB.d.ts → section-Q8nwx_-q.d.ts} +1 -1
  230. package/dist/{separator-CbXsIFCa.d.ts → separator-B8P-kdIK.d.ts} +1 -1
  231. package/dist/{signals-BbTgTc0i.d.ts → signals-CBXwugBW.d.ts} +1 -1
  232. package/dist/{text-display-D7j39VC-.d.ts → text-display-CL9C2yMc.d.ts} +1 -1
  233. package/dist/{types-BywA9d2Z.d.ts → types-DZy7U-Ld.d.ts} +1 -1
  234. package/dist/types.d.ts +1 -1
  235. package/dist/types.js +1 -0
  236. package/dist/utils/colors.js +9 -3
  237. package/dist/utils/colors.js.map +1 -0
  238. package/dist/utils/constants.d.ts +1 -1
  239. package/dist/utils/constants.js +50 -8
  240. package/dist/utils/constants.js.map +1 -0
  241. package/dist/utils/dev-hooks.d.ts +1 -1
  242. package/dist/utils/dev-hooks.js +2 -19
  243. package/dist/utils/error-codes.d.ts +10 -10
  244. package/dist/utils/error-codes.js +53 -5
  245. package/dist/utils/error-codes.js.map +1 -0
  246. package/dist/utils/resolve-file-url.js +18 -2
  247. package/dist/utils/resolve-file-url.js.map +1 -0
  248. package/dist/utils/types-package.js +61 -4
  249. package/dist/utils/types-package.js.map +1 -0
  250. package/dist/utils/useful-stuff/async-queue.d.ts +21 -21
  251. package/dist/utils/useful-stuff/async-queue.js +1 -0
  252. package/dist/utils/useful-stuff/async-queue.js.map +1 -1
  253. package/dist/utils/useful-stuff/mutex.d.ts +62 -62
  254. package/dist/utils/useful-stuff/mutex.js +1 -0
  255. package/dist/utils/useful-stuff/mutex.js.map +1 -1
  256. package/dist/utils/useful-stuff/ratelimiter.d.ts +56 -56
  257. package/dist/utils/useful-stuff/ratelimiter.js +1 -0
  258. package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
  259. package/dist/utils/useful-stuff/semaphore.d.ts +82 -82
  260. package/dist/utils/useful-stuff/semaphore.js +1 -0
  261. package/dist/utils/useful-stuff/semaphore.js.map +1 -1
  262. package/dist/utils/utilities.d.ts +5 -5
  263. package/dist/utils/utilities.js +2 -19
  264. package/dist/utils/warning.js +38 -4
  265. package/dist/utils/warning.js.map +1 -0
  266. package/dist/version.js +13 -2
  267. package/dist/version.js.map +1 -0
  268. package/package.json +11 -14
  269. package/dist/ActionRow-CSN_UKmM.js +0 -25
  270. package/dist/CommandKitEventsChannel-DDI0UVh9.js +0 -88
  271. package/dist/CommandKitEventsChannel-DDI0UVh9.js.map +0 -1
  272. package/dist/CommandsRouter-D5mGRFEr.js +0 -215
  273. package/dist/CommandsRouter-D5mGRFEr.js.map +0 -1
  274. package/dist/CompilerPlugin-DZidFuHJ.js +0 -43
  275. package/dist/CompilerPlugin-DZidFuHJ.js.map +0 -1
  276. package/dist/EventInterceptor-CxA95XYA.js +0 -142
  277. package/dist/EventInterceptor-CxA95XYA.js.map +0 -1
  278. package/dist/EventWorkerContext-CfqamFWu.js +0 -68
  279. package/dist/EventWorkerContext-CfqamFWu.js.map +0 -1
  280. package/dist/EventsRouter-Be5NDOX4.js +0 -133
  281. package/dist/EventsRouter-Be5NDOX4.js.map +0 -1
  282. package/dist/ILogger-JI8VGyJf.js +0 -0
  283. package/dist/MessageCommandParser-VMFFGs0R.js +0 -271
  284. package/dist/MessageCommandParser-VMFFGs0R.js.map +0 -1
  285. package/dist/MessageCommandParser-q3dQcE5N.d.ts +0 -194
  286. package/dist/PluginCommon-Bfs8d9s7.js +0 -70
  287. package/dist/PluginCommon-Bfs8d9s7.js.map +0 -1
  288. package/dist/RuntimePlugin-BYQXQO8w.js +0 -134
  289. package/dist/RuntimePlugin-BYQXQO8w.js.map +0 -1
  290. package/dist/colors-Csc0X4QJ.js +0 -14
  291. package/dist/colors-Csc0X4QJ.js.map +0 -1
  292. package/dist/common-vGj3fpz3.js +0 -0
  293. package/dist/common-zQwj90Nz.js +0 -222
  294. package/dist/common-zQwj90Nz.js.map +0 -1
  295. package/dist/constants-BA0TJU6e.js +0 -36
  296. package/dist/constants-BA0TJU6e.js.map +0 -1
  297. package/dist/constants-BS9N2avz.js +0 -27
  298. package/dist/constants-BS9N2avz.js.map +0 -1
  299. package/dist/constants-CeIMhMD0.js +0 -85
  300. package/dist/constants-CeIMhMD0.js.map +0 -1
  301. package/dist/env-FxaiNasU.js +0 -113
  302. package/dist/env-FxaiNasU.js.map +0 -1
  303. package/dist/error-codes-Ds0bnPvT.js +0 -73
  304. package/dist/error-codes-Ds0bnPvT.js.map +0 -1
  305. package/dist/file-DqI3v90P.js +0 -28
  306. package/dist/file-DqI3v90P.js.map +0 -1
  307. package/dist/helpers-DSy7EjzP.js +0 -35
  308. package/dist/helpers-DSy7EjzP.js.map +0 -1
  309. package/dist/poll-ziQQQbMU.js +0 -100
  310. package/dist/resolve-file-url-BmjHzIKe.js +0 -23
  311. package/dist/resolve-file-url-BmjHzIKe.js.map +0 -1
  312. package/dist/router-CtcApqrw.js +0 -0
  313. package/dist/runtime-UJIpkNww.js +0 -0
  314. package/dist/separator-DGwA_b1J.js +0 -26
  315. package/dist/separator-DGwA_b1J.js.map +0 -1
  316. package/dist/signals-ewEPW2cO.js +0 -74
  317. package/dist/signals-ewEPW2cO.js.map +0 -1
  318. package/dist/store-DK4JA-fQ.js +0 -18
  319. package/dist/store-DK4JA-fQ.js.map +0 -1
  320. package/dist/text-display-BVuG7dT-.js +0 -31
  321. package/dist/text-display-BVuG7dT-.js.map +0 -1
  322. package/dist/type-checker-CFpKDDs8.js +0 -88
  323. package/dist/type-checker-CFpKDDs8.js.map +0 -1
  324. package/dist/types-Bx1EKe0v.js +0 -0
  325. package/dist/types-CAwOz52q.js +0 -0
  326. package/dist/types-package-Bjh_ap0V.js +0 -71
  327. package/dist/types-package-Bjh_ap0V.js.map +0 -1
  328. package/dist/utils-CVaVycsK.js +0 -34
  329. package/dist/utils-CVaVycsK.js.map +0 -1
  330. package/dist/version-rRfNG5vY.js +0 -18
  331. package/dist/version-rRfNG5vY.js.map +0 -1
  332. package/dist/warning-BWiQltHE.js +0 -53
  333. package/dist/warning-BWiQltHE.js.map +0 -1
  334. /package/dist/{index-BJfko-dP.d.ts → index-BIsCUWAs.d.ts} +0 -0
  335. /package/dist/{index-CCggO_hw.d.ts → index-CwHYpK-f.d.ts} +0 -0
  336. /package/dist/{index-CLjpoGi1.d.ts → index-DHrsNvX1.d.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"MessageCommandParser-VMFFGs0R.js","names":[],"sources":["../src/app/commands/MessageCommandParser.ts"],"sourcesContent":["import { Channel } from 'diagnostics_channel';\nimport {\n Message,\n ApplicationCommandOptionType,\n GuildMember,\n Attachment,\n User,\n Role,\n CommandInteractionOption,\n} from 'discord.js';\nimport {\n CommandKitErrorCodes,\n createCommandKitError,\n} from '../../utils/error-codes';\n\n/**\n * Represents a parsed message command with its components.\n */\nexport interface ParsedMessageCommand {\n command: string;\n options: { name: string; value: unknown }[];\n subcommand?: string;\n subcommandGroup?: string;\n}\n\n/**\n * Schema defining the types of options for a message command.\n */\nexport type MessageCommandOptionsSchema = Record<\n string,\n ApplicationCommandOptionType\n>;\n\n/**\n * Parses message content into structured command data with options and subcommands.\n */\nexport class MessageCommandParser {\n /**\n * @private\n * @internal\n */\n #parsed: ParsedMessageCommand | null = null;\n\n /**\n * @private\n * @internal\n */\n #options: MessageCommandOptions | null = null;\n\n /**\n * @private\n * @internal\n */\n #args: string[] = [];\n\n /**\n * Creates a new message command parser.\n * @param message - The Discord message to parse\n * @param prefix - Array of valid command prefixes or a regular expression\n * @param schema - Function that returns the options schema for a command\n */\n public constructor(\n public message: Message,\n private prefix: string[] | RegExp,\n private schema: (command: string) => MessageCommandOptionsSchema,\n ) {}\n\n /**\n * Gets the parsed command arguments.\n * @returns Array of command arguments\n */\n public getArgs() {\n void this.parse();\n return this.#args;\n }\n\n /**\n * Gets the message command options object for easy access to typed option values.\n */\n public get options() {\n if (!this.#options) {\n this.#options = new MessageCommandOptions(this);\n }\n\n return this.#options;\n }\n\n /**\n * Gets a specific option value by name.\n * @param name - The option name\n * @returns The option value or undefined if not found\n */\n public getOption<T>(name: string): T | undefined {\n return this.parse().options.find((o) => o.name === name)?.value as T;\n }\n\n /**\n * Gets the main command name.\n * @returns The command name\n */\n public getCommand(): string {\n return this.parse().command;\n }\n\n /**\n * Gets the subcommand name if present.\n * @returns The subcommand name or undefined\n */\n public getSubcommand(): string | undefined {\n return this.parse().subcommand;\n }\n\n /**\n * Gets the subcommand group name if present.\n * @returns The subcommand group name or undefined\n */\n public getSubcommandGroup(): string | undefined {\n return this.parse().subcommandGroup;\n }\n\n /**\n * Gets the prefix used in the message.\n * @returns The matched prefix or undefined\n */\n public getPrefix() {\n if (this.prefix instanceof RegExp) {\n const match = this.message.content.match(this.prefix);\n return match?.[0];\n }\n\n for (const p of this.prefix) {\n if (this.message.content.startsWith(p)) {\n return p;\n }\n }\n }\n\n /**\n * Gets the full command including subcommand group and subcommand.\n * @returns The complete command string\n */\n public getFullCommand() {\n return [this.getCommand(), this.getSubcommandGroup(), this.getSubcommand()]\n .filter((v) => v)\n .join(' ');\n }\n\n /**\n * Parses the message content into structured command data.\n * @returns The parsed command data\n */\n public parse(): ParsedMessageCommand {\n if (this.#parsed) {\n return this.#parsed;\n }\n\n const content = this.message.content;\n\n const prefix = this.getPrefix();\n\n if (!prefix) {\n throw createCommandKitError(CommandKitErrorCodes.InvalidCommandPrefix);\n }\n\n const parts = content.slice(prefix.length).trim().split(' ');\n const command = parts.shift();\n\n this.#args = parts;\n\n let subcommandGroup: string | undefined;\n let subcommand: string | undefined;\n\n if (command?.includes(':')) {\n const [, group, cmd] = command.split(':');\n\n if (!cmd && group) {\n subcommand = group;\n } else if (cmd && group) {\n subcommandGroup = group;\n subcommand = cmd;\n }\n }\n\n const schema = this.schema(\n [command, subcommandGroup, subcommand].filter(Boolean).join(' ').trim(),\n );\n\n const options = parts\n .map((part) => {\n try {\n const [name, value] = part.split(':');\n\n if (!(name in schema)) return null;\n\n switch (schema[name]) {\n case ApplicationCommandOptionType.Boolean:\n return { name, value: value === 'true' };\n case ApplicationCommandOptionType.Integer:\n return { name, value: parseInt(value, 10) };\n case ApplicationCommandOptionType.Number:\n return { name, value: parseFloat(value) };\n case ApplicationCommandOptionType.String:\n return { name, value };\n case ApplicationCommandOptionType.User:\n return {\n name,\n value: this.message.mentions.users.find((u) => {\n return u.id === value.replace(/[<@!>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Channel:\n return {\n name,\n value: this.message.mentions.channels.find((c) => {\n return c.id === value.replace(/[<#>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Role:\n return {\n name,\n value: this.message.mentions.roles.find((r) => {\n return r.id === value.replace(/[<@&>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Attachment:\n return {\n name,\n value: this.message.attachments.find((a) => {\n return a.name === value;\n }),\n };\n default:\n return null;\n }\n } catch {\n // Invalid option\n return null;\n }\n })\n .filter((v) => v !== null);\n\n this.#parsed = {\n command: command!,\n options,\n subcommand,\n subcommandGroup,\n };\n\n return this.#parsed;\n }\n}\n\n/**\n * Provides typed access to message command options with methods similar to Discord.js interaction options.\n */\nexport class MessageCommandOptions {\n /**\n * Creates a new message command options instance.\n * @param parser - The message command parser instance\n */\n public constructor(private parser: MessageCommandParser) {}\n\n /**\n * @private\n * @internal\n */\n private assertOption<T>(name: string, required = false) {\n const option = this.parser.getOption<T>(name);\n\n if (required && option === undefined) {\n throw new Error(`Option \"${name}\" is required.`);\n }\n\n return option ?? null;\n }\n\n /**\n * Gets a guild member from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The guild member or null if not found\n */\n getMember(name: string): GuildMember | null;\n getMember(name: string, required: true): GuildMember;\n getMember(name: string, required = false) {\n const user = this.assertOption<User>(name, required);\n const member = this.parser.message.guild?.members.cache.get(user?.id!);\n\n if (required && !member) {\n throw new Error(`Member \"${name}\" is required.`);\n }\n\n return member ?? null;\n }\n\n /**\n * Gets an attachment from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The attachment or null if not found\n */\n getAttachment(name: string): Attachment | null;\n getAttachment(name: string, required: true): Attachment;\n getAttachment(name: string, required = false) {\n return this.assertOption<Attachment>(name, required);\n }\n\n /**\n * Gets a boolean value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The boolean value or null if not found\n */\n getBoolean(name: string): boolean | null;\n getBoolean(name: string, required: true): boolean;\n getBoolean(name: string, required = false) {\n return this.assertOption<boolean>(name, required);\n }\n\n /**\n * Gets a number value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The number value or null if not found\n */\n getNumber(name: string): number | null;\n getNumber(name: string, required: true): number;\n getNumber(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a string value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The string value or null if not found\n */\n getString(name: string): string | null;\n getString(name: string, required: true): string;\n getString(name: string, required = false) {\n return this.assertOption<string>(name, required);\n }\n\n /**\n * Gets an integer value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The integer value or null if not found\n */\n getInteger(name: string): number | null;\n getInteger(name: string, required: true): number;\n getInteger(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a user from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The user or null if not found\n */\n getUser(name: string): User | null;\n getUser(name: string, required: true): User;\n getUser(name: string, required = false) {\n return this.assertOption<User>(name, required);\n }\n\n /**\n * Gets a channel from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The channel or null if not found\n */\n getChannel(name: string): Channel | null;\n getChannel(name: string, required: true): Channel;\n getChannel(name: string, required = false) {\n return this.assertOption<Channel>(name, required);\n }\n\n /**\n * Gets a role from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The role or null if not found\n */\n getRole(name: string): Role | null;\n getRole(name: string, required: true): Role;\n getRole(name: string, required = false) {\n return this.assertOption<Role>(name, required);\n }\n\n /**\n * Gets a mentionable (user, member, or role) from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The mentionable or null if not found\n */\n getMentionable(\n name: string,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;\n getMentionable(\n name: string,\n required: true,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;\n getMentionable(\n name: string,\n required = false,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null {\n const target = this.assertOption(name, required);\n\n if (\n target instanceof GuildMember ||\n target instanceof User ||\n target instanceof Role\n ) {\n return target;\n }\n\n if (required) {\n throw new Error(`Mentionable \"${name}\" is required.`);\n }\n\n return null;\n }\n\n /**\n * Gets the subcommand name from the command.\n * @param required - Whether the subcommand is required\n * @returns The subcommand name or null if not found\n */\n getSubcommand(): string | null;\n getSubcommand(required: true): string;\n getSubcommand(required = false) {\n const sub = this.parser.getSubcommand();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand is required.');\n }\n\n return sub ?? null;\n }\n\n /**\n * Gets the subcommand group name from the command.\n * @param required - Whether the subcommand group is required\n * @returns The subcommand group name or null if not found\n */\n getSubcommandGroup(): string | null;\n getSubcommandGroup(required: true): string;\n getSubcommandGroup(required = false) {\n const sub = this.parser.getSubcommandGroup();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand group is required.');\n }\n\n return sub ?? null;\n }\n}\n"],"mappings":";;;;;;;;AAoCA,IAAa,uBAAb,MAAkC;;;;;CAKhC,UAAuC;;;;;CAMvC,WAAyC;;;;;CAMzC,QAAkB,EAAE;;;;;;;CAQpB,AAAO,YACP,AAAE,SACF,AAAE,QACF,AAAE,QACF;EAHE;EACA;EACA;;;;;;CAOF,AAAO,UAAU;AACf,EAAK,KAAK,OAAO;AACjB,SAAO,MAAK;;;;;CAMd,IAAW,UAAU;AACnB,MAAI,CAAC,MAAK,QACR,OAAK,UAAW,IAAI,sBAAsB,KAAK;AAGjD,SAAO,MAAK;;;;;;;CAQd,AAAO,UAAa,MAA6B;;AAC/C,kCAAO,KAAK,OAAO,CAAC,QAAQ,MAAM,MAAM,EAAE,SAAS,KAAK,gFAAE;;;;;;CAO5D,AAAO,aAAqB;AAC1B,SAAO,KAAK,OAAO,CAAC;;;;;;CAOtB,AAAO,gBAAoC;AACzC,SAAO,KAAK,OAAO,CAAC;;;;;;CAOtB,AAAO,qBAAyC;AAC9C,SAAO,KAAK,OAAO,CAAC;;;;;;CAOtB,AAAO,YAAY;AACjB,MAAI,KAAK,kBAAkB,QAAQ;GACjC,MAAM,QAAQ,KAAK,QAAQ,QAAQ,MAAM,KAAK,OAAO;AACrD,wDAAO,MAAQ;;AAGjB,OAAK,MAAM,KAAK,KAAK,OACnB,KAAI,KAAK,QAAQ,QAAQ,WAAW,EAAE,CACpC,QAAO;;;;;;CASb,AAAO,iBAAiB;AACtB,SAAO;GAAC,KAAK,YAAY;GAAE,KAAK,oBAAoB;GAAE,KAAK,eAAe;GAAA,CAC1E,QAAG,MAAW,EAAE,CAChB,KAAG,IAAM;;;;;;CAOX,AAAO,QAA8B;AACnC,MAAI,MAAK,OACP,QAAO,MAAK;EAGd,MAAM,UAAU,KAAK,QAAQ;EAE7B,MAAM,SAAS,KAAK,WAAW;AAE/B,MAAI,CAAC,OACH,OAAM,0CAAsB,yCAAqB,qBAAqB;EAGxE,MAAM,QAAQ,QAAQ,MAAM,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI;EAC5D,MAAM,UAAU,MAAM,OAAO;AAE7B,QAAK,OAAQ;EAEb,IAAI;EACJ,IAAI;AAEJ,wDAAI,QAAS,SAAS,IAAI,EAAE;GAC1B,MAAM,GAAG,OAAO,OAAO,QAAQ,MAAM,IAAI;AAEzC,OAAI,CAAC,OAAO,MACV,cAAa;YACJ,OAAO,OAAO;AACvB,sBAAkB;AAClB,iBAAa;;;EAIjB,MAAM,SAAS,KAAK,OAClB;GAAC;GAAS;GAAiB;GAAW,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI,CAAC,MAAM,CACxE;AAwDD,QAAK,SAAU;GACJ;GACT,SAxDc,MAChB,KAAG,SAAW;AACZ,QAAE;KACA,MAAE,CAAK,MAAM,SAAS,KAAE,MAAK,IAAQ;AAErC,SAAI,EAAE,QAAO,QAAU,QAAE;AAEzB,aAAQ,OAAE,OAAV;MACE,KAAE,wCAAK,QACL,QAAE;OAAO;OAAM,OAAO,UAAU;OAAQ;MAC1C,KAAE,wCAAK,QACL,QAAE;OAAO;OAAM,OAAO,SAAE,OAAc,GAAE;OAAG;MAC7C,KAAE,wCAAK,OACL,QAAE;OAAO;OAAM,OAAO,WAAE,MAAW;OAAM;MAC3C,KAAE,wCAAK,OACL,QAAE;OAAO;OAAM;OAAO;MACxB,KAAE,wCAAK,KACL,QAAE;OACA;OACA,OAAO,KAAE,QAAK,SAAQ,MAAS,MAAU,MAAM;AAC7C,eAAE,EAAO,OAAO,MAAE,QAAM,WAAiB,GAAG;SAC5C;OACH;MACH,KAAE,wCAAK,QACL,QAAE;OACA;OACA,OAAO,KAAE,QAAK,SAAQ,SAAS,MAAa,MAAM;AAChD,eAAE,EAAO,OAAO,MAAE,QAAM,UAAgB,GAAG;SAC3C;OACH;MACH,KAAE,wCAAK,KACL,QAAE;OACA;OACA,OAAO,KAAE,QAAK,SAAQ,MAAS,MAAU,MAAM;AAC7C,eAAE,EAAO,OAAO,MAAE,QAAM,WAAiB,GAAG;SAC5C;OACH;MACH,KAAE,wCAAK,WACL,QAAE;OACA;OACA,OAAO,KAAE,QAAK,YAAQ,MAAgB,MAAM;AAC1C,eAAE,EAAO,SAAS;SAClB;OACH;MACH,QACE,QAAE;;YAEJ;AAEF,YAAE;;KAEJ,CACF,QAAG,MAAW,MAAM,KAAG;GAKrB;GACA;GACD;AAED,SAAO,MAAK;;;;;;AAOhB,IAAa,wBAAb,MAAmC;;;;;CAKjC,AAAO,YAAY,AAAQ,QAA8B;EAA9B;;;;;;CAM3B,AAAQ,aAAgB,MAAc,WAAW,OAAO;EACtD,MAAM,SAAS,KAAK,OAAO,UAAa,KAAK;AAE7C,MAAI,YAAY,WAAW,OACzB,OAAM,IAAI,MAAM,WAAW,KAAK,gBAAgB;AAGlD,SAAO,UAAU;;CAWnB,UAAU,MAAc,WAAW,OAAO;;EACxC,MAAM,OAAO,KAAK,aAAmB,MAAM,SAAS;EACpD,MAAM,kCAAS,KAAK,OAAO,QAAQ,qFAAO,QAAQ,MAAM,gDAAI,KAAM,GAAI;AAEtE,MAAI,YAAY,CAAC,OACf,OAAM,IAAI,MAAM,WAAW,KAAK,gBAAgB;AAGlD,SAAO,UAAU;;CAWnB,cAAc,MAAc,WAAW,OAAO;AAC5C,SAAO,KAAK,aAAyB,MAAM,SAAS;;CAWtD,WAAW,MAAc,WAAW,OAAO;AACzC,SAAO,KAAK,aAAsB,MAAM,SAAS;;CAWnD,UAAU,MAAc,WAAW,OAAO;AACxC,SAAO,KAAK,aAAqB,MAAM,SAAS;;CAWlD,UAAU,MAAc,WAAW,OAAO;AACxC,SAAO,KAAK,aAAqB,MAAM,SAAS;;CAWlD,WAAW,MAAc,WAAW,OAAO;AACzC,SAAO,KAAK,aAAqB,MAAM,SAAS;;CAWlD,QAAQ,MAAc,WAAW,OAAO;AACtC,SAAO,KAAK,aAAmB,MAAM,SAAS;;CAWhD,WAAW,MAAc,WAAW,OAAO;AACzC,SAAO,KAAK,aAAsB,MAAM,SAAS;;CAWnD,QAAQ,MAAc,WAAW,OAAO;AACtC,SAAO,KAAK,aAAmB,MAAM,SAAS;;CAgBhD,eACA,MACA,WAAW,OACgE;EACzE,MAAM,SAAS,KAAK,aAAa,MAAM,SAAS;AAEhD,MACA,kBAAS,0BACT,kBAAS,mBACT,kBAAS,gBAEP,QAAO;AAGT,MAAI,SACF,OAAM,IAAI,MAAM,gBAAgB,KAAK,gBAAgB;AAGvD,SAAO;;CAUT,cAAc,WAAW,OAAO;EAC9B,MAAM,MAAM,KAAK,OAAO,eAAe;AAEvC,MAAI,YAAY,QAAQ,OACtB,OAAM,IAAI,MAAM,0BAA0B;AAG5C,SAAO,OAAO;;CAUhB,mBAAmB,WAAW,OAAO;EACnC,MAAM,MAAM,KAAK,OAAO,oBAAoB;AAE5C,MAAI,YAAY,QAAQ,OACtB,OAAM,IAAI,MAAM,gCAAgC;AAGlD,SAAO,OAAO"}
@@ -1,194 +0,0 @@
1
- import { ApplicationCommandOptionType, Attachment, CommandInteractionOption, GuildMember, Message, Role, User } from "discord.js";
2
- import { Channel } from "diagnostics_channel";
3
-
4
- //#region src/app/commands/MessageCommandParser.d.ts
5
- /**
6
- * Represents a parsed message command with its components.
7
- */
8
- interface ParsedMessageCommand {
9
- command: string;
10
- options: {
11
- name: string;
12
- value: unknown;
13
- }[];
14
- subcommand?: string;
15
- subcommandGroup?: string;
16
- }
17
- /**
18
- * Schema defining the types of options for a message command.
19
- */
20
- type MessageCommandOptionsSchema = Record<string, ApplicationCommandOptionType>;
21
- /**
22
- * Parses message content into structured command data with options and subcommands.
23
- */
24
- declare class MessageCommandParser {
25
- #private;
26
- message: Message;
27
- private prefix;
28
- private schema;
29
- /**
30
- * Creates a new message command parser.
31
- * @param message - The Discord message to parse
32
- * @param prefix - Array of valid command prefixes or a regular expression
33
- * @param schema - Function that returns the options schema for a command
34
- */
35
- constructor(message: Message, prefix: string[] | RegExp, schema: (command: string) => MessageCommandOptionsSchema);
36
- /**
37
- * Gets the parsed command arguments.
38
- * @returns Array of command arguments
39
- */
40
- getArgs(): string[];
41
- /**
42
- * Gets the message command options object for easy access to typed option values.
43
- */
44
- get options(): MessageCommandOptions;
45
- /**
46
- * Gets a specific option value by name.
47
- * @param name - The option name
48
- * @returns The option value or undefined if not found
49
- */
50
- getOption<T>(name: string): T | undefined;
51
- /**
52
- * Gets the main command name.
53
- * @returns The command name
54
- */
55
- getCommand(): string;
56
- /**
57
- * Gets the subcommand name if present.
58
- * @returns The subcommand name or undefined
59
- */
60
- getSubcommand(): string | undefined;
61
- /**
62
- * Gets the subcommand group name if present.
63
- * @returns The subcommand group name or undefined
64
- */
65
- getSubcommandGroup(): string | undefined;
66
- /**
67
- * Gets the prefix used in the message.
68
- * @returns The matched prefix or undefined
69
- */
70
- getPrefix(): string | undefined;
71
- /**
72
- * Gets the full command including subcommand group and subcommand.
73
- * @returns The complete command string
74
- */
75
- getFullCommand(): string;
76
- /**
77
- * Parses the message content into structured command data.
78
- * @returns The parsed command data
79
- */
80
- parse(): ParsedMessageCommand;
81
- }
82
- /**
83
- * Provides typed access to message command options with methods similar to Discord.js interaction options.
84
- */
85
- declare class MessageCommandOptions {
86
- private parser;
87
- /**
88
- * Creates a new message command options instance.
89
- * @param parser - The message command parser instance
90
- */
91
- constructor(parser: MessageCommandParser);
92
- /**
93
- * @private
94
- * @internal
95
- */
96
- private assertOption;
97
- /**
98
- * Gets a guild member from the command options.
99
- * @param name - The option name
100
- * @param required - Whether the option is required
101
- * @returns The guild member or null if not found
102
- */
103
- getMember(name: string): GuildMember | null;
104
- getMember(name: string, required: true): GuildMember;
105
- /**
106
- * Gets an attachment from the command options.
107
- * @param name - The option name
108
- * @param required - Whether the option is required
109
- * @returns The attachment or null if not found
110
- */
111
- getAttachment(name: string): Attachment | null;
112
- getAttachment(name: string, required: true): Attachment;
113
- /**
114
- * Gets a boolean value from the command options.
115
- * @param name - The option name
116
- * @param required - Whether the option is required
117
- * @returns The boolean value or null if not found
118
- */
119
- getBoolean(name: string): boolean | null;
120
- getBoolean(name: string, required: true): boolean;
121
- /**
122
- * Gets a number value from the command options.
123
- * @param name - The option name
124
- * @param required - Whether the option is required
125
- * @returns The number value or null if not found
126
- */
127
- getNumber(name: string): number | null;
128
- getNumber(name: string, required: true): number;
129
- /**
130
- * Gets a string value from the command options.
131
- * @param name - The option name
132
- * @param required - Whether the option is required
133
- * @returns The string value or null if not found
134
- */
135
- getString(name: string): string | null;
136
- getString(name: string, required: true): string;
137
- /**
138
- * Gets an integer value from the command options.
139
- * @param name - The option name
140
- * @param required - Whether the option is required
141
- * @returns The integer value or null if not found
142
- */
143
- getInteger(name: string): number | null;
144
- getInteger(name: string, required: true): number;
145
- /**
146
- * Gets a user from the command options.
147
- * @param name - The option name
148
- * @param required - Whether the option is required
149
- * @returns The user or null if not found
150
- */
151
- getUser(name: string): User | null;
152
- getUser(name: string, required: true): User;
153
- /**
154
- * Gets a channel from the command options.
155
- * @param name - The option name
156
- * @param required - Whether the option is required
157
- * @returns The channel or null if not found
158
- */
159
- getChannel(name: string): Channel | null;
160
- getChannel(name: string, required: true): Channel;
161
- /**
162
- * Gets a role from the command options.
163
- * @param name - The option name
164
- * @param required - Whether the option is required
165
- * @returns The role or null if not found
166
- */
167
- getRole(name: string): Role | null;
168
- getRole(name: string, required: true): Role;
169
- /**
170
- * Gets a mentionable (user, member, or role) from the command options.
171
- * @param name - The option name
172
- * @param required - Whether the option is required
173
- * @returns The mentionable or null if not found
174
- */
175
- getMentionable(name: string): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;
176
- getMentionable(name: string, required: true): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;
177
- /**
178
- * Gets the subcommand name from the command.
179
- * @param required - Whether the subcommand is required
180
- * @returns The subcommand name or null if not found
181
- */
182
- getSubcommand(): string | null;
183
- getSubcommand(required: true): string;
184
- /**
185
- * Gets the subcommand group name from the command.
186
- * @param required - Whether the subcommand group is required
187
- * @returns The subcommand group name or null if not found
188
- */
189
- getSubcommandGroup(): string | null;
190
- getSubcommandGroup(required: true): string;
191
- }
192
- //#endregion
193
- export { ParsedMessageCommand as i, MessageCommandOptionsSchema as n, MessageCommandParser as r, MessageCommandOptions as t };
194
- //# sourceMappingURL=MessageCommandParser-q3dQcE5N.d.ts.map
@@ -1,70 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- let node_crypto = require("node:crypto");
3
-
4
- //#region src/plugins/PluginCommon.ts
5
- /**
6
- * Enum representing the type of plugin.
7
- * - Compiler: A plugin that runs at compile time.
8
- * - Runtime: A plugin that runs at runtime.
9
- */
10
- let PluginType = /* @__PURE__ */ function(PluginType) {
11
- PluginType["Compiler"] = "compiler";
12
- PluginType["Runtime"] = "runtime";
13
- return PluginType;
14
- }({});
15
- /**
16
- * Base class for CommandKit plugins.
17
- */
18
- var PluginCommon = class {
19
- /**
20
- * Unique identifier for the plugin instance.
21
- */
22
- id = (0, node_crypto.randomUUID)();
23
- /**
24
- * The time when the plugin was loaded, in milliseconds since the Unix epoch.
25
- */
26
- loadedAt = Date.now();
27
- /**
28
- * Creates a new instance of the plugin.
29
- */
30
- constructor(options) {
31
- this.options = options;
32
- }
33
- /**
34
- * Called when this plugin is activated
35
- */
36
- async activate(ctx) {}
37
- /**
38
- * Called when this plugin is deactivated
39
- */
40
- async deactivate(ctx) {}
41
- };
42
- /**
43
- * Whether the given object is a CommandKit plugin.
44
- * @param plugin The object to check.
45
- * @returns Boolean indicating whether the object is a plugin.
46
- */
47
- function isPlugin(plugin) {
48
- return plugin instanceof PluginCommon;
49
- }
50
-
51
- //#endregion
52
- Object.defineProperty(exports, 'PluginCommon', {
53
- enumerable: true,
54
- get: function () {
55
- return PluginCommon;
56
- }
57
- });
58
- Object.defineProperty(exports, 'PluginType', {
59
- enumerable: true,
60
- get: function () {
61
- return PluginType;
62
- }
63
- });
64
- Object.defineProperty(exports, 'isPlugin', {
65
- enumerable: true,
66
- get: function () {
67
- return isPlugin;
68
- }
69
- });
70
- //# sourceMappingURL=PluginCommon-Bfs8d9s7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluginCommon-Bfs8d9s7.js","names":[],"sources":["../src/plugins/PluginCommon.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { CommonPluginRuntime } from './plugin-runtime/runtime';\n\n/**\n * The options for a CommandKit plugin.\n */\nexport type PluginOptions = Record<string, any>;\n\n/**\n * Enum representing the type of plugin.\n * - Compiler: A plugin that runs at compile time.\n * - Runtime: A plugin that runs at runtime.\n */\nexport enum PluginType {\n Compiler = 'compiler',\n Runtime = 'runtime',\n}\n\n/**\n * Base class for CommandKit plugins.\n */\nexport abstract class PluginCommon<\n T extends PluginOptions = PluginOptions,\n C extends CommonPluginRuntime = CommonPluginRuntime,\n> {\n /**\n * The type of the plugin, either Compiler or Runtime.\n */\n public abstract readonly type: PluginType;\n /**\n * Unique identifier for the plugin instance.\n */\n public readonly id = randomUUID();\n /**\n * The time when the plugin was loaded, in milliseconds since the Unix epoch.\n */\n public readonly loadedAt = Date.now();\n /**\n * The name of the plugin.\n */\n public abstract readonly name: string;\n\n /**\n * Creates a new instance of the plugin.\n */\n public constructor(protected readonly options: T) {}\n\n /**\n * Called when this plugin is activated\n */\n public async activate(ctx: C): Promise<void> {}\n\n /**\n * Called when this plugin is deactivated\n */\n public async deactivate(ctx: C): Promise<void> {}\n}\n\n/**\n * Whether the given object is a CommandKit plugin.\n * @param plugin The object to check.\n * @returns Boolean indicating whether the object is a plugin.\n */\nexport function isPlugin(\n plugin: unknown,\n): plugin is PluginCommon<PluginOptions> {\n return plugin instanceof PluginCommon;\n}\n"],"mappings":";;;;;;;;;AAaA,IAAY,kDAAL;AACL;AACA;;;;;;AAMF,IAAsB,eAAtB,MAGA;;;;CAQE,AAAgB,kCAAiB;;;;CAIjC,AAAgB,WAAW,KAAK,KAAK;;;;CASrC,AAAO,YAAY,AAAmB,SAAY;EAAZ;;;;;CAKtC,MAAa,SAAS,KAAuB;;;;CAK7C,MAAa,WAAW,KAAuB;;;;;;;AAQjD,SAAgB,SAChB,QACwC;AACtC,QAAO,kBAAkB"}
@@ -1,134 +0,0 @@
1
- const require_PluginCommon = require('./PluginCommon-Bfs8d9s7.js');
2
-
3
- //#region src/plugins/RuntimePlugin.ts
4
- /**
5
- * CommandKit plugin that runs at the runtime.
6
- */
7
- var RuntimePlugin = class extends require_PluginCommon.PluginCommon {
8
- type = require_PluginCommon.PluginType.Runtime;
9
- preload = /* @__PURE__ */ new Set();
10
- /**
11
- * Called before commands are loaded
12
- */
13
- async onBeforeCommandsLoad(ctx) {}
14
- /**
15
- * Called after commands are loaded
16
- */
17
- async onAfterCommandsLoad(ctx) {}
18
- /**
19
- * Called before events are loaded
20
- */
21
- async onBeforeEventsLoad(ctx) {}
22
- /**
23
- * Called after events are loaded
24
- */
25
- async onAfterEventsLoad(ctx) {}
26
- /**
27
- * Called before the client logs in
28
- */
29
- async onBeforeClientLogin(ctx) {}
30
- /**
31
- * Called after the client logs in
32
- */
33
- async onAfterClientLogin(ctx) {}
34
- /**
35
- * Called before interaction is handled
36
- * @param interaction The interaction
37
- */
38
- async onBeforeInteraction(ctx, interaction) {}
39
- /**
40
- * Called before message command is processed
41
- * @param message The message
42
- */
43
- async onBeforeMessageCommand(ctx, message) {}
44
- /**
45
- * Called before command is executed. This method can execute the command itself.
46
- * @param source The source that triggered the command
47
- * @param command The command
48
- * @param execute The function that executes the command
49
- */
50
- async executeCommand(ctx, env, source, command, execute) {
51
- return false;
52
- }
53
- /**
54
- * Called after events router is initialized
55
- * @param ctx The context
56
- */
57
- async onEventsRouterInit(ctx) {}
58
- /**
59
- * Called after commands router is initialized
60
- * @param ctx The context
61
- */
62
- async onCommandsRouterInit(ctx) {}
63
- /**
64
- * Called when HMR event is received
65
- * @param ctx The context
66
- * @param event The event
67
- */
68
- async performHMR(ctx, event) {}
69
- /**
70
- * Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.
71
- * @param ctx The context
72
- * @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command
73
- */
74
- async prepareCommand(ctx, commands) {
75
- return null;
76
- }
77
- /**
78
- * Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.
79
- * @param ctx The context
80
- * @param data The command registration data
81
- */
82
- async onBeforeRegisterCommands(ctx, event) {}
83
- /**
84
- * Called before global commands registration. This method can cancel the registration of the command and handle it manually.
85
- * This method is called after `onBeforeRegisterCommands` if that stage was not handled.
86
- * @param ctx The context
87
- * @param event The command registration data
88
- */
89
- async onBeforeRegisterGlobalCommands(ctx, event) {}
90
- /**
91
- * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
92
- * This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.
93
- * @param ctx The context
94
- * @param event The command registration data
95
- */
96
- async onBeforePrepareGuildCommandsRegistration(ctx, event) {}
97
- /**
98
- * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
99
- * This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.
100
- * @param ctx The context
101
- * @param event The command registration data
102
- */
103
- async onBeforeRegisterGuildCommands(ctx, event) {}
104
- /**
105
- * Called after command and all of its deferred functions are executed.
106
- * @param ctx The context
107
- * @param env The environment of the command. This environment contains the command execution data such as command context and more.
108
- */
109
- async onAfterCommand(ctx, env) {}
110
- /**
111
- * Called before emitting an event
112
- * @param ctx The context
113
- * @param event The event that is being emitted
114
- */
115
- async willEmitEvent(ctx, event) {}
116
- };
117
- function isRuntimePlugin(plugin) {
118
- return plugin instanceof RuntimePlugin || require_PluginCommon.isPlugin(plugin) && plugin.type === require_PluginCommon.PluginType.Runtime;
119
- }
120
-
121
- //#endregion
122
- Object.defineProperty(exports, 'RuntimePlugin', {
123
- enumerable: true,
124
- get: function () {
125
- return RuntimePlugin;
126
- }
127
- });
128
- Object.defineProperty(exports, 'isRuntimePlugin', {
129
- enumerable: true,
130
- get: function () {
131
- return isRuntimePlugin;
132
- }
133
- });
134
- //# sourceMappingURL=RuntimePlugin-BYQXQO8w.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RuntimePlugin-BYQXQO8w.js","names":[],"sources":["../src/plugins/RuntimePlugin.ts"],"sourcesContent":["import { Interaction, Message } from 'discord.js';\nimport {\n isPlugin,\n PluginCommon,\n PluginOptions,\n PluginType,\n} from './PluginCommon';\nimport type { CommandKitPluginRuntime } from './plugin-runtime/CommandKitPluginRuntime';\nimport { CommandBuilderLike, PreparedAppCommandExecution } from '../app';\nimport { CommandKitEnvironment } from '../context/environment';\nimport { CommandKitHMREvent } from '../utils/dev-hooks';\nimport { PreRegisterCommandsEvent } from '../app/register/CommandRegistrar';\nimport { CommandKitEventDispatch } from './types';\n\n/**\n * CommandKit plugin that runs at the runtime.\n */\nexport abstract class RuntimePlugin<\n T extends PluginOptions = PluginOptions,\n> extends PluginCommon<T, CommandKitPluginRuntime> {\n public readonly type = PluginType.Runtime;\n public readonly preload = new Set<string>();\n\n /**\n * Called before commands are loaded\n */\n public async onBeforeCommandsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after commands are loaded\n */\n public async onAfterCommandsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called before events are loaded\n */\n public async onBeforeEventsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after events are loaded\n */\n public async onAfterEventsLoad(ctx: CommandKitPluginRuntime): Promise<void> {}\n\n /**\n * Called before the client logs in\n */\n public async onBeforeClientLogin(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after the client logs in\n */\n public async onAfterClientLogin(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called before interaction is handled\n * @param interaction The interaction\n */\n public async onBeforeInteraction(\n ctx: CommandKitPluginRuntime,\n interaction: Interaction,\n ): Promise<void> {}\n\n /**\n * Called before message command is processed\n * @param message The message\n */\n public async onBeforeMessageCommand(\n ctx: CommandKitPluginRuntime,\n message: Message,\n ): Promise<void> {}\n\n /**\n * Called before command is executed. This method can execute the command itself.\n * @param source The source that triggered the command\n * @param command The command\n * @param execute The function that executes the command\n */\n public async executeCommand(\n ctx: CommandKitPluginRuntime,\n env: CommandKitEnvironment,\n source: Interaction | Message,\n command: PreparedAppCommandExecution,\n execute: () => Promise<any>,\n ): Promise<boolean> {\n return false;\n }\n\n /**\n * Called after events router is initialized\n * @param ctx The context\n */\n public async onEventsRouterInit(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after commands router is initialized\n * @param ctx The context\n */\n public async onCommandsRouterInit(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called when HMR event is received\n * @param ctx The context\n * @param event The event\n */\n public async performHMR(\n ctx: CommandKitPluginRuntime,\n event: CommandKitHMREvent,\n ): Promise<void> {}\n\n /**\n * Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.\n * @param ctx The context\n * @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command\n */\n async prepareCommand(\n ctx: CommandKitPluginRuntime,\n commands: CommandBuilderLike,\n ): Promise<CommandBuilderLike | null> {\n return null;\n }\n\n /**\n * Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.\n * @param ctx The context\n * @param data The command registration data\n */\n async onBeforeRegisterCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before global commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called after `onBeforeRegisterCommands` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforeRegisterGlobalCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforePrepareGuildCommandsRegistration(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforeRegisterGuildCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called after command and all of its deferred functions are executed.\n * @param ctx The context\n * @param env The environment of the command. This environment contains the command execution data such as command context and more.\n */\n async onAfterCommand(\n ctx: CommandKitPluginRuntime,\n env: CommandKitEnvironment,\n ) {}\n\n /**\n * Called before emitting an event\n * @param ctx The context\n * @param event The event that is being emitted\n */\n public async willEmitEvent(\n ctx: CommandKitPluginRuntime,\n event: CommandKitEventDispatch,\n ) {}\n}\n\nexport function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin {\n return (\n plugin instanceof RuntimePlugin ||\n (isPlugin(plugin) && plugin.type === PluginType.Runtime)\n );\n}\n"],"mappings":";;;;;;AAiBA,IAAsB,gBAAtB,cAEA,kCAA0B;CACxB,AAAgB,OAAO,gCAAW;CAClC,AAAgB,0BAAU,IAAI,KAAa;;;;CAK3C,MAAa,qBACb,KACgB;;;;CAKhB,MAAa,oBACb,KACgB;;;;CAKhB,MAAa,mBACb,KACgB;;;;CAKhB,MAAa,kBAAkB,KAA6C;;;;CAK5E,MAAa,oBACb,KACgB;;;;CAKhB,MAAa,mBACb,KACgB;;;;;CAMhB,MAAa,oBACb,KACA,aACgB;;;;;CAMhB,MAAa,uBACb,KACA,SACgB;;;;;;;CAQhB,MAAa,eACb,KACA,KACA,QACA,SACA,SACmB;AACjB,SAAO;;;;;;CAOT,MAAa,mBACb,KACgB;;;;;CAMhB,MAAa,qBACb,KACgB;;;;;;CAOhB,MAAa,WACb,KACA,OACgB;;;;;;CAOhB,MAAM,eACN,KACA,UACqC;AACnC,SAAO;;;;;;;CAQT,MAAM,yBACN,KACA,OACgB;;;;;;;CAQhB,MAAM,+BACN,KACA,OACgB;;;;;;;CAQhB,MAAM,yCACN,KACA,OACgB;;;;;;;CAQhB,MAAM,8BACN,KACA,OACgB;;;;;;CAOhB,MAAM,eACN,KACA,KACA;;;;;;CAOA,MAAa,cACb,KACA,OACA;;AAGF,SAAgB,gBAAgB,QAA0C;AACxE,QACE,kBAAkB,iBAClB,8BAAS,OAAO,IAAI,OAAO,SAAS,gCAAW"}
@@ -1,14 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- let picocolors = require("picocolors");
3
-
4
- //#region src/utils/colors.ts
5
- var colors_default = (0, picocolors.createColors)(true);
6
-
7
- //#endregion
8
- Object.defineProperty(exports, 'colors_default', {
9
- enumerable: true,
10
- get: function () {
11
- return colors_default;
12
- }
13
- });
14
- //# sourceMappingURL=colors-Csc0X4QJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"colors-Csc0X4QJ.js","names":[],"sources":["../src/utils/colors.ts"],"sourcesContent":["import { createColors } from 'picocolors';\n\nexport default createColors(true);\n"],"mappings":";;;;AAEA,kDAA4B,KAAK"}
File without changes