commandkit 1.0.0-dev.20250611020404 → 1.0.0-dev.20250611155146
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.
- package/ai.cjs +21 -0
- package/ai.d.ts +1 -0
- package/dist/ActionRow-CmTHbo2t.js.map +1 -1
- package/dist/{ActionRow-D0wafJhZ.d.ts → ActionRow-DKnFVDME.d.ts} +6 -2
- package/dist/{Button-Bl5nbwTS.d.ts → Button-4ZUXdA56.d.ts} +11 -4
- package/dist/{ButtonKit-BSI7lCI0.d.ts → ButtonKit-C7r7RPNf.d.ts} +21 -2
- package/dist/{ChannelSelectMenuKit-L15A2jpT.d.ts → ChannelSelectMenuKit-BrXvBYNH.d.ts} +19 -3
- package/dist/{CommandKit-CnLBu_7m.js → CommandKit-BqZBlSaB.js} +636 -23
- package/dist/CommandKit-BqZBlSaB.js.map +1 -0
- package/dist/{CommandKit-B-mjdP5x.d.ts → CommandKit-g7NqIdUD.d.ts} +826 -12
- package/dist/CommandKit.d.ts +25 -25
- package/dist/CommandKit.js +26 -26
- package/dist/CommandKitEventsChannel-BL_YN3Rm.js +87 -0
- package/dist/CommandKitEventsChannel-BL_YN3Rm.js.map +1 -0
- package/dist/CommandsRouter-CoOA7hkf.d.ts +146 -0
- package/dist/{CommandsRouter-BHaPno8o.js → CommandsRouter-DFRh47qD.js} +87 -1
- package/dist/CommandsRouter-DFRh47qD.js.map +1 -0
- package/dist/{CompilerPlugin-DrnhOC1c.js → CompilerPlugin-Bmy4izKz.js} +13 -2
- package/dist/CompilerPlugin-Bmy4izKz.js.map +1 -0
- package/dist/{CompilerPluginRuntime-C9wmPMQf.js → CompilerPluginRuntime-CgVU_gU0.js} +59 -1
- package/dist/CompilerPluginRuntime-CgVU_gU0.js.map +1 -0
- package/dist/DefaultLogger-pWzrSxMd.d.ts +60 -0
- package/dist/{EventInterceptor-Bvh05z7n.js → EventInterceptor-DWCHCGRh.js} +5 -1
- package/dist/EventInterceptor-DWCHCGRh.js.map +1 -0
- package/dist/{EventInterceptor-D_oEWSnF.d.ts → EventInterceptor-x-R2qshQ.d.ts} +8 -1
- package/dist/{EventWorkerContext-BYXamZ_4.d.ts → EventWorkerContext-BcXmutAi.d.ts} +25 -2
- package/dist/{EventWorkerContext-BAKiTqJz.js → EventWorkerContext-DxfS_0fJ.js} +24 -1
- package/dist/EventWorkerContext-DxfS_0fJ.js.map +1 -0
- package/dist/ILogger-Cs5SFzqd.d.ts +34 -0
- package/dist/Logger-5ew_YS4P.d.ts +37 -0
- package/dist/{MentionableSelectMenuKit-BiUSKUtZ.d.ts → MentionableSelectMenuKit-CPTKqx-O.d.ts} +14 -3
- package/dist/{MessageCommandParser-D02-wpZN.js → MessageCommandParser-Cz-3I-wL.js} +70 -2
- package/dist/MessageCommandParser-Cz-3I-wL.js.map +1 -0
- package/dist/MessageCommandParser-ROLibZPX.d.ts +195 -0
- package/dist/{Modal-Cxm6cs5c.d.ts → Modal-C6UTRdYQ.d.ts} +8 -4
- package/dist/{ModalKit-CKtQ8eXW.d.ts → ModalKit-Btz58KYn.d.ts} +23 -2
- package/dist/{PluginCommon-DPqnQngK.js → PluginCommon-D_Z8Oiic.js} +23 -1
- package/dist/PluginCommon-D_Z8Oiic.js.map +1 -0
- package/dist/{RoleSelectMenuKit-BSMKkru2.d.ts → RoleSelectMenuKit-C26lU3sN.d.ts} +19 -3
- package/dist/{RuntimePlugin-BJoDa8ZR.js → RuntimePlugin-CehKbceZ.js} +5 -2
- package/dist/RuntimePlugin-CehKbceZ.js.map +1 -0
- package/dist/SelectMenu-Diy87_ba.d.ts +137 -0
- package/dist/{StringSelectMenuKit-B9FHTe48.d.ts → StringSelectMenuKit-Bhs8U6WI.d.ts} +19 -3
- package/dist/{UserSelectMenuKit-DiP0imyo.d.ts → UserSelectMenuKit-CfqFJdxz.d.ts} +19 -3
- package/dist/analytics/analytics-engine.d.ts +25 -25
- package/dist/analytics/analytics-engine.js +26 -26
- package/dist/analytics/analytics-provider.d.ts +25 -25
- package/dist/analytics/constants.d.ts +13 -0
- package/dist/analytics/constants.js +1 -1
- package/dist/analytics/utils.d.ts +13 -0
- package/dist/analytics/utils.js +26 -26
- package/dist/app/commands/AppCommandRunner.d.ts +26 -26
- package/dist/app/commands/AppCommandRunner.js +26 -26
- package/dist/app/commands/Context.d.ts +25 -25
- package/dist/app/commands/Context.js +26 -26
- package/dist/app/commands/MessageCommandParser.d.ts +1 -1
- package/dist/app/commands/MessageCommandParser.js +2 -2
- package/dist/app/commands/helpers.d.ts +1 -1
- package/dist/app/commands/helpers.js +1 -1
- package/dist/app/events/EventWorkerContext.d.ts +26 -26
- package/dist/app/events/EventWorkerContext.js +1 -1
- package/dist/app/handlers/AppCommandHandler.d.ts +26 -26
- package/dist/app/handlers/AppCommandHandler.js +26 -26
- package/dist/app/handlers/AppEventsHandler.d.ts +25 -25
- package/dist/app/handlers/AppEventsHandler.js +26 -26
- package/dist/app/index.d.ts +26 -26
- package/dist/app/index.js +27 -27
- package/dist/app/middleware/signals.js +2 -2
- package/dist/app/register/CommandRegistrar.d.ts +25 -25
- package/dist/app/register/CommandRegistrar.js +26 -26
- package/dist/app/router/CommandsRouter.d.ts +1 -1
- package/dist/app/router/CommandsRouter.js +1 -1
- package/dist/app/router/index.d.ts +1 -1
- package/dist/app/router/index.js +1 -1
- package/dist/{app-process-YbSHvqf-.js → app-process-Bo-LedP8.js} +11 -3
- package/dist/app-process-Bo-LedP8.js.map +1 -0
- package/dist/{build-BejatFZX.js → build-B-Ae1hqg.js} +14 -6
- package/dist/build-B-Ae1hqg.js.map +1 -0
- package/dist/cli/app-process.d.ts +5 -0
- package/dist/cli/app-process.js +5 -5
- package/dist/cli/build.d.ts +33 -25
- package/dist/cli/build.js +29 -29
- package/dist/cli/common.d.ts +57 -27
- package/dist/cli/common.js +3 -3
- package/dist/cli/development.d.ts +4 -0
- package/dist/cli/development.js +46 -30
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.d.ts +32 -0
- package/dist/cli/env.js +1 -1
- package/dist/cli/generators.d.ts +8 -0
- package/dist/cli/generators.js +27 -3
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.d.ts +4 -0
- package/dist/cli/information.js +17 -1
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.js +27 -27
- package/dist/cli/production.d.ts +9 -0
- package/dist/cli/production.js +39 -31
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.d.ts +2 -0
- package/dist/cli/type-checker.js +4 -4
- package/dist/cli/utils.d.ts +5 -0
- package/dist/cli/utils.js +1 -1
- package/dist/{common-pvPJVTfe.d.ts → common-DOCvOVC4.d.ts} +7 -2
- package/dist/{common-CW8v7gAn.js → common-Dasi9oKU.js} +44 -2
- package/dist/common-Dasi9oKU.js.map +1 -0
- package/dist/{common-CeO-vn8Y.js → common-vnMIelAE.js} +4 -1
- package/dist/common-vnMIelAE.js.map +1 -0
- package/dist/components/common/EventInterceptor.d.ts +1 -1
- package/dist/components/common/EventInterceptor.js +1 -1
- package/dist/components/common/element.d.ts +4 -4
- package/dist/components/common/element.js +2 -2
- package/dist/components/index.d.ts +20 -20
- package/dist/components/index.js +26 -26
- package/dist/components/v1/action-row/ActionRow.d.ts +5 -5
- package/dist/components/v1/button/Button.d.ts +5 -5
- package/dist/components/v1/button/Button.js +26 -26
- package/dist/components/v1/button/ButtonKit.d.ts +2 -2
- package/dist/components/v1/button/ButtonKit.js +26 -26
- package/dist/components/v1/modal/Modal.d.ts +5 -5
- package/dist/components/v1/modal/Modal.js +26 -26
- package/dist/components/v1/modal/ModalKit.d.ts +2 -2
- package/dist/components/v1/modal/ModalKit.js +26 -26
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.d.ts +3 -3
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +26 -26
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.d.ts +3 -3
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +26 -26
- package/dist/components/v1/select-menu/RoleSelectMenuKit.d.ts +3 -3
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js +26 -26
- package/dist/components/v1/select-menu/SelectMenu.d.ts +8 -8
- package/dist/components/v1/select-menu/SelectMenu.js +26 -26
- package/dist/components/v1/select-menu/StringSelectMenuKit.d.ts +3 -3
- package/dist/components/v1/select-menu/StringSelectMenuKit.js +26 -26
- package/dist/components/v1/select-menu/UserSelectMenuKit.d.ts +3 -3
- package/dist/components/v1/select-menu/UserSelectMenuKit.js +26 -26
- package/dist/components/v1/select-menu/common.d.ts +2 -2
- package/dist/components/v2/common.d.ts +4 -0
- package/dist/components/v2/common.js +1 -1
- package/dist/components/v2/container.d.ts +1 -1
- package/dist/components/v2/container.js +2 -2
- package/dist/components/v2/file.d.ts +1 -1
- package/dist/components/v2/file.js +1 -1
- package/dist/components/v2/index.d.ts +6 -6
- package/dist/components/v2/index.js +7 -7
- package/dist/components/v2/media-gallery.d.ts +1 -1
- package/dist/components/v2/media-gallery.js +2 -2
- package/dist/components/v2/section.d.ts +1 -1
- package/dist/components/v2/section.js +2 -2
- package/dist/components/v2/separator.d.ts +1 -1
- package/dist/components/v2/separator.js +1 -1
- package/dist/components/v2/text-display.d.ts +1 -1
- package/dist/components/v2/text-display.js +1 -1
- package/dist/config/config.d.ts +28 -28
- package/dist/config/config.js +26 -26
- package/dist/config/default.d.ts +30 -27
- package/dist/config/default.js +26 -26
- package/dist/config/loader.d.ts +33 -27
- package/dist/config/loader.js +26 -26
- package/dist/config/types.d.ts +26 -26
- package/dist/config/utils.d.ts +27 -27
- package/dist/config/utils.js +3 -0
- package/dist/config/utils.js.map +1 -1
- package/dist/{config-BjmEZYpx.d.ts → config-CGECBFwj.d.ts} +3 -3
- package/dist/constants-BTttfrm3.d.ts +42 -0
- package/dist/{constants-DWe181uQ.js → constants-CXwjhIYH.js} +9 -1
- package/dist/constants-CXwjhIYH.js.map +1 -0
- package/dist/{constants-CCqS_v55.js → constants-DDRctWlU.js} +14 -8
- package/dist/constants-DDRctWlU.js.map +1 -0
- package/dist/{container-CpuiLsZM.js → container-DCjIgp-B.js} +12 -2
- package/dist/container-DCjIgp-B.js.map +1 -0
- package/dist/container-DaUKKPm-.d.ts +24 -0
- package/dist/context/async-context.d.ts +25 -25
- package/dist/context/async-context.js +26 -26
- package/dist/context/environment.d.ts +25 -25
- package/dist/context/environment.js +26 -26
- package/dist/element-CAXu1XtK.d.ts +72 -0
- package/dist/{element-DcqNz1dV.js → element-Cq-LoDjk.js} +27 -2
- package/dist/element-Cq-LoDjk.js.map +1 -0
- package/dist/{env-ERkaRfQO.js → env-DemeP-uq.js} +33 -1
- package/dist/env-DemeP-uq.js.map +1 -0
- package/dist/{error-codes-C_UO39jz.js → error-codes-CxlUBdF6.js} +20 -1
- package/dist/error-codes-CxlUBdF6.js.map +1 -0
- package/dist/events/CommandKitEventsChannel.d.ts +25 -25
- package/dist/events/CommandKitEventsChannel.js +1 -1
- package/dist/{feature-flags-BFiGn38a.js → feature-flags-CvHcOB7L.js} +4 -4
- package/dist/feature-flags-CvHcOB7L.js.map +1 -0
- package/dist/file-DTrr-p09.d.ts +24 -0
- package/dist/{file-DE69SSOP.js → file-DVZC0QXI.js} +11 -1
- package/dist/file-DVZC0QXI.js.map +1 -0
- package/dist/flags/FlagProvider.d.ts +25 -25
- package/dist/flags/feature-flags.d.ts +25 -25
- package/dist/flags/feature-flags.js +27 -27
- package/dist/flags/store.d.ts +25 -25
- package/dist/flags/store.js +1 -1
- package/dist/{helpers-CswC9gKF.js → helpers-CnfXqF_k.js} +11 -1
- package/dist/helpers-CnfXqF_k.js.map +1 -0
- package/dist/helpers-Wg6P5fRQ.d.ts +23 -0
- package/dist/index.d.ts +34 -34
- package/dist/index.js +30 -31
- package/dist/{init-BDgyvx9E.js → init-BQgLOfl_.js} +6 -6
- package/dist/{init-BDgyvx9E.js.map → init-BQgLOfl_.js.map} +1 -1
- package/dist/logger/DefaultLogger.d.ts +2 -2
- package/dist/logger/DefaultLogger.js +26 -26
- package/dist/logger/ILogger.d.ts +1 -1
- package/dist/logger/Logger.d.ts +2 -2
- package/dist/logger/Logger.js +26 -26
- package/dist/media-gallery-BMsXSot3.d.ts +49 -0
- package/dist/{media-gallery-nUEHqKVF.js → media-gallery-CIKypjbJ.js} +27 -2
- package/dist/media-gallery-CIKypjbJ.js.map +1 -0
- package/dist/plugins/CompilerPlugin.d.ts +25 -25
- package/dist/plugins/CompilerPlugin.js +2 -2
- package/dist/plugins/PluginCommon.d.ts +25 -25
- package/dist/plugins/PluginCommon.js +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +25 -25
- package/dist/plugins/RuntimePlugin.js +2 -2
- package/dist/plugins/index.d.ts +25 -25
- package/dist/plugins/index.js +26 -26
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +25 -25
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +26 -26
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +25 -25
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +25 -25
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +26 -26
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +37 -25
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +26 -26
- package/dist/plugins/plugin-runtime/runtime.d.ts +25 -25
- package/dist/plugins/types.d.ts +25 -25
- package/dist/{section-D6t7tyEZ.js → section-CuYr0Inu.js} +22 -2
- package/dist/section-CuYr0Inu.js.map +1 -0
- package/dist/section-Dh_FhPeC.d.ts +45 -0
- package/dist/separator-CMf6Cyy5.d.ts +22 -0
- package/dist/{separator-DYAFK-Jj.js → separator-DLdWBjSN.js} +11 -1
- package/dist/separator-DLdWBjSN.js.map +1 -0
- package/dist/{signals-scJdEbly.js → signals-CSSSZAZ6.js} +2 -2
- package/dist/{signals-scJdEbly.js.map → signals-CSSSZAZ6.js.map} +1 -1
- package/dist/{store-Ci6ib2C9.js → store-x93NXUy_.js} +5 -1
- package/dist/store-x93NXUy_.js.map +1 -0
- package/dist/{text-display-Dy6JHB5X.js → text-display--p2-BoUa.js} +13 -1
- package/dist/text-display--p2-BoUa.js.map +1 -0
- package/dist/text-display-DRw3r_lK.d.ts +33 -0
- package/dist/{type-checker-CXVdS7qc.js → type-checker-P8oyY259.js} +6 -2
- package/dist/type-checker-P8oyY259.js.map +1 -0
- package/dist/{types-package-CTSNSM93.js → types-package-BpY3acyl.js} +8 -2
- package/dist/types-package-BpY3acyl.js.map +1 -0
- package/dist/{types-DjL43eQS.d.ts → types-uBjT82V4.d.ts} +2 -2
- package/dist/types.d.ts +25 -25
- package/dist/{utilities-DQT4lzAB.d.ts → utilities-D_MFPmTe.d.ts} +45 -2
- package/dist/utils/constants.d.ts +2 -2
- package/dist/utils/constants.js +1 -2
- package/dist/utils/dev-hooks.d.ts +26 -26
- package/dist/utils/dev-hooks.js +26 -26
- package/dist/utils/error-codes.d.ts +34 -0
- package/dist/utils/error-codes.js +1 -1
- package/dist/utils/types-package.d.ts +6 -0
- package/dist/utils/types-package.js +2 -2
- package/dist/utils/utilities.d.ts +1 -1
- package/dist/utils/utilities.js +26 -26
- package/dist/utils/warn-unstable.d.ts +10 -0
- package/dist/utils/warn-unstable.js +1 -1
- package/dist/{utils-VCdd7XhD.d.ts → utils-Bz_BoOnV.d.ts} +12 -2
- package/dist/{utils-IYtoeTur.js → utils-C8a_hMvn.js} +5 -1
- package/dist/utils-C8a_hMvn.js.map +1 -0
- package/dist/{version-CS1EiTrw.js → version-AMyvJ7I3.js} +5 -2
- package/dist/version-AMyvJ7I3.js.map +1 -0
- package/dist/version.js +1 -1
- package/dist/{warn-unstable-DHLaxPC8.js → warn-unstable-CttBdmlS.js} +11 -1
- package/dist/warn-unstable-CttBdmlS.js.map +1 -0
- package/package.json +10 -3
- package/dist/CommandKit-CnLBu_7m.js.map +0 -1
- package/dist/CommandKitEventsChannel-B6LKgxmv.js +0 -44
- package/dist/CommandKitEventsChannel-B6LKgxmv.js.map +0 -1
- package/dist/CommandsRouter-BHaPno8o.js.map +0 -1
- package/dist/CommandsRouter-C7X-eXE2.d.ts +0 -67
- package/dist/CompilerPlugin-DrnhOC1c.js.map +0 -1
- package/dist/CompilerPluginRuntime-C9wmPMQf.js.map +0 -1
- package/dist/DefaultLogger-CcW-Fuq5.d.ts +0 -30
- package/dist/EventInterceptor-Bvh05z7n.js.map +0 -1
- package/dist/EventWorkerContext-BAKiTqJz.js.map +0 -1
- package/dist/ILogger-kqwb2kUu.d.ts +0 -11
- package/dist/Logger-B4B_URL-.d.ts +0 -17
- package/dist/MessageCommandParser-D02-wpZN.js.map +0 -1
- package/dist/MessageCommandParser-tzroBwij.d.ts +0 -62
- package/dist/PluginCommon-DPqnQngK.js.map +0 -1
- package/dist/RuntimePlugin-BJoDa8ZR.js.map +0 -1
- package/dist/SelectMenu-b7jgrkjO.d.ts +0 -36
- package/dist/app-process-YbSHvqf-.js.map +0 -1
- package/dist/build-BejatFZX.js.map +0 -1
- package/dist/common-CW8v7gAn.js.map +0 -1
- package/dist/common-CeO-vn8Y.js.map +0 -1
- package/dist/constants-BPWSrMkn.d.ts +0 -18
- package/dist/constants-CCqS_v55.js.map +0 -1
- package/dist/constants-DWe181uQ.js.map +0 -1
- package/dist/container-CpuiLsZM.js.map +0 -1
- package/dist/container-CwEATQy2.d.ts +0 -10
- package/dist/element-D_nyVwgB.d.ts +0 -30
- package/dist/element-DcqNz1dV.js.map +0 -1
- package/dist/env-ERkaRfQO.js.map +0 -1
- package/dist/error-codes-C_UO39jz.js.map +0 -1
- package/dist/feature-flags-BFiGn38a.js.map +0 -1
- package/dist/file-BdyYwkaI.d.ts +0 -10
- package/dist/file-DE69SSOP.js.map +0 -1
- package/dist/helpers-CswC9gKF.js.map +0 -1
- package/dist/helpers-DAmE106r.d.ts +0 -9
- package/dist/media-gallery-DCu02VXc.d.ts +0 -17
- package/dist/media-gallery-nUEHqKVF.js.map +0 -1
- package/dist/section-D6t7tyEZ.js.map +0 -1
- package/dist/section-fktaECHL.d.ts +0 -18
- package/dist/separator-CuesaLrC.d.ts +0 -8
- package/dist/separator-DYAFK-Jj.js.map +0 -1
- package/dist/store-Ci6ib2C9.js.map +0 -1
- package/dist/text-display-DNMwmGHJ.d.ts +0 -12
- package/dist/text-display-Dy6JHB5X.js.map +0 -1
- package/dist/type-checker-CXVdS7qc.js.map +0 -1
- package/dist/types-package-CTSNSM93.js.map +0 -1
- package/dist/utils/clone.d.ts +0 -5
- package/dist/utils/clone.js +0 -9
- package/dist/utils/clone.js.map +0 -1
- package/dist/utils/get-paths.d.ts +0 -6
- package/dist/utils/get-paths.js +0 -34
- package/dist/utils/get-paths.js.map +0 -1
- package/dist/utils-IYtoeTur.js.map +0 -1
- package/dist/version-CS1EiTrw.js.map +0 -1
- package/dist/warn-unstable-DHLaxPC8.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
2
|
const require_colors = require('./colors-Cd4Oz-r-.js');
|
|
3
|
-
const require_error_codes = require('./error-codes-
|
|
4
|
-
const require_warn_unstable = require('./warn-unstable-
|
|
5
|
-
const require_element = require('./element-
|
|
6
|
-
const require_EventInterceptor = require('./EventInterceptor-
|
|
7
|
-
const require_constants = require('./constants-
|
|
8
|
-
const require_CompilerPlugin = require('./CompilerPlugin-
|
|
9
|
-
const require_RuntimePlugin = require('./RuntimePlugin-
|
|
10
|
-
const require_EventWorkerContext = require('./EventWorkerContext-
|
|
3
|
+
const require_error_codes = require('./error-codes-CxlUBdF6.js');
|
|
4
|
+
const require_warn_unstable = require('./warn-unstable-CttBdmlS.js');
|
|
5
|
+
const require_element = require('./element-Cq-LoDjk.js');
|
|
6
|
+
const require_EventInterceptor = require('./EventInterceptor-DWCHCGRh.js');
|
|
7
|
+
const require_constants = require('./constants-DDRctWlU.js');
|
|
8
|
+
const require_CompilerPlugin = require('./CompilerPlugin-Bmy4izKz.js');
|
|
9
|
+
const require_RuntimePlugin = require('./RuntimePlugin-CehKbceZ.js');
|
|
10
|
+
const require_EventWorkerContext = require('./EventWorkerContext-DxfS_0fJ.js');
|
|
11
11
|
const require_resolve_file_url = require('./resolve-file-url-ifwdwqmq.js');
|
|
12
|
-
const require_MessageCommandParser = require('./MessageCommandParser-
|
|
13
|
-
const require_signals = require('./signals-
|
|
14
|
-
const require_constants$1 = require('./constants-
|
|
15
|
-
const require_types_package = require('./types-package-
|
|
16
|
-
const require_CommandsRouter = require('./CommandsRouter-
|
|
12
|
+
const require_MessageCommandParser = require('./MessageCommandParser-Cz-3I-wL.js');
|
|
13
|
+
const require_signals = require('./signals-CSSSZAZ6.js');
|
|
14
|
+
const require_constants$1 = require('./constants-CXwjhIYH.js');
|
|
15
|
+
const require_types_package = require('./types-package-BpY3acyl.js');
|
|
16
|
+
const require_CommandsRouter = require('./CommandsRouter-DFRh47qD.js');
|
|
17
17
|
const require_EventsRouter = require('./EventsRouter-CqnrlbjN.js');
|
|
18
|
-
const require_common = require('./common-
|
|
19
|
-
const require_CommandKitEventsChannel = require('./CommandKitEventsChannel-
|
|
20
|
-
const require_store = require('./store-
|
|
18
|
+
const require_common = require('./common-Dasi9oKU.js');
|
|
19
|
+
const require_CommandKitEventsChannel = require('./CommandKitEventsChannel-BL_YN3Rm.js');
|
|
20
|
+
const require_store = require('./store-x93NXUy_.js');
|
|
21
21
|
const node_events = require_chunk.__toESM(require("node:events"));
|
|
22
22
|
const discord_js = require_chunk.__toESM(require("discord.js"));
|
|
23
23
|
const node_async_hooks = require_chunk.__toESM(require("node:async_hooks"));
|
|
@@ -29,12 +29,23 @@ const __rollup_plugin_json = require_chunk.__toESM(require("@rollup/plugin-json"
|
|
|
29
29
|
//#region src/context/async-context.ts
|
|
30
30
|
const kCommandWorker = Symbol("commandkitCommandWorker");
|
|
31
31
|
const context = new node_async_hooks.AsyncLocalStorage();
|
|
32
|
+
/**
|
|
33
|
+
* Checks if the given worker is a CommandKit worker context.
|
|
34
|
+
* @param worker The worker to check.
|
|
35
|
+
* @returns True if the worker is a CommandKit worker context, false otherwise.
|
|
36
|
+
*/
|
|
32
37
|
function isCommandWorkerContext(worker) {
|
|
33
38
|
return worker && Reflect.get(worker, kCommandWorker) === true;
|
|
34
39
|
}
|
|
35
40
|
function exitContext(fn) {
|
|
36
41
|
return context.exit(fn);
|
|
37
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Executes the provided function within a CommandKit context.
|
|
45
|
+
* @param value The CommandKit environment to use for the context.
|
|
46
|
+
* @param receiver The function to execute within the context.
|
|
47
|
+
* @returns The result of the receiver function.
|
|
48
|
+
*/
|
|
38
49
|
function provideContext(value, receiver) {
|
|
39
50
|
Reflect.set(value, kCommandWorker, true);
|
|
40
51
|
return context.run(value, receiver);
|
|
@@ -90,6 +101,9 @@ function useEnvironment() {
|
|
|
90
101
|
|
|
91
102
|
//#endregion
|
|
92
103
|
//#region src/components/v1/button/ButtonKit.ts
|
|
104
|
+
/**
|
|
105
|
+
* A builder for creating buttons with additional features like interaction collectors and event handling.
|
|
106
|
+
*/
|
|
93
107
|
var ButtonKit = class extends discord_js.ButtonBuilder {
|
|
94
108
|
#onClickHandler = null;
|
|
95
109
|
#contextData = {
|
|
@@ -196,6 +210,9 @@ var ButtonKit = class extends discord_js.ButtonBuilder {
|
|
|
196
210
|
return handler(interaction, this);
|
|
197
211
|
}, this.#contextData);
|
|
198
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Disposes of the button collector and cleans up resources.
|
|
215
|
+
*/
|
|
199
216
|
dispose() {
|
|
200
217
|
this.#destroyCollector();
|
|
201
218
|
return this;
|
|
@@ -237,6 +254,11 @@ function Button(props) {
|
|
|
237
254
|
|
|
238
255
|
//#endregion
|
|
239
256
|
//#region src/components/v1/modal/ModalKit.ts
|
|
257
|
+
/**
|
|
258
|
+
* A builder for creating modals with additional features like interaction collectors and event handling.
|
|
259
|
+
* This class extends the ModalBuilder from discord.js and adds methods for handling interactions.
|
|
260
|
+
* It allows you to set a handler for when the modal is submitted, filter interactions, and handle the end of the interaction collector.
|
|
261
|
+
*/
|
|
240
262
|
var ModalKit = class extends discord_js.ModalBuilder {
|
|
241
263
|
#onSubmitHandler = null;
|
|
242
264
|
#contextData = {
|
|
@@ -339,6 +361,9 @@ var ModalKit = class extends discord_js.ModalBuilder {
|
|
|
339
361
|
return handler(interaction, this);
|
|
340
362
|
}, this.#contextData);
|
|
341
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* Disposes of the modal collector and cleans up resources.
|
|
366
|
+
*/
|
|
342
367
|
dispose() {
|
|
343
368
|
this.#destroyCollector();
|
|
344
369
|
return this;
|
|
@@ -421,6 +446,11 @@ function ParagraphInput(props) {
|
|
|
421
446
|
|
|
422
447
|
//#endregion
|
|
423
448
|
//#region src/components/v1/select-menu/StringSelectMenuKit.ts
|
|
449
|
+
/**
|
|
450
|
+
* A builder for creating string select menus with additional features like interaction collectors and event handling.
|
|
451
|
+
* This class extends the StringSelectMenuBuilder from discord.js and adds methods for handling interactions.
|
|
452
|
+
* It allows you to set a handler for when the string select menu is submitted, filter interactions, and handle the end of the interaction collector.
|
|
453
|
+
*/
|
|
424
454
|
var StringSelectMenuKit = class extends discord_js.StringSelectMenuBuilder {
|
|
425
455
|
#onSelectHandler = null;
|
|
426
456
|
#contextData = {
|
|
@@ -523,6 +553,9 @@ var StringSelectMenuKit = class extends discord_js.StringSelectMenuBuilder {
|
|
|
523
553
|
return handler(interaction, this);
|
|
524
554
|
}, this.#contextData);
|
|
525
555
|
}
|
|
556
|
+
/**
|
|
557
|
+
* Disposes of the interaction collector and cleans up resources.
|
|
558
|
+
*/
|
|
526
559
|
dispose() {
|
|
527
560
|
this.#destroyCollector();
|
|
528
561
|
return this;
|
|
@@ -538,6 +571,11 @@ var StringSelectMenuKit = class extends discord_js.StringSelectMenuBuilder {
|
|
|
538
571
|
|
|
539
572
|
//#endregion
|
|
540
573
|
//#region src/components/v1/select-menu/ChannelSelectMenuKit.ts
|
|
574
|
+
/**
|
|
575
|
+
* A builder for creating channel select menus with additional features like interaction collectors and event handling.
|
|
576
|
+
* This class extends the ChannelSelectMenuBuilder from discord.js and adds methods for handling interactions.
|
|
577
|
+
* It allows you to set a handler for when the channel select menu is submitted, filter interactions, and handle the end of the interaction collector.
|
|
578
|
+
*/
|
|
541
579
|
var ChannelSelectMenuKit = class extends discord_js.ChannelSelectMenuBuilder {
|
|
542
580
|
#onSelectHandler = null;
|
|
543
581
|
#contextData = {
|
|
@@ -640,6 +678,9 @@ var ChannelSelectMenuKit = class extends discord_js.ChannelSelectMenuBuilder {
|
|
|
640
678
|
return handler(interaction, this);
|
|
641
679
|
}, this.#contextData);
|
|
642
680
|
}
|
|
681
|
+
/**
|
|
682
|
+
* Cleans up the interaction collector and removes the handler.
|
|
683
|
+
*/
|
|
643
684
|
dispose() {
|
|
644
685
|
this.#destroyCollector();
|
|
645
686
|
return this;
|
|
@@ -757,6 +798,9 @@ var MentionableSelectMenuKit = class extends discord_js.MentionableSelectMenuBui
|
|
|
757
798
|
return handler(interaction, this);
|
|
758
799
|
}, this.#contextData);
|
|
759
800
|
}
|
|
801
|
+
/**
|
|
802
|
+
* Disposes of the mentionable select menu kit, cleaning up any resources used by the interaction collector.
|
|
803
|
+
*/
|
|
760
804
|
dispose() {
|
|
761
805
|
this.#destroyCollector();
|
|
762
806
|
return this;
|
|
@@ -772,6 +816,11 @@ var MentionableSelectMenuKit = class extends discord_js.MentionableSelectMenuBui
|
|
|
772
816
|
|
|
773
817
|
//#endregion
|
|
774
818
|
//#region src/components/v1/select-menu/UserSelectMenuKit.ts
|
|
819
|
+
/**
|
|
820
|
+
* A builder for creating user select menus with additional features like interaction collectors and event handling.
|
|
821
|
+
* This class extends the UserSelectMenuBuilder from discord.js and adds methods for handling interactions.
|
|
822
|
+
* It allows you to set a handler for when the user select menu is submitted, filter interactions, and handle the end of the interaction collector.
|
|
823
|
+
*/
|
|
775
824
|
var UserSelectMenuKit = class extends discord_js.UserSelectMenuBuilder {
|
|
776
825
|
#onSelectHandler = null;
|
|
777
826
|
#contextData = {
|
|
@@ -874,6 +923,9 @@ var UserSelectMenuKit = class extends discord_js.UserSelectMenuBuilder {
|
|
|
874
923
|
return handler(interaction, this);
|
|
875
924
|
}, this.#contextData);
|
|
876
925
|
}
|
|
926
|
+
/**
|
|
927
|
+
* Disposes of the user select menu kit, cleaning up any collectors and handlers.
|
|
928
|
+
*/
|
|
877
929
|
dispose() {
|
|
878
930
|
this.#destroyCollector();
|
|
879
931
|
return this;
|
|
@@ -889,6 +941,11 @@ var UserSelectMenuKit = class extends discord_js.UserSelectMenuBuilder {
|
|
|
889
941
|
|
|
890
942
|
//#endregion
|
|
891
943
|
//#region src/components/v1/select-menu/RoleSelectMenuKit.ts
|
|
944
|
+
/**
|
|
945
|
+
* A builder for creating role select menus with additional features like interaction collectors and event handling.
|
|
946
|
+
* This class extends the RoleSelectMenuBuilder from discord.js and adds methods for handling interactions.
|
|
947
|
+
* It allows you to set a handler for when the role select menu is submitted, filter interactions, and handle the end of the interaction collector.
|
|
948
|
+
*/
|
|
892
949
|
var RoleSelectMenuKit = class extends discord_js.RoleSelectMenuBuilder {
|
|
893
950
|
#onSelectHandler = null;
|
|
894
951
|
#contextData = {
|
|
@@ -991,6 +1048,9 @@ var RoleSelectMenuKit = class extends discord_js.RoleSelectMenuBuilder {
|
|
|
991
1048
|
return handler(interaction, this);
|
|
992
1049
|
}, this.#contextData);
|
|
993
1050
|
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Disposes of the role select menu kit, cleaning up any resources and event listeners.
|
|
1053
|
+
*/
|
|
994
1054
|
dispose() {
|
|
995
1055
|
this.#destroyCollector();
|
|
996
1056
|
return this;
|
|
@@ -1006,6 +1066,9 @@ var RoleSelectMenuKit = class extends discord_js.RoleSelectMenuBuilder {
|
|
|
1006
1066
|
|
|
1007
1067
|
//#endregion
|
|
1008
1068
|
//#region src/components/v1/select-menu/SelectMenu.ts
|
|
1069
|
+
/**
|
|
1070
|
+
* @private
|
|
1071
|
+
*/
|
|
1009
1072
|
function applyPropsToBuilder(builder, props) {
|
|
1010
1073
|
builder.setCustomId(props.customId ?? `select-menu::${crypto.randomUUID()}`);
|
|
1011
1074
|
if (props.maxValues != null) builder.setMaxValues(props.maxValues);
|
|
@@ -1016,6 +1079,24 @@ function applyPropsToBuilder(builder, props) {
|
|
|
1016
1079
|
if (props.onError) builder.onError(props.onError);
|
|
1017
1080
|
if (props.onSelect) builder.onSelect(props.onSelect, props.options);
|
|
1018
1081
|
}
|
|
1082
|
+
/**
|
|
1083
|
+
* The StringSelectMenu component.
|
|
1084
|
+
* @param props The properties for the string select menu component.
|
|
1085
|
+
* @returns The string select menu builder instance.
|
|
1086
|
+
* @example ```tsx
|
|
1087
|
+
* import { StringSelectMenu } from 'commandkit';
|
|
1088
|
+
*
|
|
1089
|
+
* const stringSelectMenu = <StringSelectMenu
|
|
1090
|
+
* customId="my-select-menu"
|
|
1091
|
+
* placeholder="Select an option"
|
|
1092
|
+
* maxValues={1}
|
|
1093
|
+
* minValues={1}
|
|
1094
|
+
* >
|
|
1095
|
+
* <StringSelectMenuOption label="Option 1" value="option1" />
|
|
1096
|
+
* <StringSelectMenuOption label="Option 2" value="option2" />
|
|
1097
|
+
* </StringSelectMenu>
|
|
1098
|
+
* ```
|
|
1099
|
+
*/
|
|
1019
1100
|
function StringSelectMenu(props) {
|
|
1020
1101
|
const builder = new StringSelectMenuKit();
|
|
1021
1102
|
applyPropsToBuilder(builder, props);
|
|
@@ -1023,27 +1104,75 @@ function StringSelectMenu(props) {
|
|
|
1023
1104
|
if (props.children) builder.setOptions(Array.isArray(props.children) ? props.children : [props.children]);
|
|
1024
1105
|
return builder;
|
|
1025
1106
|
}
|
|
1107
|
+
/**
|
|
1108
|
+
* A select menu option for the string select menu.
|
|
1109
|
+
* @param props The properties for the string select menu option.
|
|
1110
|
+
* @returns The string select menu option builder instance.
|
|
1111
|
+
* @example ```tsx
|
|
1112
|
+
* import { StringSelectMenuOption } from 'commandkit';
|
|
1113
|
+
*
|
|
1114
|
+
* const option = <StringSelectMenuOption label="Option 1" value="option1" />;
|
|
1115
|
+
* ```
|
|
1116
|
+
*/
|
|
1026
1117
|
function StringSelectMenuOption(props) {
|
|
1027
1118
|
return new discord_js.StringSelectMenuOptionBuilder(props);
|
|
1028
1119
|
}
|
|
1120
|
+
/**
|
|
1121
|
+
* The UserSelectMenu component.
|
|
1122
|
+
* @param props The properties for the user select menu component.
|
|
1123
|
+
* @returns The user select menu builder instance.
|
|
1124
|
+
* @example ```tsx
|
|
1125
|
+
* import { UserSelectMenu } from 'commandkit';
|
|
1126
|
+
*
|
|
1127
|
+
* const userSelectMenu = <UserSelectMenu />
|
|
1128
|
+
* ```
|
|
1129
|
+
*/
|
|
1029
1130
|
function UserSelectMenu(props) {
|
|
1030
1131
|
const builder = new UserSelectMenuKit();
|
|
1031
1132
|
applyPropsToBuilder(builder, props);
|
|
1032
1133
|
if (props.defaultValues) builder.setDefaultUsers(Array.isArray(props.defaultValues) ? props.defaultValues : [props.defaultValues]);
|
|
1033
1134
|
return builder;
|
|
1034
1135
|
}
|
|
1136
|
+
/**
|
|
1137
|
+
* The RoleSelectMenu component.
|
|
1138
|
+
* @param props The properties for the role select menu component.
|
|
1139
|
+
* @returns The role select menu builder instance.
|
|
1140
|
+
* @example ```tsx
|
|
1141
|
+
* import { RoleSelectMenu } from 'commandkit';
|
|
1142
|
+
*
|
|
1143
|
+
* const roleSelectMenu = <RoleSelectMenu />
|
|
1144
|
+
* ```
|
|
1145
|
+
*/
|
|
1035
1146
|
function RoleSelectMenu(props) {
|
|
1036
1147
|
const builder = new RoleSelectMenuKit();
|
|
1037
1148
|
applyPropsToBuilder(builder, props);
|
|
1038
1149
|
if (props.defaultValues) builder.setDefaultRoles(Array.isArray(props.defaultValues) ? props.defaultValues : [props.defaultValues]);
|
|
1039
1150
|
return builder;
|
|
1040
1151
|
}
|
|
1152
|
+
/**
|
|
1153
|
+
* The MentionableSelectMenu component.
|
|
1154
|
+
* @param props The properties for the mentionable select menu component.
|
|
1155
|
+
* @returns The mentionable select menu builder instance.
|
|
1156
|
+
* @example ```tsx
|
|
1157
|
+
* import { MentionableSelectMenu } from 'commandkit';
|
|
1158
|
+
* const mentionableSelectMenu = <MentionableSelectMenu />
|
|
1159
|
+
* ```
|
|
1160
|
+
*/
|
|
1041
1161
|
function MentionableSelectMenu(props) {
|
|
1042
1162
|
const builder = new MentionableSelectMenuKit();
|
|
1043
1163
|
applyPropsToBuilder(builder, props);
|
|
1044
1164
|
if (props.defaultValues) builder.setDefaultValues(Array.isArray(props.defaultValues) ? props.defaultValues : [props.defaultValues]);
|
|
1045
1165
|
return builder;
|
|
1046
1166
|
}
|
|
1167
|
+
/**
|
|
1168
|
+
* The ChannelSelectMenu component.
|
|
1169
|
+
* @param props The properties for the channel select menu component.
|
|
1170
|
+
* @returns The channel select menu builder instance.
|
|
1171
|
+
* @example ```tsx
|
|
1172
|
+
* import { ChannelSelectMenu } from 'commandkit';
|
|
1173
|
+
* const channelSelectMenu = <ChannelSelectMenu />
|
|
1174
|
+
* ```
|
|
1175
|
+
*/
|
|
1047
1176
|
function ChannelSelectMenu(props) {
|
|
1048
1177
|
const builder = new ChannelSelectMenuKit();
|
|
1049
1178
|
applyPropsToBuilder(builder, props);
|
|
@@ -1054,6 +1183,9 @@ function ChannelSelectMenu(props) {
|
|
|
1054
1183
|
|
|
1055
1184
|
//#endregion
|
|
1056
1185
|
//#region src/logger/DefaultLogger.ts
|
|
1186
|
+
/**
|
|
1187
|
+
* Log levels for the logger.
|
|
1188
|
+
*/
|
|
1057
1189
|
var LogLevel = /* @__PURE__ */ function(LogLevel$1) {
|
|
1058
1190
|
LogLevel$1[LogLevel$1["DEBUG"] = 0] = "DEBUG";
|
|
1059
1191
|
LogLevel$1[LogLevel$1["INFO"] = 1] = "INFO";
|
|
@@ -1090,8 +1222,17 @@ const BoxChars = {
|
|
|
1090
1222
|
verticalRight: "├",
|
|
1091
1223
|
corner: "└"
|
|
1092
1224
|
};
|
|
1225
|
+
/**
|
|
1226
|
+
* Default logger implementation that logs messages to the console.
|
|
1227
|
+
* It formats the log messages with timestamps, log levels, and context information.
|
|
1228
|
+
*/
|
|
1093
1229
|
var DefaultLogger = class {
|
|
1094
1230
|
logger;
|
|
1231
|
+
/**
|
|
1232
|
+
* Creates a new instance of DefaultLogger.
|
|
1233
|
+
* @param stdout The output stream for standard messages (default: process.stdout).
|
|
1234
|
+
* @param stderr The output stream for error messages (default: process.stderr).
|
|
1235
|
+
*/
|
|
1095
1236
|
constructor(stdout = process.stdout, stderr = process.stderr) {
|
|
1096
1237
|
this.stdout = stdout;
|
|
1097
1238
|
this.stderr = stderr;
|
|
@@ -1151,18 +1292,38 @@ var DefaultLogger = class {
|
|
|
1151
1292
|
if (context$1) this.logger.log(`${prefix}\n${context$1} ${require_colors.colors_default.dim(BoxChars.corner)}`, ...args.map((arg) => colorFn(arg)));
|
|
1152
1293
|
else this.logger.log(`${prefix} ${require_colors.colors_default.dim(BoxChars.corner)}`, ...args.map((arg) => colorFn(arg)));
|
|
1153
1294
|
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Logs a debug message.
|
|
1297
|
+
* @param args The message arguments to log.
|
|
1298
|
+
*/
|
|
1154
1299
|
debug(...args) {
|
|
1155
1300
|
this._log(LogLevel.DEBUG, ...args);
|
|
1156
1301
|
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Logs an error message.
|
|
1304
|
+
* @param args The message arguments to log.
|
|
1305
|
+
*/
|
|
1157
1306
|
error(...args) {
|
|
1158
1307
|
this._log(LogLevel.ERROR, ...args);
|
|
1159
1308
|
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Logs a default message.
|
|
1311
|
+
* @param args The message arguments to log.
|
|
1312
|
+
*/
|
|
1160
1313
|
log(...args) {
|
|
1161
1314
|
this._log(LogLevel.DEFAULT, ...args);
|
|
1162
1315
|
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Logs an info message.
|
|
1318
|
+
* @param args The message arguments to log.
|
|
1319
|
+
*/
|
|
1163
1320
|
info(...args) {
|
|
1164
1321
|
this._log(LogLevel.INFO, ...args);
|
|
1165
1322
|
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Logs a warning message.
|
|
1325
|
+
* @param args The message arguments to log.
|
|
1326
|
+
*/
|
|
1166
1327
|
warn(...args) {
|
|
1167
1328
|
this._log(LogLevel.WARN, ...args);
|
|
1168
1329
|
}
|
|
@@ -1170,6 +1331,11 @@ var DefaultLogger = class {
|
|
|
1170
1331
|
|
|
1171
1332
|
//#endregion
|
|
1172
1333
|
//#region src/logger/Logger.ts
|
|
1334
|
+
/**
|
|
1335
|
+
* Creates a new logger instance with the specified options.
|
|
1336
|
+
* @param options The options for configuring the logger.
|
|
1337
|
+
* @returns A new logger instance.
|
|
1338
|
+
*/
|
|
1173
1339
|
function createLogger(options) {
|
|
1174
1340
|
let opt = options;
|
|
1175
1341
|
if (!(opt === null || opt === void 0 ? void 0 : opt.provider)) throw new Error("A logger provider must be provided.");
|
|
@@ -1188,21 +1354,53 @@ function createLogger(options) {
|
|
|
1188
1354
|
};
|
|
1189
1355
|
return impl;
|
|
1190
1356
|
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Default logger instance for CommandKit. This logger uses the DefaultLogger as its provider.
|
|
1359
|
+
* The provider can be replaced with a custom logger implementation using the `configure` method.
|
|
1360
|
+
*/
|
|
1191
1361
|
const Logger = createLogger({ provider: new DefaultLogger() });
|
|
1192
1362
|
|
|
1193
1363
|
//#endregion
|
|
1194
1364
|
//#region src/plugins/plugin-runtime/CommandKitPluginRuntime.ts
|
|
1365
|
+
/**
|
|
1366
|
+
* Represents the runtime environment for CommandKit plugins.
|
|
1367
|
+
*/
|
|
1195
1368
|
var CommandKitPluginRuntime = class {
|
|
1196
1369
|
plugins = new discord_js.Collection();
|
|
1370
|
+
/**
|
|
1371
|
+
* Creates a new instance of CommandKitPluginRuntime.
|
|
1372
|
+
* @param commandkit The CommandKit instance associated with this runtime.
|
|
1373
|
+
*/
|
|
1197
1374
|
constructor(commandkit$1) {
|
|
1198
1375
|
this.commandkit = commandkit$1;
|
|
1199
1376
|
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Returns the plugins registered in this runtime.
|
|
1379
|
+
* @returns A collection of plugins.
|
|
1380
|
+
*/
|
|
1200
1381
|
getPlugins() {
|
|
1201
1382
|
return this.plugins;
|
|
1202
1383
|
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Checks if there are no plugins registered in this runtime.
|
|
1386
|
+
* @param pluginName The name of the plugin to check.
|
|
1387
|
+
* @returns Boolean indicating whether the runtime is empty.
|
|
1388
|
+
*/
|
|
1203
1389
|
getPlugin(pluginName) {
|
|
1204
1390
|
return this.plugins.get(pluginName) ?? null;
|
|
1205
1391
|
}
|
|
1392
|
+
/**
|
|
1393
|
+
* Fetches the given plugin
|
|
1394
|
+
* @param plugin The plugin to be fetched.
|
|
1395
|
+
*/
|
|
1396
|
+
get(plugin) {
|
|
1397
|
+
const p = this.plugins.find((p$1) => p$1 instanceof plugin) ?? null;
|
|
1398
|
+
return p;
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* Soft registers a plugin in the runtime.
|
|
1402
|
+
* @param plugin The plugin to be registered.
|
|
1403
|
+
*/
|
|
1206
1404
|
async softRegisterPlugin(plugin) {
|
|
1207
1405
|
const pluginName = plugin.name;
|
|
1208
1406
|
if (this.plugins.has(pluginName)) return;
|
|
@@ -1213,6 +1411,11 @@ var CommandKitPluginRuntime = class {
|
|
|
1213
1411
|
throw new Error(`Failed to activate plugin "${pluginName}": ${(e === null || e === void 0 ? void 0 : e.stack) || e}`);
|
|
1214
1412
|
}
|
|
1215
1413
|
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Registers a plugin in the runtime.
|
|
1416
|
+
* @param plugin The plugin to be registered.
|
|
1417
|
+
* @throws If a plugin with the same name already exists.
|
|
1418
|
+
*/
|
|
1216
1419
|
async registerPlugin(plugin) {
|
|
1217
1420
|
const pluginName = plugin.name;
|
|
1218
1421
|
if (this.plugins.has(pluginName)) throw new Error(`Plugin with name "${pluginName}" already exists.`);
|
|
@@ -1223,6 +1426,11 @@ var CommandKitPluginRuntime = class {
|
|
|
1223
1426
|
throw new Error(`Failed to activate plugin "${pluginName}": ${(e === null || e === void 0 ? void 0 : e.stack) || e}`);
|
|
1224
1427
|
}
|
|
1225
1428
|
}
|
|
1429
|
+
/**
|
|
1430
|
+
* Unregisters a plugin from the runtime.
|
|
1431
|
+
* @param plugin The plugin to be unregistered.
|
|
1432
|
+
* @throws If the plugin does not exist.
|
|
1433
|
+
*/
|
|
1226
1434
|
async unregisterPlugin(plugin) {
|
|
1227
1435
|
const pluginName = plugin.name;
|
|
1228
1436
|
if (!this.plugins.has(pluginName)) throw new Error(`Plugin with name "${pluginName}" does not exist.`);
|
|
@@ -1233,12 +1441,23 @@ var CommandKitPluginRuntime = class {
|
|
|
1233
1441
|
throw new Error(`Failed to deactivate plugin "${pluginName}": ${(e === null || e === void 0 ? void 0 : e.stack) || e}`);
|
|
1234
1442
|
}
|
|
1235
1443
|
}
|
|
1444
|
+
/**
|
|
1445
|
+
* Unregisters all plugins from the runtime.
|
|
1446
|
+
*/
|
|
1236
1447
|
async unregisterAllPlugins() {
|
|
1237
1448
|
for (const plugin of this.plugins.values()) await this.unregisterPlugin(plugin);
|
|
1238
1449
|
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Signals the runtime to allow the current plugin take ownership of the execution context.
|
|
1452
|
+
*/
|
|
1239
1453
|
capture() {
|
|
1240
1454
|
throw require_error_codes.createCommandKitError(require_error_codes.CommandKitErrorCodes.PluginCaptureHandle);
|
|
1241
1455
|
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Executes a function for each plugin in the runtime.
|
|
1458
|
+
* @param f The function to execute for each plugin.
|
|
1459
|
+
* @returns The result of the last executed function, or undefined if no plugins were executed.
|
|
1460
|
+
*/
|
|
1242
1461
|
async execute(f) {
|
|
1243
1462
|
let result;
|
|
1244
1463
|
for (const plugin of this.plugins.values()) try {
|
|
@@ -1253,6 +1472,9 @@ var CommandKitPluginRuntime = class {
|
|
|
1253
1472
|
|
|
1254
1473
|
//#endregion
|
|
1255
1474
|
//#region src/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.ts
|
|
1475
|
+
/**
|
|
1476
|
+
* Common directive transformer plugin is a compiler plugin that transforms directives to higher-order functions.
|
|
1477
|
+
*/
|
|
1256
1478
|
var CommonDirectiveTransformer = class extends require_CompilerPlugin.CompilerPlugin {
|
|
1257
1479
|
transformer = null;
|
|
1258
1480
|
async activate(ctx) {
|
|
@@ -1276,6 +1498,18 @@ var CommonDirectiveTransformer = class extends require_CompilerPlugin.CompilerPl
|
|
|
1276
1498
|
|
|
1277
1499
|
//#endregion
|
|
1278
1500
|
//#region src/plugins/plugin-runtime/builtin/MacroPlugin.ts
|
|
1501
|
+
/**
|
|
1502
|
+
* Macro plugin enables the use of `"use macro"` directive in the code.
|
|
1503
|
+
* Functions with this directive will be transformed at compile time
|
|
1504
|
+
* and only the result will be included in the final bundle.
|
|
1505
|
+
* @example function myMacro() {
|
|
1506
|
+
* "use macro";
|
|
1507
|
+
* return Math.random();
|
|
1508
|
+
* }
|
|
1509
|
+
*
|
|
1510
|
+
* // This will be transformed to a constant value at compile time.
|
|
1511
|
+
* const result = myMacro();
|
|
1512
|
+
*/
|
|
1279
1513
|
var MacroPlugin = class extends require_CompilerPlugin.CompilerPlugin {
|
|
1280
1514
|
name = "MacroPlugin";
|
|
1281
1515
|
macroTransformer;
|
|
@@ -1299,6 +1533,9 @@ var MacroPlugin = class extends require_CompilerPlugin.CompilerPlugin {
|
|
|
1299
1533
|
|
|
1300
1534
|
//#endregion
|
|
1301
1535
|
//#region src/config/default.ts
|
|
1536
|
+
/**
|
|
1537
|
+
* Default configuration for CommandKit.
|
|
1538
|
+
*/
|
|
1302
1539
|
const defaultConfig = {
|
|
1303
1540
|
plugins: [new MacroPlugin({ enabled: true })],
|
|
1304
1541
|
rolldownPlugins: [(0, __rollup_plugin_json.default)()],
|
|
@@ -1364,6 +1601,10 @@ function getSrcDir() {
|
|
|
1364
1601
|
if (require_constants.COMMANDKIT_IS_DEV) return ".commandkit";
|
|
1365
1602
|
return getConfig().distDir;
|
|
1366
1603
|
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Returns the current working directory of the CommandKit application.
|
|
1606
|
+
* This is typically the directory where the source code is located.
|
|
1607
|
+
*/
|
|
1367
1608
|
function getCurrentDirectory() {
|
|
1368
1609
|
if (currentDir) return currentDir;
|
|
1369
1610
|
const src = getSrcDir();
|
|
@@ -1372,6 +1613,11 @@ function getCurrentDirectory() {
|
|
|
1372
1613
|
currentDir = root;
|
|
1373
1614
|
return root;
|
|
1374
1615
|
}
|
|
1616
|
+
/**
|
|
1617
|
+
* Returns the possible source directories for the CommandKit application.
|
|
1618
|
+
* This includes the `src`, `.commandkit`, and the distribution directory.
|
|
1619
|
+
* @returns An array of possible source directories.
|
|
1620
|
+
*/
|
|
1375
1621
|
function getSourceDirectories() {
|
|
1376
1622
|
const dist = getConfig().distDir;
|
|
1377
1623
|
const locations = [
|
|
@@ -1401,6 +1647,14 @@ function findAppDirectory() {
|
|
|
1401
1647
|
* @param fn The function to debounce.
|
|
1402
1648
|
* @param ms The debounce time in milliseconds.
|
|
1403
1649
|
* @returns The debounced function.
|
|
1650
|
+
* @example
|
|
1651
|
+
* const debouncedFn = debounce(() => {
|
|
1652
|
+
* console.log('Debounced function called');
|
|
1653
|
+
* }, 300);
|
|
1654
|
+
*
|
|
1655
|
+
* debouncedFn(); // Will only execute after 300ms of inactivity
|
|
1656
|
+
* debouncedFn(); // Will reset the timer
|
|
1657
|
+
* debouncedFn(); // Will reset the timer again
|
|
1404
1658
|
*/
|
|
1405
1659
|
function debounce(fn, ms) {
|
|
1406
1660
|
let timer = null;
|
|
@@ -1424,6 +1678,13 @@ function debounce(fn, ms) {
|
|
|
1424
1678
|
/**
|
|
1425
1679
|
* Defers the execution of a function.
|
|
1426
1680
|
* @param fn The function to defer.
|
|
1681
|
+
* @param timeout The time in milliseconds to wait before executing the function. Defaults to 0.
|
|
1682
|
+
* @example
|
|
1683
|
+
* defer(() => {
|
|
1684
|
+
* console.log('This will run after a delay');
|
|
1685
|
+
* });
|
|
1686
|
+
*
|
|
1687
|
+
* console.log('This will run immediately');
|
|
1427
1688
|
*/
|
|
1428
1689
|
function defer(fn, timeout = 0) {
|
|
1429
1690
|
setTimeout(() => {
|
|
@@ -1471,8 +1732,17 @@ var StopEventPropagationError = class extends Error {
|
|
|
1471
1732
|
}
|
|
1472
1733
|
};
|
|
1473
1734
|
/**
|
|
1474
|
-
* Stops event propagation.
|
|
1735
|
+
* Stops event propagation. This function should be called inside an event handler
|
|
1736
|
+
* to prevent further event handling.
|
|
1475
1737
|
* @throws {StopEventPropagationError}
|
|
1738
|
+
* @example // src/app/events/messageCreate/handler.ts
|
|
1739
|
+
* import { stopEvents } from 'commandkit';
|
|
1740
|
+
*
|
|
1741
|
+
* export default async function messageCreateHandler() {
|
|
1742
|
+
* console.log('Message created');
|
|
1743
|
+
* // Stop further event propagation
|
|
1744
|
+
* stopEvents();
|
|
1745
|
+
* }
|
|
1476
1746
|
*/
|
|
1477
1747
|
function stopEvents() {
|
|
1478
1748
|
if (!require_EventWorkerContext.eventWorkerContext.getStore()) throw new Error("stopEvents() may only be called inside an event handler");
|
|
@@ -1536,7 +1806,14 @@ function createProxy(target) {
|
|
|
1536
1806
|
|
|
1537
1807
|
//#endregion
|
|
1538
1808
|
//#region src/app/register/CommandRegistrar.ts
|
|
1809
|
+
/**
|
|
1810
|
+
* Handles registration of Discord application commands (slash commands, context menus).
|
|
1811
|
+
*/
|
|
1539
1812
|
var CommandRegistrar = class {
|
|
1813
|
+
/**
|
|
1814
|
+
* @private
|
|
1815
|
+
* @internal
|
|
1816
|
+
*/
|
|
1540
1817
|
api = new discord_js.REST();
|
|
1541
1818
|
/**
|
|
1542
1819
|
* Creates an instance of CommandRegistrar.
|
|
@@ -1690,6 +1967,9 @@ var CommandRegistrar = class {
|
|
|
1690
1967
|
|
|
1691
1968
|
//#endregion
|
|
1692
1969
|
//#region src/context/environment.ts
|
|
1970
|
+
/**
|
|
1971
|
+
* Represents the execution environment for CommandKit commands.
|
|
1972
|
+
*/
|
|
1693
1973
|
var CommandKitEnvironment = class {
|
|
1694
1974
|
#data = {
|
|
1695
1975
|
executionError: null,
|
|
@@ -1835,9 +2115,19 @@ let CommandKitEnvironmentType = /* @__PURE__ */ function(CommandKitEnvironmentTy
|
|
|
1835
2115
|
return CommandKitEnvironmentType$1;
|
|
1836
2116
|
}({});
|
|
1837
2117
|
/**
|
|
1838
|
-
*
|
|
2118
|
+
* Schedules the given function to run after the current command has finished executing.
|
|
1839
2119
|
* @param fn The function to run after the current command.
|
|
1840
2120
|
* @returns The deferred function id. This can be used to cancel the deferred function.
|
|
2121
|
+
* @example import { after } from 'commandkit';
|
|
2122
|
+
*
|
|
2123
|
+
* // inside a command
|
|
2124
|
+
* export const chatInput: ChatInputCommand = async (ctx) => {
|
|
2125
|
+
* after(() => {
|
|
2126
|
+
* console.log('This will run after the command has finished executing.');
|
|
2127
|
+
* });
|
|
2128
|
+
*
|
|
2129
|
+
* // ... command logic
|
|
2130
|
+
* }
|
|
1841
2131
|
*/
|
|
1842
2132
|
function after(fn) {
|
|
1843
2133
|
const env = getContext();
|
|
@@ -1847,6 +2137,16 @@ function after(fn) {
|
|
|
1847
2137
|
/**
|
|
1848
2138
|
* Cancels a deferred function registered with `after`.
|
|
1849
2139
|
* @param id The deferred function id to cancel.
|
|
2140
|
+
* @example import { cancelAfter } from 'commandkit';
|
|
2141
|
+
* // inside a command
|
|
2142
|
+
* export const chatInput: ChatInputCommand = async (ctx) => {
|
|
2143
|
+
* const id = after(() => {
|
|
2144
|
+
* console.log('This will run after the command has finished executing.');
|
|
2145
|
+
* });
|
|
2146
|
+
*
|
|
2147
|
+
* // cancel the deferred function if needed
|
|
2148
|
+
* if (something) cancelAfter(id);
|
|
2149
|
+
* }
|
|
1850
2150
|
*/
|
|
1851
2151
|
function cancelAfter(id) {
|
|
1852
2152
|
const env = getContext();
|
|
@@ -1856,6 +2156,9 @@ function cancelAfter(id) {
|
|
|
1856
2156
|
|
|
1857
2157
|
//#endregion
|
|
1858
2158
|
//#region src/app/commands/Context.ts
|
|
2159
|
+
/**
|
|
2160
|
+
* Enumeration of different command execution modes supported by CommandKit.
|
|
2161
|
+
*/
|
|
1859
2162
|
const CommandExecutionMode = {
|
|
1860
2163
|
ChatInputCommand: "chatInput",
|
|
1861
2164
|
MessageContextMenu: "messageContextMenu",
|
|
@@ -1863,6 +2166,10 @@ const CommandExecutionMode = {
|
|
|
1863
2166
|
Autocomplete: "autocomplete",
|
|
1864
2167
|
Message: "message"
|
|
1865
2168
|
};
|
|
2169
|
+
/**
|
|
2170
|
+
* Represents the execution context for a command, providing access to Discord.js objects,
|
|
2171
|
+
* command metadata, and various utility methods for command execution.
|
|
2172
|
+
*/
|
|
1866
2173
|
var Context = class Context {
|
|
1867
2174
|
/**
|
|
1868
2175
|
* The interaction that triggered the command.
|
|
@@ -1896,7 +2203,15 @@ var Context = class Context {
|
|
|
1896
2203
|
* The command that this context belongs to.
|
|
1897
2204
|
*/
|
|
1898
2205
|
command;
|
|
2206
|
+
/**
|
|
2207
|
+
* @private
|
|
2208
|
+
* @internal
|
|
2209
|
+
*/
|
|
1899
2210
|
#store;
|
|
2211
|
+
/**
|
|
2212
|
+
* @private
|
|
2213
|
+
* @internal
|
|
2214
|
+
*/
|
|
1900
2215
|
_locale = null;
|
|
1901
2216
|
/**
|
|
1902
2217
|
* Creates a new command context.
|
|
@@ -1932,10 +2247,16 @@ var Context = class Context {
|
|
|
1932
2247
|
get store() {
|
|
1933
2248
|
return this.#store;
|
|
1934
2249
|
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Gets the name of the current command.
|
|
2252
|
+
*/
|
|
1935
2253
|
get commandName() {
|
|
1936
2254
|
if (this.isInteraction()) return this.interaction.commandName;
|
|
1937
2255
|
else return this.config.messageCommandParser.getCommand();
|
|
1938
2256
|
}
|
|
2257
|
+
/**
|
|
2258
|
+
* Gets the command options based on the execution mode.
|
|
2259
|
+
*/
|
|
1939
2260
|
get options() {
|
|
1940
2261
|
if (this.isMessage()) {
|
|
1941
2262
|
const parser = this.config.messageCommandParser;
|
|
@@ -2062,6 +2383,7 @@ var Context = class Context {
|
|
|
2062
2383
|
}
|
|
2063
2384
|
/**
|
|
2064
2385
|
* Creates a clone of this context
|
|
2386
|
+
* @param config - Optional partial config to override in the clone
|
|
2065
2387
|
*/
|
|
2066
2388
|
clone(config) {
|
|
2067
2389
|
if (!config) return new Context(this.commandkit, this.config);
|
|
@@ -2072,9 +2394,16 @@ var Context = class Context {
|
|
|
2072
2394
|
});
|
|
2073
2395
|
return ctx;
|
|
2074
2396
|
}
|
|
2397
|
+
/**
|
|
2398
|
+
* Checks if this context is a middleware context.
|
|
2399
|
+
*/
|
|
2075
2400
|
isMiddleware() {
|
|
2076
2401
|
return this instanceof MiddlewareContext;
|
|
2077
2402
|
}
|
|
2403
|
+
/**
|
|
2404
|
+
* Gets the command arguments (only available for message commands).
|
|
2405
|
+
* @returns Array of command arguments
|
|
2406
|
+
*/
|
|
2078
2407
|
args() {
|
|
2079
2408
|
if (this.isMessage()) return this.config.messageCommandParser.getArgs();
|
|
2080
2409
|
return [];
|
|
@@ -2089,7 +2418,14 @@ var Context = class Context {
|
|
|
2089
2418
|
require_signals.exitMiddleware();
|
|
2090
2419
|
}
|
|
2091
2420
|
};
|
|
2421
|
+
/**
|
|
2422
|
+
* Extended context class for middleware execution with additional control methods.
|
|
2423
|
+
*/
|
|
2092
2424
|
var MiddlewareContext = class extends Context {
|
|
2425
|
+
/**
|
|
2426
|
+
* @private
|
|
2427
|
+
* @internal
|
|
2428
|
+
*/
|
|
2093
2429
|
#cancel = false;
|
|
2094
2430
|
/**
|
|
2095
2431
|
* Whether the command execution was cancelled.
|
|
@@ -2120,11 +2456,25 @@ var MiddlewareContext = class extends Context {
|
|
|
2120
2456
|
|
|
2121
2457
|
//#endregion
|
|
2122
2458
|
//#region src/app/commands/AppCommandRunner.ts
|
|
2459
|
+
/**
|
|
2460
|
+
* Handles the execution of application commands for CommandKit.
|
|
2461
|
+
* Manages middleware execution, environment setup, and command invocation.
|
|
2462
|
+
*/
|
|
2123
2463
|
var AppCommandRunner = class {
|
|
2464
|
+
/**
|
|
2465
|
+
* Creates a new AppCommandRunner instance.
|
|
2466
|
+
* @param handler - The app command handler instance to use for command execution
|
|
2467
|
+
*/
|
|
2124
2468
|
constructor(handler) {
|
|
2125
2469
|
this.handler = handler;
|
|
2126
2470
|
}
|
|
2127
|
-
|
|
2471
|
+
/**
|
|
2472
|
+
* Executes a prepared command with middleware support and environment setup.
|
|
2473
|
+
* Handles the complete command lifecycle including before/after middleware execution.
|
|
2474
|
+
* @param prepared - The prepared command execution data
|
|
2475
|
+
* @param source - The source interaction or message that triggered the command
|
|
2476
|
+
*/
|
|
2477
|
+
async runCommand(prepared, source, options) {
|
|
2128
2478
|
const { commandkit: commandkit$1 } = this.handler;
|
|
2129
2479
|
const executionMode = this.getExecutionMode(source);
|
|
2130
2480
|
let runCommand = null;
|
|
@@ -2133,6 +2483,7 @@ var AppCommandRunner = class {
|
|
|
2133
2483
|
env.variables.set("commandHandlerType", "app");
|
|
2134
2484
|
env.variables.set("currentCommandName", prepared.command.command.name);
|
|
2135
2485
|
env.variables.set("execHandlerKind", executionMode);
|
|
2486
|
+
env.variables.set("customHandler", (options === null || options === void 0 ? void 0 : options.handler) ?? null);
|
|
2136
2487
|
const ctx = new MiddlewareContext(commandkit$1, {
|
|
2137
2488
|
command: prepared.command,
|
|
2138
2489
|
environment: env,
|
|
@@ -2161,9 +2512,10 @@ var AppCommandRunner = class {
|
|
|
2161
2512
|
}
|
|
2162
2513
|
}
|
|
2163
2514
|
});
|
|
2515
|
+
let result;
|
|
2164
2516
|
if (!ctx.cancelled) {
|
|
2165
2517
|
const targetData = prepared.command.data;
|
|
2166
|
-
const fn = targetData[executionMode];
|
|
2518
|
+
const fn = targetData[(options === null || options === void 0 ? void 0 : options.handler) || executionMode];
|
|
2167
2519
|
if (!fn) Logger.warn(`Command ${prepared.command.command.name} has no handler for ${executionMode}`);
|
|
2168
2520
|
const analytics = commandkit$1.analytics;
|
|
2169
2521
|
if (fn) try {
|
|
@@ -2210,7 +2562,7 @@ var AppCommandRunner = class {
|
|
|
2210
2562
|
const res = await commandkit$1.plugins.execute(async (ctx$1, plugin) => {
|
|
2211
2563
|
return plugin.executeCommand(ctx$1, env, source, prepared, executeCommand);
|
|
2212
2564
|
});
|
|
2213
|
-
if (!res) await executeCommand();
|
|
2565
|
+
if (!res) result = await executeCommand();
|
|
2214
2566
|
} catch (e) {
|
|
2215
2567
|
if (require_error_codes.isErrorType(e, require_error_codes.CommandKitErrorCodes.ExitMiddleware)) middlewaresCanceled = true;
|
|
2216
2568
|
if (!require_error_codes.isErrorType(e, [require_error_codes.CommandKitErrorCodes.ForwardedCommand, require_error_codes.CommandKitErrorCodes.ExitMiddleware])) Logger.error(e);
|
|
@@ -2227,7 +2579,13 @@ var AppCommandRunner = class {
|
|
|
2227
2579
|
}
|
|
2228
2580
|
}
|
|
2229
2581
|
});
|
|
2582
|
+
return result;
|
|
2230
2583
|
}
|
|
2584
|
+
/**
|
|
2585
|
+
* @private
|
|
2586
|
+
* @internal
|
|
2587
|
+
* Finalizes command execution by running deferred functions and plugin cleanup.
|
|
2588
|
+
*/
|
|
2231
2589
|
async #finalizer() {
|
|
2232
2590
|
const env = useEnvironment();
|
|
2233
2591
|
await env.runDeferredFunctions();
|
|
@@ -2236,6 +2594,11 @@ var AppCommandRunner = class {
|
|
|
2236
2594
|
await plugin.onAfterCommand(ctx, env);
|
|
2237
2595
|
});
|
|
2238
2596
|
}
|
|
2597
|
+
/**
|
|
2598
|
+
* Determines the execution mode based on the source of the command.
|
|
2599
|
+
* @param source - The interaction or message that triggered the command
|
|
2600
|
+
* @returns The appropriate command execution mode
|
|
2601
|
+
*/
|
|
2239
2602
|
getExecutionMode(source) {
|
|
2240
2603
|
if (source instanceof discord_js.Message) return CommandExecutionMode.Message;
|
|
2241
2604
|
if (source.isChatInputCommand()) return CommandExecutionMode.ChatInputCommand;
|
|
@@ -2248,6 +2611,10 @@ var AppCommandRunner = class {
|
|
|
2248
2611
|
|
|
2249
2612
|
//#endregion
|
|
2250
2613
|
//#region src/app/handlers/AppCommandHandler.ts
|
|
2614
|
+
/**
|
|
2615
|
+
* @private
|
|
2616
|
+
* @internal
|
|
2617
|
+
*/
|
|
2251
2618
|
const commandDataSchema = {
|
|
2252
2619
|
command: (c) => c instanceof discord_js.SlashCommandBuilder || c instanceof discord_js.ContextMenuCommandBuilder || c && typeof c === "object",
|
|
2253
2620
|
chatInput: (c) => typeof c === "function",
|
|
@@ -2256,25 +2623,76 @@ const commandDataSchema = {
|
|
|
2256
2623
|
messageContextMenu: (c) => typeof c === "function",
|
|
2257
2624
|
userContextMenu: (c) => typeof c === "function"
|
|
2258
2625
|
};
|
|
2626
|
+
/**
|
|
2627
|
+
* @private
|
|
2628
|
+
* @internal
|
|
2629
|
+
*/
|
|
2259
2630
|
const middlewareDataSchema = {
|
|
2260
2631
|
beforeExecute: (c) => typeof c === "function",
|
|
2261
2632
|
afterExecute: (c) => typeof c === "function"
|
|
2262
2633
|
};
|
|
2634
|
+
/**
|
|
2635
|
+
* Handles application commands for CommandKit, including loading, registration, and execution.
|
|
2636
|
+
* Manages both slash commands and message commands with middleware support.
|
|
2637
|
+
*/
|
|
2263
2638
|
var AppCommandHandler = class {
|
|
2639
|
+
/**
|
|
2640
|
+
* @private
|
|
2641
|
+
* @internal
|
|
2642
|
+
*/
|
|
2264
2643
|
loadedCommands = new discord_js.Collection();
|
|
2644
|
+
/**
|
|
2645
|
+
* @private
|
|
2646
|
+
* @internal
|
|
2647
|
+
*/
|
|
2265
2648
|
loadedMiddlewares = new discord_js.Collection();
|
|
2649
|
+
/**
|
|
2650
|
+
* @private
|
|
2651
|
+
* @internal
|
|
2652
|
+
*/
|
|
2266
2653
|
commandNameToId = /* @__PURE__ */ new Map();
|
|
2654
|
+
/**
|
|
2655
|
+
* @private
|
|
2656
|
+
* @internal
|
|
2657
|
+
*/
|
|
2267
2658
|
subcommandPathToId = /* @__PURE__ */ new Map();
|
|
2659
|
+
/**
|
|
2660
|
+
* Command registrar for handling Discord API registration.
|
|
2661
|
+
*/
|
|
2268
2662
|
registrar;
|
|
2663
|
+
/**
|
|
2664
|
+
* @private
|
|
2665
|
+
* @internal
|
|
2666
|
+
*/
|
|
2269
2667
|
onInteraction = null;
|
|
2668
|
+
/**
|
|
2669
|
+
* @private
|
|
2670
|
+
* @internal
|
|
2671
|
+
*/
|
|
2270
2672
|
onMessageCreate = null;
|
|
2673
|
+
/**
|
|
2674
|
+
* Command runner instance for executing commands.
|
|
2675
|
+
*/
|
|
2271
2676
|
commandRunner = new AppCommandRunner(this);
|
|
2677
|
+
/**
|
|
2678
|
+
* External command data storage.
|
|
2679
|
+
*/
|
|
2272
2680
|
externalCommandData = new discord_js.Collection();
|
|
2681
|
+
/**
|
|
2682
|
+
* External middleware data storage.
|
|
2683
|
+
*/
|
|
2273
2684
|
externalMiddlewareData = new discord_js.Collection();
|
|
2685
|
+
/**
|
|
2686
|
+
* Creates a new AppCommandHandler instance.
|
|
2687
|
+
* @param commandkit - The CommandKit instance
|
|
2688
|
+
*/
|
|
2274
2689
|
constructor(commandkit$1) {
|
|
2275
2690
|
this.commandkit = commandkit$1;
|
|
2276
2691
|
this.registrar = new CommandRegistrar(this.commandkit);
|
|
2277
2692
|
}
|
|
2693
|
+
/**
|
|
2694
|
+
* Prints a formatted banner showing all loaded commands organized by category.
|
|
2695
|
+
*/
|
|
2278
2696
|
printBanner() {
|
|
2279
2697
|
const uncategorized = crypto.randomUUID();
|
|
2280
2698
|
const categorizedCommands = this.getCommandsArray().reduce((acc, cmd) => {
|
|
@@ -2350,9 +2768,16 @@ var AppCommandHandler = class {
|
|
|
2350
2768
|
printCategory(category, "", isLast);
|
|
2351
2769
|
});
|
|
2352
2770
|
}
|
|
2771
|
+
/**
|
|
2772
|
+
* Gets an array of all loaded commands.
|
|
2773
|
+
* @returns Array of loaded commands
|
|
2774
|
+
*/
|
|
2353
2775
|
getCommandsArray() {
|
|
2354
2776
|
return Array.from(this.loadedCommands.values());
|
|
2355
2777
|
}
|
|
2778
|
+
/**
|
|
2779
|
+
* Registers event handlers for Discord interactions and messages.
|
|
2780
|
+
*/
|
|
2356
2781
|
registerCommandHandler() {
|
|
2357
2782
|
this.onInteraction ??= async (interaction) => {
|
|
2358
2783
|
const success = await this.commandkit.plugins.execute(async (ctx, plugin) => {
|
|
@@ -2378,6 +2803,12 @@ var AppCommandHandler = class {
|
|
|
2378
2803
|
this.commandkit.client.on(discord_js.Events.InteractionCreate, this.onInteraction);
|
|
2379
2804
|
this.commandkit.client.on(discord_js.Events.MessageCreate, this.onMessageCreate);
|
|
2380
2805
|
}
|
|
2806
|
+
/**
|
|
2807
|
+
* Prepares a command for execution by resolving the command and its middleware.
|
|
2808
|
+
* @param source - The interaction or message that triggered the command
|
|
2809
|
+
* @param cmdName - Optional command name override
|
|
2810
|
+
* @returns Prepared command execution data or null if command not found
|
|
2811
|
+
*/
|
|
2381
2812
|
async prepareCommandRun(source, cmdName) {
|
|
2382
2813
|
var _loadedCommand$guilds2;
|
|
2383
2814
|
let parser;
|
|
@@ -2427,6 +2858,9 @@ var AppCommandHandler = class {
|
|
|
2427
2858
|
messageCommandParser: parser
|
|
2428
2859
|
};
|
|
2429
2860
|
}
|
|
2861
|
+
/**
|
|
2862
|
+
* Reloads all commands and middleware from scratch.
|
|
2863
|
+
*/
|
|
2430
2864
|
async reloadCommands() {
|
|
2431
2865
|
this.loadedCommands.clear();
|
|
2432
2866
|
this.loadedMiddlewares.clear();
|
|
@@ -2436,27 +2870,46 @@ var AppCommandHandler = class {
|
|
|
2436
2870
|
this.externalMiddlewareData.clear();
|
|
2437
2871
|
await this.loadCommands();
|
|
2438
2872
|
}
|
|
2873
|
+
/**
|
|
2874
|
+
* Adds external middleware data to be loaded.
|
|
2875
|
+
* @param data - Array of middleware data to add
|
|
2876
|
+
*/
|
|
2439
2877
|
async addExternalMiddleware(data) {
|
|
2440
2878
|
for (const middleware of data) {
|
|
2441
2879
|
if (!middleware.id) continue;
|
|
2442
2880
|
this.externalMiddlewareData.set(middleware.id, middleware);
|
|
2443
2881
|
}
|
|
2444
2882
|
}
|
|
2883
|
+
/**
|
|
2884
|
+
* Adds external command data to be loaded.
|
|
2885
|
+
* @param data - Array of command data to add
|
|
2886
|
+
*/
|
|
2445
2887
|
async addExternalCommands(data) {
|
|
2446
2888
|
for (const command of data) {
|
|
2447
2889
|
if (!command.id) continue;
|
|
2448
2890
|
this.externalCommandData.set(command.id, command);
|
|
2449
2891
|
}
|
|
2450
2892
|
}
|
|
2893
|
+
/**
|
|
2894
|
+
* Registers externally loaded middleware.
|
|
2895
|
+
* @param data - Array of loaded middleware to register
|
|
2896
|
+
*/
|
|
2451
2897
|
async registerExternalLoadedMiddleware(data) {
|
|
2452
2898
|
for (const middleware of data) this.loadedMiddlewares.set(middleware.middleware.id, middleware);
|
|
2453
2899
|
}
|
|
2900
|
+
/**
|
|
2901
|
+
* Registers externally loaded commands.
|
|
2902
|
+
* @param data - Array of loaded commands to register
|
|
2903
|
+
*/
|
|
2454
2904
|
async registerExternalLoadedCommands(data) {
|
|
2455
2905
|
for (const command of data) {
|
|
2456
2906
|
this.loadedCommands.set(command.command.id, command);
|
|
2457
2907
|
this.commandNameToId.set(command.command.name, command.command.id);
|
|
2458
2908
|
}
|
|
2459
2909
|
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Loads all commands and middleware from the router.
|
|
2912
|
+
*/
|
|
2460
2913
|
async loadCommands() {
|
|
2461
2914
|
await this.commandkit.plugins.execute((ctx, plugin) => {
|
|
2462
2915
|
return plugin.onBeforeCommandsLoad(ctx);
|
|
@@ -2473,6 +2926,10 @@ var AppCommandHandler = class {
|
|
|
2473
2926
|
return plugin.onAfterCommandsLoad(ctx);
|
|
2474
2927
|
});
|
|
2475
2928
|
}
|
|
2929
|
+
/**
|
|
2930
|
+
* @private
|
|
2931
|
+
* @internal
|
|
2932
|
+
*/
|
|
2476
2933
|
async loadMiddleware(id, middleware) {
|
|
2477
2934
|
try {
|
|
2478
2935
|
const data = await import(`${require_resolve_file_url.toFileURL(middleware.path)}?t=${Date.now()}`);
|
|
@@ -2490,6 +2947,10 @@ var AppCommandHandler = class {
|
|
|
2490
2947
|
Logger.error(`Failed to load middleware ${id}`, error);
|
|
2491
2948
|
}
|
|
2492
2949
|
}
|
|
2950
|
+
/**
|
|
2951
|
+
* @private
|
|
2952
|
+
* @internal
|
|
2953
|
+
*/
|
|
2493
2954
|
async loadCommand(id, command) {
|
|
2494
2955
|
try {
|
|
2495
2956
|
if (command.path === null) {
|
|
@@ -2533,11 +2994,26 @@ var AppCommandHandler = class {
|
|
|
2533
2994
|
|
|
2534
2995
|
//#endregion
|
|
2535
2996
|
//#region src/app/handlers/AppEventsHandler.ts
|
|
2997
|
+
/**
|
|
2998
|
+
* Handles Discord.js events and CommandKit custom events with support for namespacing and middleware.
|
|
2999
|
+
*/
|
|
2536
3000
|
var AppEventsHandler = class {
|
|
3001
|
+
/**
|
|
3002
|
+
* @private
|
|
3003
|
+
* @internal
|
|
3004
|
+
*/
|
|
2537
3005
|
loadedEvents = new discord_js.Collection();
|
|
3006
|
+
/**
|
|
3007
|
+
* Creates a new AppEventsHandler instance.
|
|
3008
|
+
* @param commandkit - The CommandKit instance
|
|
3009
|
+
*/
|
|
2538
3010
|
constructor(commandkit$1) {
|
|
2539
3011
|
this.commandkit = commandkit$1;
|
|
2540
3012
|
}
|
|
3013
|
+
/**
|
|
3014
|
+
* Gets information about all loaded events.
|
|
3015
|
+
* @returns Array of loaded event data
|
|
3016
|
+
*/
|
|
2541
3017
|
getEvents() {
|
|
2542
3018
|
if (this.loadedEvents.size === 0) return [];
|
|
2543
3019
|
const events = this.loadedEvents.toJSON();
|
|
@@ -2549,10 +3025,16 @@ var AppEventsHandler = class {
|
|
|
2549
3025
|
metadata: event.event
|
|
2550
3026
|
}));
|
|
2551
3027
|
}
|
|
3028
|
+
/**
|
|
3029
|
+
* Reloads all events by unregistering existing ones and loading them again.
|
|
3030
|
+
*/
|
|
2552
3031
|
async reloadEvents() {
|
|
2553
3032
|
this.unregisterAll();
|
|
2554
3033
|
await this.loadEvents();
|
|
2555
3034
|
}
|
|
3035
|
+
/**
|
|
3036
|
+
* Loads all events from the events router and registers them with Discord.js client.
|
|
3037
|
+
*/
|
|
2556
3038
|
async loadEvents() {
|
|
2557
3039
|
await this.commandkit.plugins.execute((ctx, plugin) => {
|
|
2558
3040
|
return plugin.onBeforeEventsLoad(ctx);
|
|
@@ -2585,10 +3067,16 @@ var AppEventsHandler = class {
|
|
|
2585
3067
|
return plugin.onAfterEventsLoad(ctx);
|
|
2586
3068
|
});
|
|
2587
3069
|
}
|
|
3070
|
+
/**
|
|
3071
|
+
* Unregisters all event listeners and clears loaded events.
|
|
3072
|
+
*/
|
|
2588
3073
|
unregisterAll() {
|
|
2589
3074
|
this.unregisterAllClientListeners();
|
|
2590
3075
|
this.loadedEvents.clear();
|
|
2591
3076
|
}
|
|
3077
|
+
/**
|
|
3078
|
+
* Registers all loaded events with the Discord.js client and CommandKit event system.
|
|
3079
|
+
*/
|
|
2592
3080
|
registerAllClientEvents() {
|
|
2593
3081
|
const client = this.commandkit.client;
|
|
2594
3082
|
for (const [key, data] of this.loadedEvents.entries()) {
|
|
@@ -2698,6 +3186,9 @@ var AppEventsHandler = class {
|
|
|
2698
3186
|
Logger.info(`🔌 Registered event ${name}${namespace ? ` of namespace ${namespace}` : ""} (${onListeners.length} regular, ${onceListeners.length} once-only)`);
|
|
2699
3187
|
}
|
|
2700
3188
|
}
|
|
3189
|
+
/**
|
|
3190
|
+
* Unregisters all client event listeners and cleans up loaded events.
|
|
3191
|
+
*/
|
|
2701
3192
|
unregisterAllClientListeners() {
|
|
2702
3193
|
const client = this.commandkit.client;
|
|
2703
3194
|
for (const [key, { name, mainListener, namespace }] of this.loadedEvents.entries()) {
|
|
@@ -2719,6 +3210,12 @@ const CONFIG_FILE_NAMES = [
|
|
|
2719
3210
|
"commandkit.config.cjs",
|
|
2720
3211
|
"commandkit.config.ts"
|
|
2721
3212
|
];
|
|
3213
|
+
/**
|
|
3214
|
+
* Returns an array of possible configuration file paths based on the provided root directory.
|
|
3215
|
+
* @param root The root directory to search for configuration files.
|
|
3216
|
+
* @returns The array of possible configuration file paths.
|
|
3217
|
+
* @private
|
|
3218
|
+
*/
|
|
2722
3219
|
function getPossibleConfigPaths(root) {
|
|
2723
3220
|
return CONFIG_FILE_NAMES.map((name) => (0, node_path.join)(root, name));
|
|
2724
3221
|
}
|
|
@@ -2746,6 +3243,10 @@ async function loadConfigFile(entrypoint = process.cwd()) {
|
|
|
2746
3243
|
|
|
2747
3244
|
//#endregion
|
|
2748
3245
|
//#region src/utils/dev-hooks.ts
|
|
3246
|
+
/**
|
|
3247
|
+
* Registers development hooks for CommandKit to handle HMR (Hot Module Replacement) events.
|
|
3248
|
+
* @param commandkit - The CommandKit instance to register hooks for.
|
|
3249
|
+
*/
|
|
2749
3250
|
function registerDevHooks(commandkit$1) {
|
|
2750
3251
|
if (!require_constants.COMMANDKIT_IS_DEV) return;
|
|
2751
3252
|
process.on("message", async (message) => {
|
|
@@ -2797,6 +3298,10 @@ function registerDevHooks(commandkit$1) {
|
|
|
2797
3298
|
|
|
2798
3299
|
//#endregion
|
|
2799
3300
|
//#region src/analytics/utils.ts
|
|
3301
|
+
/**
|
|
3302
|
+
* @private
|
|
3303
|
+
* @internal
|
|
3304
|
+
*/
|
|
2800
3305
|
function getVariableStore() {
|
|
2801
3306
|
const ctx = getContext();
|
|
2802
3307
|
if (!ctx) try {
|
|
@@ -2807,10 +3312,23 @@ function getVariableStore() {
|
|
|
2807
3312
|
}
|
|
2808
3313
|
return ctx.variables;
|
|
2809
3314
|
}
|
|
3315
|
+
/**
|
|
3316
|
+
* @private
|
|
3317
|
+
* @internal
|
|
3318
|
+
*/
|
|
2810
3319
|
function getDoNotTrack() {
|
|
2811
3320
|
const variables = getVariableStore();
|
|
2812
3321
|
return (variables === null || variables === void 0 ? void 0 : variables.get(require_constants$1.DO_NOT_TRACK_KEY)) === true;
|
|
2813
3322
|
}
|
|
3323
|
+
/**
|
|
3324
|
+
* Signals commandkit to not track further analytics events within current context.
|
|
3325
|
+
* This is useful for scenarios where you want to disable analytics tracking
|
|
3326
|
+
* for a specific command or operation, such as during testing or when the user opts out.
|
|
3327
|
+
* @example import { noAnalytics } from 'commandkit/analytics';
|
|
3328
|
+
*
|
|
3329
|
+
* // inside commandkit context
|
|
3330
|
+
* noAnalytics();
|
|
3331
|
+
*/
|
|
2814
3332
|
function noAnalytics() {
|
|
2815
3333
|
const variables = getVariableStore();
|
|
2816
3334
|
if (!variables) throw new Error("noAnalytics may only be used inside commandkit context");
|
|
@@ -2819,25 +3337,59 @@ function noAnalytics() {
|
|
|
2819
3337
|
|
|
2820
3338
|
//#endregion
|
|
2821
3339
|
//#region src/analytics/analytics-engine.ts
|
|
3340
|
+
/**
|
|
3341
|
+
* AnalyticsEngine class for managing analytics providers and tracking events.
|
|
3342
|
+
* This class allows you to register a provider, set a filter for events, and track or identify events.
|
|
3343
|
+
*/
|
|
2822
3344
|
var AnalyticsEngine = class {
|
|
2823
3345
|
#provider = null;
|
|
2824
3346
|
#filter = null;
|
|
3347
|
+
/**
|
|
3348
|
+
* Creates an instance of the AnalyticsEngine.
|
|
3349
|
+
* @param commandkit The CommandKit instance.
|
|
3350
|
+
*/
|
|
2825
3351
|
constructor(commandkit$1) {
|
|
2826
3352
|
this.commandkit = commandkit$1;
|
|
2827
3353
|
}
|
|
3354
|
+
/**
|
|
3355
|
+
* Sets a filter function for analytics events.
|
|
3356
|
+
* This function will be called before tracking an event to determine if it should be tracked.
|
|
3357
|
+
* If the filter returns `false`, the event will not be tracked.
|
|
3358
|
+
* If the filter is set to `null`, all events will be tracked unless `doNotTrack` is enabled.
|
|
3359
|
+
* @param filter The filter function to set, or `null` to remove the filter.
|
|
3360
|
+
*/
|
|
2828
3361
|
setFilter(filter) {
|
|
2829
3362
|
this.#filter = filter;
|
|
2830
3363
|
}
|
|
3364
|
+
/**
|
|
3365
|
+
* Registers an analytics provider.
|
|
3366
|
+
* This provider will be used to track and identify events.
|
|
3367
|
+
* If a provider is already registered, it will be replaced with the new one.
|
|
3368
|
+
* @param provider The analytics provider to register.
|
|
3369
|
+
*/
|
|
2831
3370
|
registerProvider(provider) {
|
|
2832
3371
|
require_warn_unstable.warnUnstable("analytics");
|
|
2833
3372
|
this.#provider = provider;
|
|
2834
3373
|
}
|
|
3374
|
+
/**
|
|
3375
|
+
* Removes the currently registered analytics provider.
|
|
3376
|
+
* @param provider The analytics provider to remove.
|
|
3377
|
+
*/
|
|
2835
3378
|
removeProvider(provider) {
|
|
2836
3379
|
if (this.#provider === provider) this.#provider = null;
|
|
2837
3380
|
}
|
|
3381
|
+
/**
|
|
3382
|
+
* Retrieves the currently registered analytics provider.
|
|
3383
|
+
* @returns The currently registered analytics provider, or `null` if no provider is registered.
|
|
3384
|
+
*/
|
|
2838
3385
|
getProvider() {
|
|
2839
3386
|
return this.#provider;
|
|
2840
3387
|
}
|
|
3388
|
+
/**
|
|
3389
|
+
* Identifies a user with the analytics provider.
|
|
3390
|
+
* This method sends an identify event to the provider, which can be used to associate user data with events.
|
|
3391
|
+
* @param event The identify event containing user data to send to the provider.
|
|
3392
|
+
*/
|
|
2841
3393
|
async identify(event) {
|
|
2842
3394
|
if (!this.#provider) return;
|
|
2843
3395
|
try {
|
|
@@ -2847,6 +3399,12 @@ var AnalyticsEngine = class {
|
|
|
2847
3399
|
Logger.error(`Error identifying with provider ${this.#provider.name}`, error);
|
|
2848
3400
|
}
|
|
2849
3401
|
}
|
|
3402
|
+
/**
|
|
3403
|
+
* Tracks an analytics event with the registered provider.
|
|
3404
|
+
* This method sends the event to the provider, which can then process it as needed.
|
|
3405
|
+
* If the `doNotTrack` setting is enabled or if the filter function returns `false`, the event will not be tracked.
|
|
3406
|
+
* @param event The analytics event to track.
|
|
3407
|
+
*/
|
|
2850
3408
|
async track(event) {
|
|
2851
3409
|
if (!this.#provider) return;
|
|
2852
3410
|
try {
|
|
@@ -2900,30 +3458,77 @@ function onBootstrap(fn) {
|
|
|
2900
3458
|
function onApplicationBootstrap(fn) {
|
|
2901
3459
|
onApplicationBootstrapHooks.add(fn);
|
|
2902
3460
|
}
|
|
3461
|
+
/**
|
|
3462
|
+
* The commandkit class that serves as the main entry point for the CommandKit framework.
|
|
3463
|
+
*/
|
|
2903
3464
|
var CommandKit = class CommandKit extends node_events.default {
|
|
2904
3465
|
#started = false;
|
|
2905
3466
|
#clientProxy = createProxy({});
|
|
2906
3467
|
#client;
|
|
3468
|
+
/**
|
|
3469
|
+
* The event interceptor to quickly register temporary event listeners
|
|
3470
|
+
*/
|
|
2907
3471
|
eventInterceptor;
|
|
3472
|
+
/**
|
|
3473
|
+
* The static createElement function to create jsx elements
|
|
3474
|
+
*/
|
|
2908
3475
|
static createElement = require_element.createElement;
|
|
3476
|
+
/**
|
|
3477
|
+
* The static Fragment component to create jsx fragments
|
|
3478
|
+
*/
|
|
2909
3479
|
static Fragment = require_element.Fragment;
|
|
3480
|
+
/**
|
|
3481
|
+
* The configuration for the CommandKit instance.
|
|
3482
|
+
*/
|
|
2910
3483
|
config = {
|
|
2911
3484
|
defaultLocale: discord_js.Locale.EnglishUS,
|
|
2912
3485
|
getMessageCommandPrefix: () => "!"
|
|
2913
3486
|
};
|
|
3487
|
+
/**
|
|
3488
|
+
* A key-value store for storing arbitrary data.
|
|
3489
|
+
*/
|
|
2914
3490
|
store = /* @__PURE__ */ new Map();
|
|
3491
|
+
/**
|
|
3492
|
+
* A flag store for storing flags that can be used to enable or disable features.
|
|
3493
|
+
*/
|
|
2915
3494
|
flags = new require_store.FlagStore();
|
|
3495
|
+
/**
|
|
3496
|
+
* The command router for the CommandKit instance.
|
|
3497
|
+
*/
|
|
2916
3498
|
commandsRouter;
|
|
3499
|
+
/**
|
|
3500
|
+
* The events router for the CommandKit instance.
|
|
3501
|
+
*/
|
|
2917
3502
|
eventsRouter;
|
|
3503
|
+
/**
|
|
3504
|
+
* The command handler for the CommandKit instance.
|
|
3505
|
+
* This is responsible for handling commands and their execution.
|
|
3506
|
+
*/
|
|
2918
3507
|
commandHandler;
|
|
3508
|
+
/**
|
|
3509
|
+
* The event handler for the CommandKit instance.
|
|
3510
|
+
* This is responsible for handling events and their execution.
|
|
3511
|
+
*/
|
|
2919
3512
|
eventHandler;
|
|
3513
|
+
/**
|
|
3514
|
+
* The plugins runtime for the CommandKit instance.
|
|
3515
|
+
*/
|
|
2920
3516
|
plugins;
|
|
3517
|
+
/**
|
|
3518
|
+
* The events channel for the CommandKit instance. This can be used to emit custom events.
|
|
3519
|
+
*/
|
|
2921
3520
|
events;
|
|
3521
|
+
/**
|
|
3522
|
+
* The analytics engine for the CommandKit instance.
|
|
3523
|
+
* This is responsible for tracking events and user interactions.
|
|
3524
|
+
*/
|
|
2922
3525
|
analytics;
|
|
3526
|
+
/**
|
|
3527
|
+
* The static instance of CommandKit.
|
|
3528
|
+
*/
|
|
2923
3529
|
static instance = void 0;
|
|
2924
3530
|
/**
|
|
2925
3531
|
* Create a new command and event handler with CommandKit.
|
|
2926
|
-
*
|
|
2927
3532
|
* @param options - The default CommandKit configuration.
|
|
2928
3533
|
* @see {@link https://commandkit.js.org/docs/guide/commandkit-setup}
|
|
2929
3534
|
*/
|
|
@@ -3108,6 +3713,11 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
3108
3713
|
getAppDirectory() {
|
|
3109
3714
|
return findAppDirectory();
|
|
3110
3715
|
}
|
|
3716
|
+
/**
|
|
3717
|
+
* Get the path to the commands or events directory.
|
|
3718
|
+
* @param to The type of path to get, either 'commands' or 'events'.
|
|
3719
|
+
* @returns The path to the commands or events directory
|
|
3720
|
+
*/
|
|
3111
3721
|
getPath(to) {
|
|
3112
3722
|
const appDir$1 = this.getAppDirectory();
|
|
3113
3723
|
if (!appDir$1) return null;
|
|
@@ -3118,6 +3728,9 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
3118
3728
|
}
|
|
3119
3729
|
}
|
|
3120
3730
|
};
|
|
3731
|
+
/**
|
|
3732
|
+
* The singleton instance of CommandKit.
|
|
3733
|
+
*/
|
|
3121
3734
|
const commandkit = CommandKit.instance || new CommandKit();
|
|
3122
3735
|
|
|
3123
3736
|
//#endregion
|
|
@@ -3511,4 +4124,4 @@ Object.defineProperty(exports, 'useEnvironment', {
|
|
|
3511
4124
|
return useEnvironment;
|
|
3512
4125
|
}
|
|
3513
4126
|
});
|
|
3514
|
-
//# sourceMappingURL=CommandKit-
|
|
4127
|
+
//# sourceMappingURL=CommandKit-BqZBlSaB.js.map
|