commandkit 1.2.0-dev.20251125020117 → 1.2.0-dev.20260114150514
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/{COPYING.md → LICENSE.md} +3 -3
- package/README.md +3 -3
- package/dist/{ActionRow-BtKd-ZRS.d.ts → ActionRow-B-CGmjDp.d.ts} +2 -3
- package/dist/{ActionRow-D6knpVd6.js → ActionRow-CSN_UKmM.js} +2 -2
- package/dist/{ActionRow-D6knpVd6.js.map → ActionRow-CSN_UKmM.js.map} +1 -1
- package/dist/{Button-DiXeKdXO.d.ts → Button-C-GPeFA3.d.ts} +5 -6
- package/dist/{ButtonKit-B_HCmb3D.d.ts → ButtonKit-DKu0VAe4.d.ts} +35 -36
- package/dist/{ChannelSelectMenuKit-DrsqXWiO.d.ts → ChannelSelectMenuKit-HQZ4hH5s.d.ts} +33 -34
- package/dist/{CommandKitEventsChannel-2l9Za-le.js → CommandKitEventsChannel-CnT5ymYe.js} +2 -2
- package/dist/{CommandKitEventsChannel-2l9Za-le.js.map → CommandKitEventsChannel-CnT5ymYe.js.map} +1 -1
- package/dist/{CommandsRouter-Bdkx7SZS.d.ts → CommandsRouter-C7dZEepB.d.ts} +48 -49
- package/dist/{CommandsRouter-NAgpWzTJ.js → CommandsRouter-C_HLsrGX.js} +2 -2
- package/dist/{CommandsRouter-NAgpWzTJ.js.map → CommandsRouter-C_HLsrGX.js.map} +1 -1
- package/dist/{CompilerPlugin-DbN5-ls3.js → CompilerPlugin-CUsGAfgl.js} +2 -2
- package/dist/{CompilerPlugin-DbN5-ls3.js.map → CompilerPlugin-CUsGAfgl.js.map} +1 -1
- package/dist/EventInterceptor-BWoEJMHZ.js.map +1 -1
- package/dist/{EventInterceptor-Dk5Fwu-7.d.ts → EventInterceptor-CZmWpS08.d.ts} +39 -39
- package/dist/{EventWorkerContext-yTm5vI3b.js → EventWorkerContext-Dfhgv329.js} +2 -2
- package/dist/{EventWorkerContext-yTm5vI3b.js.map → EventWorkerContext-Dfhgv329.js.map} +1 -1
- package/dist/{EventsRouter-bILsV3Lh.d.ts → EventsRouter-DZ37r54v.d.ts} +34 -34
- package/dist/{EventsRouter-D4_vBMhl.js → EventsRouter-DZYIha6m.js} +2 -2
- package/dist/{EventsRouter-D4_vBMhl.js.map → EventsRouter-DZYIha6m.js.map} +1 -1
- package/dist/{MentionableSelectMenuKit-DNan_JWk.d.ts → MentionableSelectMenuKit-7URDUM3-.d.ts} +33 -34
- package/dist/{MessageCommandParser-CD7ynlBO.js → MessageCommandParser-Bs9fimmd.js} +2 -2
- package/dist/{MessageCommandParser-CD7ynlBO.js.map → MessageCommandParser-Bs9fimmd.js.map} +1 -1
- package/dist/MessageCommandParser-q3dQcE5N.d.ts +194 -0
- package/dist/{Modal-Dd5plFpo.d.ts → Modal-CZT9MZsy.d.ts} +7 -8
- package/dist/{ModalKit-C8WkeoDl.d.ts → ModalKit-BWXI3Z26.d.ts} +32 -33
- package/dist/{PluginCommon-Bp5T3ubs.js → PluginCommon-BLxWww5u.js} +6 -6
- package/dist/{PluginCommon-Bp5T3ubs.js.map → PluginCommon-BLxWww5u.js.map} +1 -1
- package/dist/{RoleSelectMenuKit-FfGw3CSa.d.ts → RoleSelectMenuKit-BY-JJ18w.d.ts} +33 -34
- package/dist/{RuntimePlugin-Bq6z-Upz.js → RuntimePlugin-CtobluSU.js} +2 -2
- package/dist/{RuntimePlugin-Bq6z-Upz.js.map → RuntimePlugin-CtobluSU.js.map} +1 -1
- package/dist/{SelectMenu-DTWKY-JJ.d.ts → SelectMenu-q_b3Mjv9.d.ts} +8 -9
- package/dist/{StringSelectMenuKit-BMA0rjhA.d.ts → StringSelectMenuKit-lVhUMc3g.d.ts} +33 -34
- package/dist/{UserSelectMenuKit-CRpFbwA9.d.ts → UserSelectMenuKit-CCj4Fpkr.d.ts} +33 -34
- package/dist/analytics/analytics-engine.d.ts +1 -33
- package/dist/analytics/analytics-engine.js +21 -36
- package/dist/analytics/analytics-provider.d.ts +1 -33
- package/dist/analytics/constants.js +1 -1
- package/dist/analytics/utils.js +21 -36
- package/dist/{analytics-engine-DHmLGxFA.d.ts → analytics-engine-WQhXmx3H.d.ts} +840 -840
- package/dist/app/commands/AppCommandRunner.d.ts +1 -33
- package/dist/app/commands/AppCommandRunner.js +21 -36
- package/dist/app/commands/Context.d.ts +1 -33
- package/dist/app/commands/Context.js +21 -36
- package/dist/app/commands/MessageCommandParser.d.ts +1 -1
- package/dist/app/commands/MessageCommandParser.js +1 -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 +42 -35
- package/dist/app/events/EventWorkerContext.js +1 -1
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -33
- package/dist/app/handlers/AppCommandHandler.js +21 -36
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -33
- package/dist/app/handlers/AppEventsHandler.js +21 -36
- package/dist/app/index.d.ts +4 -33
- package/dist/app/index.js +21 -37
- package/dist/app/interrupt/signals.d.ts +1 -1
- package/dist/app/interrupt/signals.js +2 -3
- package/dist/app/middlewares/permissions.d.ts +1 -33
- package/dist/app/middlewares/permissions.js +21 -36
- package/dist/app/register/CommandRegistrar.d.ts +1 -33
- package/dist/app/register/CommandRegistrar.js +21 -36
- package/dist/app/router/CommandsRouter.d.ts +1 -1
- package/dist/app/router/CommandsRouter.js +1 -1
- package/dist/app/router/EventsRouter.d.ts +1 -1
- package/dist/app/router/EventsRouter.js +1 -1
- package/dist/app/router/index.d.ts +2 -3
- package/dist/app/router/index.js +2 -2
- package/dist/{chunk-nOFOJqeH.js → chunk-kSYXY2_d.js} +10 -6
- package/dist/cli/app-process.d.ts +0 -1
- package/dist/cli/app-process.js +61 -6
- package/dist/cli/app-process.js.map +1 -0
- package/dist/cli/build.d.ts +2 -33
- package/dist/cli/build.js +189 -42
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/common.d.ts +1 -33
- package/dist/cli/common.js +3 -3
- package/dist/cli/development.d.ts +1 -2
- package/dist/cli/development.js +30 -44
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.js +1 -1
- package/dist/cli/generators.js +4 -4
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.js +2 -2
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.d.ts +0 -1
- package/dist/cli/init.js +27 -41
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/production.d.ts +0 -1
- package/dist/cli/production.js +33 -47
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.js +4 -4
- package/dist/cli/utils.d.ts +0 -1
- package/dist/cli/utils.js +17 -2
- package/dist/cli/utils.js.map +1 -0
- package/dist/{colors-CLmBiP9I.js → colors-Csc0X4QJ.js} +2 -2
- package/dist/{colors-CLmBiP9I.js.map → colors-Csc0X4QJ.js.map} +1 -1
- package/dist/{commandkit-B0wT0Mxx.js → commandkit-SIjTLD2R.js} +31 -31
- package/dist/{commandkit-B0wT0Mxx.js.map → commandkit-SIjTLD2R.js.map} +1 -1
- package/dist/commandkit.d.ts +1 -33
- package/dist/commandkit.js +21 -36
- package/dist/{common-B2-sF49Q.js → common-DSRs_mfw.js} +6 -6
- package/dist/{common-B2-sF49Q.js.map → common-DSRs_mfw.js.map} +1 -1
- package/dist/{common-DAxu7-kG.d.ts → common-DnwCYit8.d.ts} +2 -3
- package/dist/components/common/EventInterceptor.d.ts +1 -1
- package/dist/components/common/element.d.ts +1 -4
- package/dist/components/common/types.d.ts +1 -1
- package/dist/components/common/types.js +0 -1
- package/dist/components/display/common.d.ts +0 -1
- package/dist/components/display/container.d.ts +1 -1
- package/dist/components/display/container.js +1 -2
- package/dist/components/display/file.d.ts +1 -1
- package/dist/components/display/file.js +1 -1
- package/dist/components/display/index.d.ts +8 -9
- package/dist/components/display/index.js +8 -9
- package/dist/components/display/label.d.ts +1 -1
- package/dist/components/display/label.js +1 -2
- package/dist/components/display/media-gallery.d.ts +1 -1
- package/dist/components/display/media-gallery.js +1 -2
- package/dist/components/display/poll.d.ts +1 -1
- package/dist/components/display/poll.js +1 -1
- package/dist/components/display/section.d.ts +1 -1
- package/dist/components/display/section.js +1 -2
- package/dist/components/display/separator.d.ts +1 -1
- package/dist/components/display/separator.js +1 -1
- package/dist/components/display/text-display.d.ts +1 -1
- package/dist/components/display/text-display.js +1 -1
- package/dist/components/index.d.ts +22 -25
- package/dist/components/index.js +21 -35
- package/dist/components/interactive/action-row/ActionRow.d.ts +1 -5
- package/dist/components/interactive/action-row/ActionRow.js +1 -1
- package/dist/components/interactive/button/Button.d.ts +1 -6
- package/dist/components/interactive/button/Button.js +21 -36
- package/dist/components/interactive/button/ButtonKit.d.ts +1 -2
- package/dist/components/interactive/button/ButtonKit.js +21 -36
- package/dist/components/interactive/modal/Modal.d.ts +1 -6
- package/dist/components/interactive/modal/Modal.js +21 -36
- package/dist/components/interactive/modal/ModalKit.d.ts +1 -2
- package/dist/components/interactive/modal/ModalKit.js +21 -36
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +21 -36
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +21 -36
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +21 -36
- package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -9
- package/dist/components/interactive/select-menu/SelectMenu.js +21 -36
- package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/StringSelectMenuKit.js +21 -36
- package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/UserSelectMenuKit.js +21 -36
- package/dist/components/interactive/select-menu/common.d.ts +1 -2
- package/dist/components/interactive/select-menu/common.js +0 -1
- package/dist/config/config.d.ts +15 -35
- package/dist/config/config.js +21 -36
- package/dist/config/default.d.ts +1 -33
- package/dist/config/default.js +21 -36
- package/dist/config/loader.d.ts +1 -33
- package/dist/config/loader.js +21 -36
- package/dist/config/types.d.ts +1 -33
- package/dist/config/utils.d.ts +1 -33
- package/dist/constants-BFFK-hfP.js +27 -0
- package/dist/{constants-Dy6P2veX.js.map → constants-BFFK-hfP.js.map} +1 -1
- package/dist/{constants-CAMgxUyw.d.ts → constants-CuYW0K10.d.ts} +7 -7
- package/dist/{constants-BqrEmoih.js → constants-Cw8VjCVz.js} +2 -2
- package/dist/{constants-BqrEmoih.js.map → constants-Cw8VjCVz.js.map} +1 -1
- package/dist/{constants-D95ayHBM.d.ts → constants-EpKcj0dH.d.ts} +1 -1
- package/dist/{container-C319x4cG.js → container-DCPljKVH.js} +2 -2
- package/dist/{container-C319x4cG.js.map → container-DCPljKVH.js.map} +1 -1
- package/dist/{container-0C3ZMb_f.d.ts → container-DYcb7zGw.d.ts} +1 -2
- package/dist/context/async-context.d.ts +1 -33
- package/dist/context/async-context.js +21 -36
- package/dist/context/environment.d.ts +1 -33
- package/dist/context/environment.js +21 -36
- package/dist/element-DibzzA5L.js.map +1 -1
- package/dist/{element-CGY5MlNe.d.ts → element-wQo0heGj.d.ts} +3 -4
- package/dist/{env-CQJgOkQD.js → env-CmspDhHy.js} +1 -1
- package/dist/{env-CQJgOkQD.js.map → env-CmspDhHy.js.map} +1 -1
- package/dist/error-codes-Ds0bnPvT.js.map +1 -1
- package/dist/events/CommandKitEventsChannel.d.ts +1 -33
- package/dist/events/CommandKitEventsChannel.js +1 -1
- package/dist/{file-DgEXJx3x.js → file-Ca1kpEtE.js} +2 -2
- package/dist/{file-DgEXJx3x.js.map → file-Ca1kpEtE.js.map} +1 -1
- package/dist/{file-CfUTZjJh.d.ts → file-CrV4lSnl.d.ts} +1 -2
- package/dist/flags/FlagProvider.d.ts +1 -33
- package/dist/flags/feature-flags.d.ts +1 -33
- package/dist/flags/feature-flags.js +162 -40
- package/dist/flags/feature-flags.js.map +1 -0
- package/dist/flags/store.d.ts +1 -33
- package/dist/flags/store.js +1 -1
- package/dist/{helpers-t6PiYdMb.d.ts → helpers-AQPLVY35.d.ts} +1 -2
- package/dist/{helpers-0FUA42u8.js → helpers-Btx1FSZx.js} +2 -2
- package/dist/{helpers-0FUA42u8.js.map → helpers-Btx1FSZx.js.map} +1 -1
- package/dist/index.d.ts +40 -43
- package/dist/index.js +32 -40
- package/dist/index.js.map +1 -1
- package/dist/kv/constants.d.ts +1 -1
- package/dist/kv/constants.js +1 -1
- package/dist/kv/dotprops.js +25 -3
- package/dist/kv/dotprops.js.map +1 -0
- package/dist/kv/kv.d.ts +289 -290
- package/dist/kv/kv.js +14 -15
- package/dist/kv/kv.js.map +1 -1
- package/dist/kv/serde.d.ts +12 -3
- package/dist/kv/serde.js +86 -4
- package/dist/kv/serde.js.map +1 -0
- package/dist/{label-CQD5hBwB.d.ts → label-37kaNWMH.d.ts} +3 -4
- package/dist/{label-CCHbfQW8.js → label-B6vXvwLM.js} +3 -3
- package/dist/{label-CCHbfQW8.js.map → label-B6vXvwLM.js.map} +1 -1
- package/dist/logger/DefaultLogger.d.ts +66 -3
- package/dist/logger/DefaultLogger.js +21 -36
- package/dist/logger/ILogger.d.ts +64 -2
- package/dist/logger/ILogger.js +0 -1
- package/dist/logger/Logger.d.ts +36 -3
- package/dist/logger/Logger.js +21 -36
- package/dist/logger/NoopLogger.d.ts +36 -37
- package/dist/{media-gallery-DalbYf1v.d.ts → media-gallery-Ci3I4ElH.d.ts} +1 -2
- package/dist/{media-gallery-DdU7o9Cf.js → media-gallery-u3gjX7yD.js} +2 -2
- package/dist/{media-gallery-DdU7o9Cf.js.map → media-gallery-u3gjX7yD.js.map} +1 -1
- package/dist/plugins/CompilerPlugin.d.ts +1 -33
- package/dist/plugins/CompilerPlugin.js +1 -2
- package/dist/plugins/PluginCommon.d.ts +1 -33
- package/dist/plugins/PluginCommon.js +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +1 -33
- package/dist/plugins/RuntimePlugin.js +1 -2
- package/dist/plugins/index.d.ts +1 -33
- package/dist/plugins/index.js +23 -36
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -33
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +21 -36
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -33
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +21 -36
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -33
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +21 -36
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -33
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +21 -36
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -33
- package/dist/plugins/plugin-runtime/runtime.js +0 -1
- package/dist/plugins/types.d.ts +1 -33
- package/dist/plugins/types.js +0 -1
- package/dist/{poll-6lSMoohv.js → poll-CFe8yvoJ.js} +12 -12
- package/dist/{poll-6lSMoohv.js.map → poll-CFe8yvoJ.js.map} +1 -1
- package/dist/{poll-Bo-skHvn.d.ts → poll-Ddtapd6n.d.ts} +7 -8
- package/dist/{resolve-file-url-CJoD0FAn.js → resolve-file-url-CdHqwWs3.js} +2 -2
- package/dist/{resolve-file-url-CJoD0FAn.js.map → resolve-file-url-CdHqwWs3.js.map} +1 -1
- package/dist/{section-C4qfgzOQ.js → section-BC8LF-B2.js} +2 -2
- package/dist/{section-C4qfgzOQ.js.map → section-BC8LF-B2.js.map} +1 -1
- package/dist/{section-CszS2hd5.d.ts → section-DkUKULnB.d.ts} +1 -2
- package/dist/{separator-CsoRs1aX.js → separator-BUTiW7uz.js} +2 -2
- package/dist/{separator-CsoRs1aX.js.map → separator-BUTiW7uz.js.map} +1 -1
- package/dist/{separator-DfRlVHne.d.ts → separator-CbXsIFCa.d.ts} +1 -2
- package/dist/{signals-C2Ly0wDt.js → signals-B8z1wJ6W.js} +2 -2
- package/dist/{signals-C2Ly0wDt.js.map → signals-B8z1wJ6W.js.map} +1 -1
- package/dist/{signals-DeafthGG.d.ts → signals-BbTgTc0i.d.ts} +1 -1
- package/dist/{store-GrsErvli.js → store-D8r_hryO.js} +2 -2
- package/dist/{store-GrsErvli.js.map → store-D8r_hryO.js.map} +1 -1
- package/dist/{text-display-DvydvE0D.d.ts → text-display-D7j39VC-.d.ts} +1 -2
- package/dist/{text-display-C0oSz5y0.js → text-display-DANahMN3.js} +2 -2
- package/dist/{text-display-C0oSz5y0.js.map → text-display-DANahMN3.js.map} +1 -1
- package/dist/{type-checker-CEt5Inbw.js → type-checker-cVd3Hpnh.js} +4 -4
- package/dist/{type-checker-CEt5Inbw.js.map → type-checker-cVd3Hpnh.js.map} +1 -1
- package/dist/{types-CQwntdAo.d.ts → types-BywA9d2Z.d.ts} +1 -1
- package/dist/{types-package-BxIhhZgZ.js → types-package-CsTNfvv2.js} +2 -2
- package/dist/{types-package-BxIhhZgZ.js.map → types-package-CsTNfvv2.js.map} +1 -1
- package/dist/types.d.ts +1 -33
- package/dist/utils/colors.js +1 -1
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/dev-hooks.d.ts +1 -33
- package/dist/utils/dev-hooks.js +21 -36
- package/dist/utils/error-codes.d.ts +54 -2
- package/dist/utils/resolve-file-url.d.ts +11 -2
- package/dist/utils/resolve-file-url.js +1 -1
- package/dist/utils/types-package.js +1 -1
- package/dist/utils/useful-stuff/async-queue.d.ts +21 -21
- package/dist/utils/useful-stuff/mutex.d.ts +62 -62
- package/dist/utils/useful-stuff/ratelimiter.d.ts +56 -56
- package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
- package/dist/utils/useful-stuff/semaphore.d.ts +82 -82
- package/dist/utils/utilities.d.ts +113 -2
- package/dist/utils/utilities.js +21 -36
- package/dist/utils/warning.d.ts +25 -2
- package/dist/utils-Br3eenD1.js.map +1 -1
- package/dist/version.d.ts +8 -2
- package/dist/version.js +12 -2
- package/dist/version.js.map +1 -0
- package/dist/warning-CszH8HeS.js.map +1 -1
- package/package.json +5 -5
- package/dist/DefaultLogger-CgCFHJ4J.d.ts +0 -67
- package/dist/EventWorkerContext-CNPnDdUZ.d.ts +0 -43
- package/dist/ILogger-B-vsuZ1C.d.ts +0 -64
- package/dist/ILogger-B0q7p7L1.js +0 -0
- package/dist/Logger-BmHeS1Qd.d.ts +0 -37
- package/dist/MessageCommandParser-JmJWga4L.d.ts +0 -195
- package/dist/app-CrjK9yWX.js +0 -0
- package/dist/app-process-DCkz7RlU.js +0 -65
- package/dist/app-process-DCkz7RlU.js.map +0 -1
- package/dist/build-CaoHQPvm.js +0 -169
- package/dist/build-CaoHQPvm.js.map +0 -1
- package/dist/config-2prRz7_7.d.ts +0 -16
- package/dist/constants-Dy6P2veX.js +0 -27
- package/dist/dotprops-Dp98nRuu.js +0 -36
- package/dist/dotprops-Dp98nRuu.js.map +0 -1
- package/dist/error-codes-BuWUNGpX.d.ts +0 -54
- package/dist/feature-flags-BRF8OH7U.js +0 -160
- package/dist/feature-flags-BRF8OH7U.js.map +0 -1
- package/dist/resolve-file-url-B63_4Wm3.d.ts +0 -11
- package/dist/serde-CqUxaQUh.js +0 -97
- package/dist/serde-CqUxaQUh.js.map +0 -1
- package/dist/serde-DR1JEtRZ.d.ts +0 -12
- package/dist/utilities-BV9Osg71.d.ts +0 -113
- package/dist/utils-DGovVwyA.js +0 -23
- package/dist/utils-DGovVwyA.js.map +0 -1
- package/dist/version-BKZNlkbA.d.ts +0 -8
- package/dist/version-BYbwxMor.js +0 -18
- package/dist/version-BYbwxMor.js.map +0 -1
- package/dist/warning-BucG024D.d.ts +0 -25
- /package/dist/{index-B5F3AfVc.d.ts → index-BJfko-dP.d.ts} +0 -0
- /package/dist/{index-BLwMeReG.d.ts → index-CCggO_hw.d.ts} +0 -0
- /package/dist/{index-h64gcVNJ.d.ts → index-CLjpoGi1.d.ts} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { t as EventInterceptor } from "./EventInterceptor-
|
|
2
|
-
import { a as Fragment, s as createElement } from "./element-
|
|
3
|
-
import { t as MaybeArray } from "./types-
|
|
4
|
-
import { r as MessageCommandParser, t as MessageCommandOptions } from "./MessageCommandParser-
|
|
5
|
-
import { i as Middleware, n as CommandsRouter, t as Command } from "./CommandsRouter-
|
|
6
|
-
import { i as ParsedEvent, t as EventsRouter } from "./EventsRouter-
|
|
7
|
-
import { o as HMREventType } from "./constants-
|
|
1
|
+
import { t as EventInterceptor } from "./EventInterceptor-CZmWpS08.js";
|
|
2
|
+
import { a as Fragment, s as createElement } from "./element-wQo0heGj.js";
|
|
3
|
+
import { t as MaybeArray } from "./types-BywA9d2Z.js";
|
|
4
|
+
import { r as MessageCommandParser, t as MessageCommandOptions } from "./MessageCommandParser-q3dQcE5N.js";
|
|
5
|
+
import { i as Middleware, n as CommandsRouter, t as Command } from "./CommandsRouter-C7dZEepB.js";
|
|
6
|
+
import { i as ParsedEvent, t as EventsRouter } from "./EventsRouter-DZ37r54v.js";
|
|
7
|
+
import { o as HMREventType } from "./constants-CuYW0K10.js";
|
|
8
8
|
import EventEmitter from "node:events";
|
|
9
9
|
import { AutocompleteInteraction, Awaitable, CacheType, ChatInputCommandInteraction, Client, ClientEvents, Collection, Constructable, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Guild, Interaction, Locale, Message, MessageContextMenuCommandInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody, SlashCommandBuilder, TextBasedChannel, UserContextMenuCommandInteraction } from "discord.js";
|
|
10
10
|
import { DirectiveTransformerOptions } from "directive-to-hof";
|
|
11
|
-
import {
|
|
11
|
+
import { InlineConfig } from "tsdown";
|
|
12
12
|
|
|
13
13
|
//#region src/types.d.ts
|
|
14
14
|
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
@@ -17,8 +17,8 @@ type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
|
17
17
|
*/
|
|
18
18
|
interface CommandKitOptions {
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
* The Discord.js client object to use with CommandKit.
|
|
21
|
+
*/
|
|
22
22
|
client?: Client;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
@@ -26,16 +26,16 @@ interface CommandKitOptions {
|
|
|
26
26
|
*/
|
|
27
27
|
interface CommandContext<T extends Interaction, Cached extends CacheType> {
|
|
28
28
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
* The interaction that triggered this command.
|
|
30
|
+
*/
|
|
31
31
|
interaction: Interaction<CacheType>;
|
|
32
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
* The client that instantiated this command.
|
|
34
|
+
*/
|
|
35
35
|
client: Client;
|
|
36
36
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
* The command data.
|
|
38
|
+
*/
|
|
39
39
|
handler: CommandKit;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -43,24 +43,24 @@ interface CommandContext<T extends Interaction, Cached extends CacheType> {
|
|
|
43
43
|
*/
|
|
44
44
|
interface CommandMetadata {
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
* The guilds that the command is available in.
|
|
47
|
+
*/
|
|
48
48
|
guilds?: string[];
|
|
49
49
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
* The aliases of the command.
|
|
51
|
+
*/
|
|
52
52
|
aliases?: string[];
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
* The user permissions required to execute the command.
|
|
55
|
+
*/
|
|
56
56
|
userPermissions?: PermissionsString | PermissionsString[];
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
* The bot permissions required to execute the command.
|
|
59
|
+
*/
|
|
60
60
|
botPermissions?: PermissionsString | PermissionsString[];
|
|
61
61
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
* The name aliases for the `user` and `message` context menu commands. When i18n plugin is in use, this option will be ignored if the translation for the context menu command name is provided.
|
|
63
|
+
*/
|
|
64
64
|
nameAliases?: Record<'user' | 'message', string>;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
@@ -68,8 +68,8 @@ interface CommandMetadata {
|
|
|
68
68
|
*/
|
|
69
69
|
type CommandData = Prettify<Omit<RESTPostAPIApplicationCommandsJSONBody, 'description'> & {
|
|
70
70
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
* The description of the command.
|
|
72
|
+
*/
|
|
73
73
|
description?: string;
|
|
74
74
|
}>;
|
|
75
75
|
/**
|
|
@@ -201,138 +201,138 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
|
|
|
201
201
|
readonly commandkit: CommandKit;
|
|
202
202
|
protected readonly config: ContextParameters<ExecutionMode, Args>;
|
|
203
203
|
/**
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
* The interaction that triggered the command.
|
|
205
|
+
*/
|
|
206
206
|
readonly interaction: ContextParameters<ExecutionMode>['interaction'];
|
|
207
207
|
/**
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
* The message that triggered the command.
|
|
209
|
+
*/
|
|
210
210
|
readonly message: ContextParameters<ExecutionMode>['message'];
|
|
211
211
|
/**
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
* The guild where the command was triggered.
|
|
213
|
+
*/
|
|
214
214
|
readonly guild: Guild | null;
|
|
215
215
|
/**
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
* The guild ID where the command was triggered.
|
|
217
|
+
*/
|
|
218
218
|
readonly guildId: string | null;
|
|
219
219
|
/**
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
* The channel where the command was triggered.
|
|
221
|
+
*/
|
|
222
222
|
readonly channel: TextBasedChannel | null;
|
|
223
223
|
/**
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
* The channel id where the command was triggered.
|
|
225
|
+
*/
|
|
226
226
|
readonly channelId: string | null;
|
|
227
227
|
/**
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
* The client instance.
|
|
229
|
+
*/
|
|
230
230
|
readonly client: Client;
|
|
231
231
|
/**
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
* The command that this context belongs to.
|
|
233
|
+
*/
|
|
234
234
|
readonly command: LoadedCommand;
|
|
235
235
|
/**
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
* @private
|
|
237
|
+
* @internal
|
|
238
|
+
*/
|
|
239
239
|
private _locale;
|
|
240
240
|
/**
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
241
|
+
* Creates a new command context.
|
|
242
|
+
* @param commandkit The command kit instance.
|
|
243
|
+
* @param config The context parameters.
|
|
244
|
+
*/
|
|
245
245
|
constructor(commandkit: CommandKit, config: ContextParameters<ExecutionMode, Args>);
|
|
246
246
|
/**
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
* The shared key-value store for this context. This can be used to store data that needs to be shared between middlewares or commands.
|
|
248
|
+
* This store is shared across all contexts in the same command execution, including the cloned contexts and middleware contexts.
|
|
249
|
+
*/
|
|
250
250
|
get store(): Collection<any, any>;
|
|
251
251
|
/**
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
* Gets the name of the current command.
|
|
253
|
+
*/
|
|
254
254
|
get commandName(): string;
|
|
255
255
|
/**
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
* Gets the invoked command name (could be an alias for message commands)
|
|
257
|
+
*/
|
|
258
258
|
get invokedCommandName(): string;
|
|
259
259
|
/**
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
* Gets the command options based on the execution mode.
|
|
261
|
+
*/
|
|
262
262
|
get options(): CommandContextOptions<ExecutionMode>;
|
|
263
263
|
/**
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
* Whether this context was forwarded from another context. This happens when a command forwards its context to another command.
|
|
265
|
+
*/
|
|
266
266
|
get forwarded(): boolean;
|
|
267
267
|
/**
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
268
|
+
* Forwards the context to another command. The target handler will be the same as current handler.
|
|
269
|
+
* @param command The command to forward to.
|
|
270
|
+
*/
|
|
271
271
|
forwardCommand<C extends ResolvableCommand>(command: C): Promise<never>;
|
|
272
272
|
/**
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
* The execution mode of the command.
|
|
274
|
+
*/
|
|
275
275
|
get executionMode(): ExecutionMode;
|
|
276
276
|
/**
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
* Whether the command was triggered by an interaction.
|
|
278
|
+
*/
|
|
279
279
|
isInteraction(): this is InteractionCommandContext;
|
|
280
280
|
/**
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
* Whether the command was triggered by a slash command interaction.
|
|
282
|
+
*/
|
|
283
283
|
isChatInputCommand(): this is ChatInputCommandContext;
|
|
284
284
|
/**
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
* Whether the command was triggered by an autocomplete interaction.
|
|
286
|
+
*/
|
|
287
287
|
isAutocomplete(): this is AutocompleteCommandContext;
|
|
288
288
|
/**
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
* Whether the command was triggered by a message context menu interaction.
|
|
290
|
+
*/
|
|
291
291
|
isMessageContextMenu(): this is MessageContextMenuCommandContext;
|
|
292
292
|
/**
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
* Whether the command was triggered by a user context menu interaction.
|
|
294
|
+
*/
|
|
295
295
|
isUserContextMenu(): this is UserContextMenuCommandContext;
|
|
296
296
|
/**
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
* Whether the command was triggered by a message.
|
|
298
|
+
*/
|
|
299
299
|
isMessage(): this is Context<'message'>;
|
|
300
300
|
/**
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
* Returns the command identifier.
|
|
302
|
+
*/
|
|
303
303
|
getCommandIdentifier(): string;
|
|
304
304
|
/**
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
* Returns the locale of the guild where this command was triggered.
|
|
306
|
+
*/
|
|
307
307
|
getGuildLocale(): Locale | null;
|
|
308
308
|
/**
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
* Returns the locale of the user who triggered this command.
|
|
310
|
+
*/
|
|
311
311
|
getUserLocale(): Locale | null;
|
|
312
312
|
/**
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
313
|
+
* Returns the locale for this command.
|
|
314
|
+
* @param preferUser Whether to prefer the user's locale over the guild's locale.
|
|
315
|
+
* @returns The locale for this command. If no locale is found, the default locale is returned.
|
|
316
|
+
*/
|
|
317
317
|
getLocale(preferUser?: boolean): Locale;
|
|
318
318
|
/**
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
* Sets the locale for this command.
|
|
320
|
+
* @param locale The locale to set.
|
|
321
|
+
*/
|
|
322
322
|
setLocale(locale: Locale | null): void;
|
|
323
323
|
/**
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
* Creates a clone of this context
|
|
325
|
+
* @param config - Optional partial config to override in the clone
|
|
326
|
+
*/
|
|
327
327
|
clone(config?: Partial<ContextParameters<ExecutionMode>>): Context<ExecutionMode>;
|
|
328
328
|
/**
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
* Checks if this context is a middleware context.
|
|
330
|
+
*/
|
|
331
331
|
isMiddleware(): this is MiddlewareContext<ExecutionMode>;
|
|
332
332
|
/**
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
333
|
+
* Gets the command arguments (only available for message commands).
|
|
334
|
+
* @returns Array of command arguments
|
|
335
|
+
*/
|
|
336
336
|
args(): string[];
|
|
337
337
|
}
|
|
338
338
|
/**
|
|
@@ -340,14 +340,14 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
|
|
|
340
340
|
*/
|
|
341
341
|
declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutionMode> extends Context<T, MiddlewareContextArgs> {
|
|
342
342
|
/**
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
343
|
+
* Sets command runner function to wrap the command execution.
|
|
344
|
+
* @param fn The function to set.
|
|
345
|
+
* @example ctx.setCommandRunner(async (execute) => {
|
|
346
|
+
* // do something before command execution
|
|
347
|
+
* await execute();
|
|
348
|
+
* // do something after command execution
|
|
349
|
+
* })
|
|
350
|
+
*/
|
|
351
351
|
setCommandRunner(fn: RunCommand): void;
|
|
352
352
|
}
|
|
353
353
|
//#endregion
|
|
@@ -365,36 +365,36 @@ interface PreRegisterCommandsEvent {
|
|
|
365
365
|
declare class CommandRegistrar {
|
|
366
366
|
readonly commandkit: CommandKit;
|
|
367
367
|
/**
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
368
|
+
* @private
|
|
369
|
+
* @internal
|
|
370
|
+
*/
|
|
371
371
|
private api;
|
|
372
372
|
/**
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
373
|
+
* Creates an instance of CommandRegistrar.
|
|
374
|
+
* @param commandkit The commandkit instance.
|
|
375
|
+
*/
|
|
376
376
|
constructor(commandkit: CommandKit);
|
|
377
377
|
/**
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
* Gets the commands data.
|
|
379
|
+
*/
|
|
380
380
|
getCommandsData(): (CommandData & {
|
|
381
381
|
__metadata?: CommandMetadata;
|
|
382
382
|
__applyId(id: string): void;
|
|
383
383
|
})[];
|
|
384
384
|
/**
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
* Registers loaded commands.
|
|
386
|
+
*/
|
|
387
387
|
register(): Promise<void>;
|
|
388
388
|
/**
|
|
389
|
-
|
|
390
|
-
|
|
389
|
+
* Updates the global commands.
|
|
390
|
+
*/
|
|
391
391
|
updateGlobalCommands(commands: (CommandData & {
|
|
392
392
|
__metadata?: CommandMetadata;
|
|
393
393
|
__applyId(id: string): void;
|
|
394
394
|
})[]): Promise<void>;
|
|
395
395
|
/**
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
* Updates the guild commands.
|
|
397
|
+
*/
|
|
398
398
|
updateGuildCommands(commands: (CommandData & {
|
|
399
399
|
__metadata?: CommandMetadata;
|
|
400
400
|
__applyId(id: string): void;
|
|
@@ -407,46 +407,46 @@ declare class CommandRegistrar {
|
|
|
407
407
|
*/
|
|
408
408
|
interface CommandKitEnvironmentInternalData {
|
|
409
409
|
/**
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
410
|
+
* The error that occurred during command execution, if any.
|
|
411
|
+
* This is set when an error occurs during the execution of a command.
|
|
412
|
+
*/
|
|
413
413
|
executionError: Error | null;
|
|
414
414
|
/**
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
* The type of the environment, which can be used to differentiate between
|
|
416
|
+
* different execution contexts (e.g., command handler, event handler, etc.).
|
|
417
|
+
*/
|
|
418
418
|
type: CommandKitEnvironmentType | null;
|
|
419
419
|
/**
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
420
|
+
* A map of variables that can be used to store and retrieve data during command execution.
|
|
421
|
+
* This allows for sharing data between different parts of the command execution process.
|
|
422
|
+
*/
|
|
423
423
|
variables: Map<string, any>;
|
|
424
424
|
/**
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
425
|
+
* A map of deferred functions that will be executed after the command has finished executing.
|
|
426
|
+
* This is useful for running cleanup tasks or additional processing after the main command logic.
|
|
427
|
+
*/
|
|
428
428
|
deferredFunctions: Map<string, GenericFunction<[CommandKitEnvironment]>>;
|
|
429
429
|
/**
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
430
|
+
* A marker string that can be used to identify the command execution.
|
|
431
|
+
* This is useful for logging and debugging purposes.
|
|
432
|
+
*/
|
|
433
433
|
marker: string;
|
|
434
434
|
/**
|
|
435
|
-
|
|
436
|
-
|
|
435
|
+
* The start time of the command execution.
|
|
436
|
+
*/
|
|
437
437
|
markStart: number;
|
|
438
438
|
/**
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
* The end time of the command execution.
|
|
440
|
+
*/
|
|
441
441
|
markEnd: number;
|
|
442
442
|
/**
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
443
|
+
* The context associated with the command execution.
|
|
444
|
+
* This can be used to access request-specific data or application state.
|
|
445
|
+
*/
|
|
446
446
|
context: Context | null;
|
|
447
447
|
/**
|
|
448
|
-
|
|
449
|
-
|
|
448
|
+
* Shared collection instance for arbitrary data storage
|
|
449
|
+
*/
|
|
450
450
|
store: Collection<any, any>;
|
|
451
451
|
}
|
|
452
452
|
/**
|
|
@@ -456,92 +456,92 @@ declare class CommandKitEnvironment {
|
|
|
456
456
|
#private;
|
|
457
457
|
readonly commandkit: CommandKit;
|
|
458
458
|
/**
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
459
|
+
* Creates the commandkit execution environment.
|
|
460
|
+
* @param commandkit - The commandkit instance.
|
|
461
|
+
*/
|
|
462
462
|
constructor(commandkit: CommandKit);
|
|
463
463
|
/**
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
464
|
+
* Set the context.
|
|
465
|
+
* @param context - The context to set.
|
|
466
|
+
*/
|
|
467
467
|
setContext(context: Context): void;
|
|
468
468
|
/**
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
469
|
+
* Get the context. `null` if not set.
|
|
470
|
+
* @internal
|
|
471
|
+
*/
|
|
472
472
|
get context(): Context | null;
|
|
473
473
|
/**
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
474
|
+
* Get the execution error.
|
|
475
|
+
* @internal
|
|
476
|
+
*/
|
|
477
477
|
getExecutionError(): Error | null;
|
|
478
478
|
/**
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
479
|
+
* Set the execution error.
|
|
480
|
+
* @param error - The error to set.
|
|
481
|
+
* @internal
|
|
482
|
+
*/
|
|
483
483
|
setExecutionError(error: Error): void;
|
|
484
484
|
/**
|
|
485
|
-
|
|
486
|
-
|
|
485
|
+
* Get the environment type.
|
|
486
|
+
*/
|
|
487
487
|
getType(): CommandKitEnvironmentType;
|
|
488
488
|
/**
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
489
|
+
* Set the environment type.
|
|
490
|
+
* @param type - The environment type to set.
|
|
491
|
+
* @internal
|
|
492
|
+
*/
|
|
493
493
|
setType(type: CommandKitEnvironmentType): void;
|
|
494
494
|
/**
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
* The variables store for this environment.
|
|
496
|
+
*/
|
|
497
497
|
get variables(): Map<string, any>;
|
|
498
498
|
/**
|
|
499
|
-
|
|
500
|
-
|
|
499
|
+
* The shared store for this environment
|
|
500
|
+
*/
|
|
501
501
|
get store(): Collection<any, any>;
|
|
502
502
|
/**
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
503
|
+
* Register a deferred function.
|
|
504
|
+
* @param fn - The deferred function to register.
|
|
505
|
+
* @returns The deferred function id.
|
|
506
|
+
* @internal
|
|
507
|
+
*/
|
|
508
508
|
registerDeferredFunction(fn: GenericFunction<[CommandKitEnvironment]>): string;
|
|
509
509
|
/**
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
510
|
+
* Clear a deferred function by id.
|
|
511
|
+
* @param id - The deferred function id to clear.
|
|
512
|
+
* @internal
|
|
513
|
+
*/
|
|
514
514
|
clearDeferredFunction(id: string): void;
|
|
515
515
|
/**
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
516
|
+
* Run all deferred functions sequentially.
|
|
517
|
+
* @internal
|
|
518
|
+
*/
|
|
519
519
|
runDeferredFunctions(): Promise<void>;
|
|
520
520
|
/**
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
521
|
+
* Clear all deferred functions.
|
|
522
|
+
* @internal
|
|
523
|
+
*/
|
|
524
524
|
clearAllDeferredFunctions(): void;
|
|
525
525
|
/**
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
526
|
+
* Mark the start of a command execution.
|
|
527
|
+
* @param marker - The marker to set.
|
|
528
|
+
* @internal
|
|
529
|
+
*/
|
|
530
530
|
markStart(marker: string): void;
|
|
531
531
|
/**
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
532
|
+
* Mark the end of a command execution.
|
|
533
|
+
* @internal
|
|
534
|
+
*/
|
|
535
535
|
markEnd(): void;
|
|
536
536
|
/**
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
537
|
+
* Get the marker.
|
|
538
|
+
* @internal
|
|
539
|
+
*/
|
|
540
540
|
getMarker(): string;
|
|
541
541
|
/**
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
542
|
+
* Get the execution time in milliseconds.
|
|
543
|
+
* @internal
|
|
544
|
+
*/
|
|
545
545
|
getExecutionTime(): number;
|
|
546
546
|
}
|
|
547
547
|
declare enum CommandKitEnvironmentType {
|
|
@@ -640,17 +640,17 @@ declare function useStore(): Collection<any, any>;
|
|
|
640
640
|
*/
|
|
641
641
|
interface RunCommandOptions {
|
|
642
642
|
/**
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
643
|
+
* The handler to use for executing the command.
|
|
644
|
+
* If not provided, the execution mode will determine the handler.
|
|
645
|
+
* For example, 'chatInputCommand', 'message', etc.
|
|
646
|
+
*/
|
|
647
647
|
handler?: string;
|
|
648
648
|
/**
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
649
|
+
* Whether to throw an error if the command execution fails.
|
|
650
|
+
* If true, any error during execution will be thrown.
|
|
651
|
+
* Default is false, which means errors will be logged but not thrown.
|
|
652
|
+
* @default false
|
|
653
|
+
*/
|
|
654
654
|
throwOnError?: boolean;
|
|
655
655
|
}
|
|
656
656
|
/**
|
|
@@ -661,23 +661,23 @@ declare class AppCommandRunner {
|
|
|
661
661
|
#private;
|
|
662
662
|
private handler;
|
|
663
663
|
/**
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
664
|
+
* Creates a new AppCommandRunner instance.
|
|
665
|
+
* @param handler - The app command handler instance to use for command execution
|
|
666
|
+
*/
|
|
667
667
|
constructor(handler: AppCommandHandler);
|
|
668
668
|
/**
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
669
|
+
* Executes a prepared command with middleware support and environment setup.
|
|
670
|
+
* Handles the complete command lifecycle including before/after middleware execution.
|
|
671
|
+
* @param prepared - The prepared command execution data
|
|
672
|
+
* @param source - The source interaction or message that triggered the command
|
|
673
|
+
* @param options - The options for running the command
|
|
674
|
+
*/
|
|
675
675
|
runCommand(prepared: PreparedAppCommandExecution, source: Interaction | Message, options?: RunCommandOptions): Promise<any>;
|
|
676
676
|
/**
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
677
|
+
* Determines the execution mode based on the source of the command.
|
|
678
|
+
* @param source - The interaction or message that triggered the command
|
|
679
|
+
* @returns The appropriate command execution mode
|
|
680
|
+
*/
|
|
681
681
|
getExecutionMode(source: Interaction | Message): CommandExecutionMode;
|
|
682
682
|
}
|
|
683
683
|
//#endregion
|
|
@@ -726,21 +726,21 @@ interface AppCommandMiddleware {
|
|
|
726
726
|
*/
|
|
727
727
|
interface LoadedCommand {
|
|
728
728
|
/**
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
729
|
+
* The associated discord snowflake id for this command.
|
|
730
|
+
* If the information is not yet available, this will be `null`.
|
|
731
|
+
*/
|
|
732
732
|
discordId: string | null;
|
|
733
733
|
/**
|
|
734
|
-
|
|
735
|
-
|
|
734
|
+
* The command data.
|
|
735
|
+
*/
|
|
736
736
|
command: Command;
|
|
737
737
|
/**
|
|
738
|
-
|
|
739
|
-
|
|
738
|
+
* The metadata for this command.
|
|
739
|
+
*/
|
|
740
740
|
metadata: CommandMetadata;
|
|
741
741
|
/**
|
|
742
|
-
|
|
743
|
-
|
|
742
|
+
* The data for this command.
|
|
743
|
+
*/
|
|
744
744
|
data: AppCommand;
|
|
745
745
|
}
|
|
746
746
|
/**
|
|
@@ -805,118 +805,118 @@ type CommandDataSchemaValue = CommandDataSchema[CommandDataSchemaKey];
|
|
|
805
805
|
declare class AppCommandHandler {
|
|
806
806
|
readonly commandkit: CommandKit;
|
|
807
807
|
/**
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
808
|
+
* @private
|
|
809
|
+
* @internal
|
|
810
|
+
*/
|
|
811
811
|
private loadedCommands;
|
|
812
812
|
/**
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
813
|
+
* @private
|
|
814
|
+
* @internal
|
|
815
|
+
*/
|
|
816
816
|
private loadedMiddlewares;
|
|
817
817
|
/**
|
|
818
|
-
|
|
819
|
-
|
|
818
|
+
* Command registrar for handling Discord API registration.
|
|
819
|
+
*/
|
|
820
820
|
readonly registrar: CommandRegistrar;
|
|
821
821
|
/**
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
822
|
+
* @private
|
|
823
|
+
* @internal
|
|
824
|
+
*/
|
|
825
825
|
private onInteraction;
|
|
826
826
|
/**
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
827
|
+
* @private
|
|
828
|
+
* @internal
|
|
829
|
+
*/
|
|
830
830
|
private onMessageCreate;
|
|
831
831
|
/**
|
|
832
|
-
|
|
833
|
-
|
|
832
|
+
* Command runner instance for executing commands.
|
|
833
|
+
*/
|
|
834
834
|
readonly commandRunner: AppCommandRunner;
|
|
835
835
|
/**
|
|
836
|
-
|
|
837
|
-
|
|
836
|
+
* External command data storage.
|
|
837
|
+
*/
|
|
838
838
|
readonly externalCommandData: Collection<string, Command>;
|
|
839
839
|
/**
|
|
840
|
-
|
|
841
|
-
|
|
840
|
+
* External middleware data storage.
|
|
841
|
+
*/
|
|
842
842
|
readonly externalMiddlewareData: Collection<string, Middleware>;
|
|
843
843
|
/**
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
844
|
+
* Creates a new AppCommandHandler instance.
|
|
845
|
+
* @param commandkit - The CommandKit instance
|
|
846
|
+
*/
|
|
847
847
|
constructor(commandkit: CommandKit);
|
|
848
848
|
/**
|
|
849
|
-
|
|
850
|
-
|
|
849
|
+
* Prints a formatted banner showing all loaded commands organized by category.
|
|
850
|
+
*/
|
|
851
851
|
printBanner(): void;
|
|
852
852
|
/**
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
853
|
+
* Gets an array of all loaded commands.
|
|
854
|
+
* @returns Array of loaded commands
|
|
855
|
+
*/
|
|
856
856
|
getCommandsArray(): LoadedCommand[];
|
|
857
857
|
/**
|
|
858
|
-
|
|
859
|
-
|
|
858
|
+
* Registers event handlers for Discord interactions and messages.
|
|
859
|
+
*/
|
|
860
860
|
registerCommandHandler(): void;
|
|
861
861
|
/**
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
862
|
+
* Prepares a command for execution by resolving the command and its middleware.
|
|
863
|
+
* @param source - The interaction or message that triggered the command
|
|
864
|
+
* @param cmdName - Optional command name override
|
|
865
|
+
* @returns Prepared command execution data or null if command not found
|
|
866
|
+
*/
|
|
867
867
|
prepareCommandRun(source: Interaction | Message, cmdName?: string): Promise<PreparedAppCommandExecution | null>;
|
|
868
868
|
/**
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
869
|
+
* Finds a command by name.
|
|
870
|
+
* @param name - The command name to search for
|
|
871
|
+
* @param hint - The hint for the command type (user or message)
|
|
872
|
+
* @returns The loaded command or null if not found
|
|
873
|
+
*/
|
|
874
874
|
private findCommandByName;
|
|
875
875
|
resolveMessageCommandName(name: string): string;
|
|
876
876
|
/**
|
|
877
|
-
|
|
878
|
-
|
|
877
|
+
* Reloads all commands and middleware from scratch.
|
|
878
|
+
*/
|
|
879
879
|
reloadCommands(): Promise<void>;
|
|
880
880
|
/**
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
881
|
+
* Adds external middleware data to be loaded.
|
|
882
|
+
* @param data - Array of middleware data to add
|
|
883
|
+
*/
|
|
884
884
|
addExternalMiddleware(data: Middleware[]): Promise<void>;
|
|
885
885
|
/**
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
886
|
+
* Adds external command data to be loaded.
|
|
887
|
+
* @param data - Array of command data to add
|
|
888
|
+
*/
|
|
889
889
|
addExternalCommands(data: Command[]): Promise<void>;
|
|
890
890
|
/**
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
891
|
+
* Registers externally loaded middleware.
|
|
892
|
+
* @param data - Array of loaded middleware to register
|
|
893
|
+
*/
|
|
894
894
|
registerExternalLoadedMiddleware(data: LoadedMiddleware[]): Promise<void>;
|
|
895
895
|
/**
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
896
|
+
* Registers externally loaded commands.
|
|
897
|
+
* @param data - Array of loaded commands to register
|
|
898
|
+
*/
|
|
899
899
|
registerExternalLoadedCommands(data: LoadedCommand[]): Promise<void>;
|
|
900
900
|
/**
|
|
901
|
-
|
|
902
|
-
|
|
901
|
+
* Loads all commands and middleware from the router.
|
|
902
|
+
*/
|
|
903
903
|
loadCommands(): Promise<void>;
|
|
904
904
|
/**
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
905
|
+
* @private
|
|
906
|
+
* @internal
|
|
907
|
+
*/
|
|
908
908
|
private loadMiddleware;
|
|
909
909
|
/**
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
910
|
+
* @private
|
|
911
|
+
* @internal
|
|
912
|
+
*/
|
|
913
913
|
private loadCommand;
|
|
914
914
|
/**
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
915
|
+
* Gets the metadata for a command.
|
|
916
|
+
* @param command - The command name to get metadata for
|
|
917
|
+
* @param hint - The hint for the command type (user or message)
|
|
918
|
+
* @returns The command metadata or null if not found
|
|
919
|
+
*/
|
|
920
920
|
getMetadataFor(command: string, hint?: 'user' | 'message'): CommandMetadata | null;
|
|
921
921
|
}
|
|
922
922
|
//#endregion
|
|
@@ -934,18 +934,18 @@ declare class CommandKitEventsChannel {
|
|
|
934
934
|
readonly commandkit: CommandKit;
|
|
935
935
|
private emitter;
|
|
936
936
|
/**
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
937
|
+
* Creates a new instance of CommandKitEventsChannel.
|
|
938
|
+
* @param commandkit The CommandKit instance that this channel belongs to.
|
|
939
|
+
*/
|
|
940
940
|
constructor(commandkit: CommandKit);
|
|
941
941
|
/**
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
942
|
+
* Creates a namespaced event channel. This allows you to manage events
|
|
943
|
+
* within a specific namespace, preventing conflicts with other event channels.
|
|
944
|
+
* This is useful for organizing events related to different parts of your application.
|
|
945
|
+
* @param namespace The namespace for the event channel.
|
|
946
|
+
* @returns An object containing methods for managing events within the namespace.
|
|
947
|
+
* @example commandkit.events.to('customNamespace').emit('eventName', data);
|
|
948
|
+
*/
|
|
949
949
|
to(namespace: string): {
|
|
950
950
|
on: (event: string, listener: ListenerFunction) => void;
|
|
951
951
|
off: (event: string, listener: ListenerFunction) => void;
|
|
@@ -954,40 +954,40 @@ declare class CommandKitEventsChannel {
|
|
|
954
954
|
removeAllListeners: (event: string) => void;
|
|
955
955
|
};
|
|
956
956
|
/**
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
957
|
+
* Register an event listener for a specific event within the namespace.
|
|
958
|
+
* @param namespace The namespace for the event channel.
|
|
959
|
+
* @param event The name of the event to listen for.
|
|
960
|
+
* @param listener The function to call when the event is emitted.
|
|
961
|
+
*/
|
|
962
962
|
on(namespace: string, event: string, listener: ListenerFunction): void;
|
|
963
963
|
/**
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
964
|
+
* Unregister an event listener for a specific event within the namespace.
|
|
965
|
+
* @param namespace The namespace for the event channel.
|
|
966
|
+
* @param event The name of the event to stop listening for.
|
|
967
|
+
* @param listener The function that was registered as the listener.
|
|
968
|
+
*/
|
|
969
969
|
off(namespace: string, event: string, listener: ListenerFunction): void;
|
|
970
970
|
/**
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
971
|
+
* Register an event listener that will be called only once for a specific event
|
|
972
|
+
* within the namespace.
|
|
973
|
+
* @param namespace The namespace for the event channel.
|
|
974
|
+
* @param event The name of the event to listen for.
|
|
975
|
+
* @param listener The function to call when the event is emitted.
|
|
976
|
+
*/
|
|
977
977
|
once(namespace: string, event: string, listener: ListenerFunction): void;
|
|
978
978
|
/**
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
979
|
+
* Emit an event within the specified namespace, calling all registered listeners.
|
|
980
|
+
* @param namespace The namespace for the event channel.
|
|
981
|
+
* @param event The name of the event to emit.
|
|
982
|
+
* @param args The arguments to pass to the listeners.
|
|
983
|
+
* @returns A boolean indicating whether any listeners were called.
|
|
984
|
+
*/
|
|
985
985
|
emit(namespace: string, event: string, ...args: any[]): boolean;
|
|
986
986
|
/**
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
987
|
+
* Remove all listeners for a specific event or all events within the namespace.
|
|
988
|
+
* @param namespace The namespace for the event channel.
|
|
989
|
+
* @param event The name of the event to remove listeners for. If not provided, all listeners for all events in the namespace will be removed.
|
|
990
|
+
*/
|
|
991
991
|
removeAllListeners(namespace: string): void;
|
|
992
992
|
removeAllListeners(namespace: string, event: string): void;
|
|
993
993
|
}
|
|
@@ -1028,39 +1028,39 @@ interface AppEventsHandlerLoadedData {
|
|
|
1028
1028
|
declare class AppEventsHandler {
|
|
1029
1029
|
readonly commandkit: CommandKit;
|
|
1030
1030
|
/**
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1031
|
+
* @private
|
|
1032
|
+
* @internal
|
|
1033
|
+
*/
|
|
1034
1034
|
private loadedEvents;
|
|
1035
1035
|
/**
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1036
|
+
* Creates a new AppEventsHandler instance.
|
|
1037
|
+
* @param commandkit - The CommandKit instance
|
|
1038
|
+
*/
|
|
1039
1039
|
constructor(commandkit: CommandKit);
|
|
1040
1040
|
/**
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1041
|
+
* Gets information about all loaded events.
|
|
1042
|
+
* @returns Array of loaded event data
|
|
1043
|
+
*/
|
|
1044
1044
|
getEvents(): AppEventsHandlerLoadedData[];
|
|
1045
1045
|
/**
|
|
1046
|
-
|
|
1047
|
-
|
|
1046
|
+
* Reloads all events by unregistering existing ones and loading them again.
|
|
1047
|
+
*/
|
|
1048
1048
|
reloadEvents(): Promise<void>;
|
|
1049
1049
|
/**
|
|
1050
|
-
|
|
1051
|
-
|
|
1050
|
+
* Loads all events from the events router and registers them with Discord.js client.
|
|
1051
|
+
*/
|
|
1052
1052
|
loadEvents(): Promise<void>;
|
|
1053
1053
|
/**
|
|
1054
|
-
|
|
1055
|
-
|
|
1054
|
+
* Unregisters all event listeners and clears loaded events.
|
|
1055
|
+
*/
|
|
1056
1056
|
unregisterAll(): void;
|
|
1057
1057
|
/**
|
|
1058
|
-
|
|
1059
|
-
|
|
1058
|
+
* Registers all loaded events with the Discord.js client and CommandKit event system.
|
|
1059
|
+
*/
|
|
1060
1060
|
registerAllClientEvents(): void;
|
|
1061
1061
|
/**
|
|
1062
|
-
|
|
1063
|
-
|
|
1062
|
+
* Unregisters all client event listeners and cleans up loaded events.
|
|
1063
|
+
*/
|
|
1064
1064
|
unregisterAllClientListeners(): void;
|
|
1065
1065
|
}
|
|
1066
1066
|
//#endregion
|
|
@@ -1070,16 +1070,16 @@ declare class AppEventsHandler {
|
|
|
1070
1070
|
*/
|
|
1071
1071
|
interface IpcMessageCommand {
|
|
1072
1072
|
/**
|
|
1073
|
-
|
|
1074
|
-
|
|
1073
|
+
* The type of HMR event being communicated.
|
|
1074
|
+
*/
|
|
1075
1075
|
event: HMREventType;
|
|
1076
1076
|
/**
|
|
1077
|
-
|
|
1078
|
-
|
|
1077
|
+
* The path associated with the HMR event.
|
|
1078
|
+
*/
|
|
1079
1079
|
path: string;
|
|
1080
1080
|
/**
|
|
1081
|
-
|
|
1082
|
-
|
|
1081
|
+
* An optional identifier for the HMR event, used for acknowledgment.
|
|
1082
|
+
*/
|
|
1083
1083
|
id?: string;
|
|
1084
1084
|
}
|
|
1085
1085
|
/**
|
|
@@ -1087,22 +1087,22 @@ interface IpcMessageCommand {
|
|
|
1087
1087
|
*/
|
|
1088
1088
|
interface CommandKitHMREvent {
|
|
1089
1089
|
/**
|
|
1090
|
-
|
|
1091
|
-
|
|
1090
|
+
* The type of HMR event.
|
|
1091
|
+
*/
|
|
1092
1092
|
event: HMREventType;
|
|
1093
1093
|
/**
|
|
1094
|
-
|
|
1095
|
-
|
|
1094
|
+
* The path associated with the HMR event.
|
|
1095
|
+
*/
|
|
1096
1096
|
path: string;
|
|
1097
1097
|
/**
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1098
|
+
* Accepts the HMR event, indicating that it has been handled.
|
|
1099
|
+
* This prevents further processing of the event.
|
|
1100
|
+
*/
|
|
1101
1101
|
accept: () => void;
|
|
1102
1102
|
/**
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1103
|
+
* Prevents the default action for the HMR event.
|
|
1104
|
+
* This can be used to stop further processing of the event.
|
|
1105
|
+
*/
|
|
1106
1106
|
preventDefault: () => void;
|
|
1107
1107
|
}
|
|
1108
1108
|
/**
|
|
@@ -1119,106 +1119,106 @@ declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> ex
|
|
|
1119
1119
|
readonly type = PluginType.Runtime;
|
|
1120
1120
|
readonly preload: Set<string>;
|
|
1121
1121
|
/**
|
|
1122
|
-
|
|
1123
|
-
|
|
1122
|
+
* Called before commands are loaded
|
|
1123
|
+
*/
|
|
1124
1124
|
onBeforeCommandsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1125
1125
|
/**
|
|
1126
|
-
|
|
1127
|
-
|
|
1126
|
+
* Called after commands are loaded
|
|
1127
|
+
*/
|
|
1128
1128
|
onAfterCommandsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1129
1129
|
/**
|
|
1130
|
-
|
|
1131
|
-
|
|
1130
|
+
* Called before events are loaded
|
|
1131
|
+
*/
|
|
1132
1132
|
onBeforeEventsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1133
1133
|
/**
|
|
1134
|
-
|
|
1135
|
-
|
|
1134
|
+
* Called after events are loaded
|
|
1135
|
+
*/
|
|
1136
1136
|
onAfterEventsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1137
1137
|
/**
|
|
1138
|
-
|
|
1139
|
-
|
|
1138
|
+
* Called before the client logs in
|
|
1139
|
+
*/
|
|
1140
1140
|
onBeforeClientLogin(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1141
1141
|
/**
|
|
1142
|
-
|
|
1143
|
-
|
|
1142
|
+
* Called after the client logs in
|
|
1143
|
+
*/
|
|
1144
1144
|
onAfterClientLogin(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1145
1145
|
/**
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1146
|
+
* Called before interaction is handled
|
|
1147
|
+
* @param interaction The interaction
|
|
1148
|
+
*/
|
|
1149
1149
|
onBeforeInteraction(ctx: CommandKitPluginRuntime, interaction: Interaction): Promise<void>;
|
|
1150
1150
|
/**
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1151
|
+
* Called before message command is processed
|
|
1152
|
+
* @param message The message
|
|
1153
|
+
*/
|
|
1154
1154
|
onBeforeMessageCommand(ctx: CommandKitPluginRuntime, message: Message): Promise<void>;
|
|
1155
1155
|
/**
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1156
|
+
* Called before command is executed. This method can execute the command itself.
|
|
1157
|
+
* @param source The source that triggered the command
|
|
1158
|
+
* @param command The command
|
|
1159
|
+
* @param execute The function that executes the command
|
|
1160
|
+
*/
|
|
1161
1161
|
executeCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment, source: Interaction | Message, command: PreparedAppCommandExecution, execute: () => Promise<any>): Promise<boolean>;
|
|
1162
1162
|
/**
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1163
|
+
* Called after events router is initialized
|
|
1164
|
+
* @param ctx The context
|
|
1165
|
+
*/
|
|
1166
1166
|
onEventsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1167
1167
|
/**
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1168
|
+
* Called after commands router is initialized
|
|
1169
|
+
* @param ctx The context
|
|
1170
|
+
*/
|
|
1171
1171
|
onCommandsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1172
1172
|
/**
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1173
|
+
* Called when HMR event is received
|
|
1174
|
+
* @param ctx The context
|
|
1175
|
+
* @param event The event
|
|
1176
|
+
*/
|
|
1177
1177
|
performHMR(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent): Promise<void>;
|
|
1178
1178
|
/**
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1179
|
+
* Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.
|
|
1180
|
+
* @param ctx The context
|
|
1181
|
+
* @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command
|
|
1182
|
+
*/
|
|
1183
1183
|
prepareCommand(ctx: CommandKitPluginRuntime, commands: CommandBuilderLike): Promise<CommandBuilderLike | null>;
|
|
1184
1184
|
/**
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1185
|
+
* Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.
|
|
1186
|
+
* @param ctx The context
|
|
1187
|
+
* @param data The command registration data
|
|
1188
|
+
*/
|
|
1189
1189
|
onBeforeRegisterCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1190
1190
|
/**
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1191
|
+
* Called before global commands registration. This method can cancel the registration of the command and handle it manually.
|
|
1192
|
+
* This method is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
1193
|
+
* @param ctx The context
|
|
1194
|
+
* @param event The command registration data
|
|
1195
|
+
*/
|
|
1196
1196
|
onBeforeRegisterGlobalCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1197
1197
|
/**
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1198
|
+
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
1199
|
+
* This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
1200
|
+
* @param ctx The context
|
|
1201
|
+
* @param event The command registration data
|
|
1202
|
+
*/
|
|
1203
1203
|
onBeforePrepareGuildCommandsRegistration(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1204
1204
|
/**
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1205
|
+
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
1206
|
+
* This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.
|
|
1207
|
+
* @param ctx The context
|
|
1208
|
+
* @param event The command registration data
|
|
1209
|
+
*/
|
|
1210
1210
|
onBeforeRegisterGuildCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1211
1211
|
/**
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1212
|
+
* Called after command and all of its deferred functions are executed.
|
|
1213
|
+
* @param ctx The context
|
|
1214
|
+
* @param env The environment of the command. This environment contains the command execution data such as command context and more.
|
|
1215
|
+
*/
|
|
1216
1216
|
onAfterCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment): Promise<void>;
|
|
1217
1217
|
/**
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1218
|
+
* Called before emitting an event
|
|
1219
|
+
* @param ctx The context
|
|
1220
|
+
* @param event The event that is being emitted
|
|
1221
|
+
*/
|
|
1222
1222
|
willEmitEvent(ctx: CommandKitPluginRuntime, event: CommandKitEventDispatch): Promise<void>;
|
|
1223
1223
|
}
|
|
1224
1224
|
declare function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin;
|
|
@@ -1237,28 +1237,28 @@ type MaybeFalsey<T> = T | false | null | undefined;
|
|
|
1237
1237
|
*/
|
|
1238
1238
|
interface CommandKitEventDispatch {
|
|
1239
1239
|
/**
|
|
1240
|
-
|
|
1241
|
-
|
|
1240
|
+
* The name of the event.
|
|
1241
|
+
*/
|
|
1242
1242
|
name: string;
|
|
1243
1243
|
/**
|
|
1244
|
-
|
|
1245
|
-
|
|
1244
|
+
* The arguments passed to the event.
|
|
1245
|
+
*/
|
|
1246
1246
|
args: unknown[];
|
|
1247
1247
|
/**
|
|
1248
|
-
|
|
1249
|
-
|
|
1248
|
+
* The namespace of the event, if any.
|
|
1249
|
+
*/
|
|
1250
1250
|
namespace: string | null;
|
|
1251
1251
|
/**
|
|
1252
|
-
|
|
1253
|
-
|
|
1252
|
+
* If this event runs only once, it will be set to true.
|
|
1253
|
+
*/
|
|
1254
1254
|
once: boolean;
|
|
1255
1255
|
/**
|
|
1256
|
-
|
|
1257
|
-
|
|
1256
|
+
* The additional metadata associated with the event.
|
|
1257
|
+
*/
|
|
1258
1258
|
metadata: ParsedEvent;
|
|
1259
1259
|
/**
|
|
1260
|
-
|
|
1261
|
-
|
|
1260
|
+
* Captures the owner of the event, preventing other plugins from handling it.
|
|
1261
|
+
*/
|
|
1262
1262
|
accept(): void;
|
|
1263
1263
|
}
|
|
1264
1264
|
/**
|
|
@@ -1273,22 +1273,22 @@ type TemplateHandler = (args: string[]) => Promise<void> | void;
|
|
|
1273
1273
|
*/
|
|
1274
1274
|
interface PluginTransformParameters {
|
|
1275
1275
|
/**
|
|
1276
|
-
|
|
1277
|
-
|
|
1276
|
+
* The code to be transformed.
|
|
1277
|
+
*/
|
|
1278
1278
|
code: string;
|
|
1279
1279
|
/**
|
|
1280
|
-
|
|
1281
|
-
|
|
1280
|
+
* The filename of the code being transformed.
|
|
1281
|
+
*/
|
|
1282
1282
|
id: string;
|
|
1283
1283
|
}
|
|
1284
1284
|
interface TransformedResult {
|
|
1285
1285
|
/**
|
|
1286
|
-
|
|
1287
|
-
|
|
1286
|
+
* The transformed code.
|
|
1287
|
+
*/
|
|
1288
1288
|
code?: string;
|
|
1289
1289
|
/**
|
|
1290
|
-
|
|
1291
|
-
|
|
1290
|
+
* The source map for the transformed code, if applicable.
|
|
1291
|
+
*/
|
|
1292
1292
|
map?: string | null;
|
|
1293
1293
|
}
|
|
1294
1294
|
/**
|
|
@@ -1296,14 +1296,14 @@ interface TransformedResult {
|
|
|
1296
1296
|
*/
|
|
1297
1297
|
declare abstract class CompilerPlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CompilerPluginRuntime> {
|
|
1298
1298
|
/**
|
|
1299
|
-
|
|
1300
|
-
|
|
1299
|
+
* The type of the plugin, which is Compiler.
|
|
1300
|
+
*/
|
|
1301
1301
|
readonly type = PluginType.Compiler;
|
|
1302
1302
|
/**
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1303
|
+
* Called when transformation is requested to this plugin
|
|
1304
|
+
* @param params The parameters for the transformation
|
|
1305
|
+
* @returns The transformed result
|
|
1306
|
+
*/
|
|
1307
1307
|
transform(params: PluginTransformParameters): Promise<MaybeFalsey<TransformedResult>>;
|
|
1308
1308
|
}
|
|
1309
1309
|
/**
|
|
@@ -1319,9 +1319,9 @@ declare function isCompilerPlugin(plugin: unknown): plugin is CompilerPlugin;
|
|
|
1319
1319
|
*/
|
|
1320
1320
|
type CommonDirectiveTransformerOptions = DirectiveTransformerOptions & {
|
|
1321
1321
|
/**
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1322
|
+
* Whether the directive transformer is enabled.
|
|
1323
|
+
* Defaults to true.
|
|
1324
|
+
*/
|
|
1325
1325
|
enabled?: boolean;
|
|
1326
1326
|
};
|
|
1327
1327
|
/**
|
|
@@ -1346,69 +1346,69 @@ declare class CompilerPluginRuntime {
|
|
|
1346
1346
|
private initialized;
|
|
1347
1347
|
private templates;
|
|
1348
1348
|
/**
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1349
|
+
* Creates a new instance of CompilerPluginRuntime.
|
|
1350
|
+
* @param plugins An array of compiler plugins to be managed by this runtime.
|
|
1351
|
+
* @param isDevMode Whether the build is in development mode.
|
|
1352
|
+
*/
|
|
1353
1353
|
constructor(plugins: CompilerPlugin[], isDevMode: boolean);
|
|
1354
1354
|
/**
|
|
1355
|
-
|
|
1356
|
-
|
|
1355
|
+
* Returns the plugins managed by this runtime.
|
|
1356
|
+
*/
|
|
1357
1357
|
getPlugins(): CompilerPlugin<PluginOptions>[];
|
|
1358
1358
|
/**
|
|
1359
|
-
|
|
1360
|
-
|
|
1359
|
+
* Checks if there are no plugins registered in this runtime.
|
|
1360
|
+
*/
|
|
1361
1361
|
isEmpty(): boolean;
|
|
1362
1362
|
/**
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1363
|
+
* Registers a template handler for a given name.
|
|
1364
|
+
* This method must be called inside the activate() method of a plugin.
|
|
1365
|
+
* @param name - The name of the template to register.
|
|
1366
|
+
* @param handler - The handler function for the template.
|
|
1367
|
+
*/
|
|
1368
1368
|
registerTemplate(name: string, handler: TemplateHandler): void;
|
|
1369
1369
|
/**
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1370
|
+
* Unregister a template handler for a given name.
|
|
1371
|
+
* This method must be called inside the deactivate() method of a plugin.
|
|
1372
|
+
* @param name - The name of the template to unregister.
|
|
1373
|
+
*/
|
|
1374
1374
|
unregisterTemplate(name: string): void;
|
|
1375
1375
|
/**
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1376
|
+
* Retrieves a template handler by its name.
|
|
1377
|
+
* @param name - The name of the template to retrieve.
|
|
1378
|
+
* @returns The template handler if found, otherwise undefined.
|
|
1379
|
+
*/
|
|
1380
1380
|
getTemplate(name: string): TemplateHandler | undefined;
|
|
1381
1381
|
/**
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1382
|
+
* Returns a map of all registered templates with their handlers.
|
|
1383
|
+
* The keys are the template names and the values are the template handlers.
|
|
1384
|
+
*/
|
|
1385
1385
|
getTemplates(): Map<string, TemplateHandler>;
|
|
1386
1386
|
/**
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1387
|
+
* Transforms the given code using all registered plugins.
|
|
1388
|
+
* Each plugin's transform method is called in sequence, allowing them to modify the code.
|
|
1389
|
+
* @param code - The code to be transformed.
|
|
1390
|
+
* @param id - The identifier for the code being transformed (e.g., filename).
|
|
1391
|
+
* @returns An object containing the transformed code and an optional source map.
|
|
1392
|
+
*/
|
|
1393
1393
|
transform(code: string, id: string): Promise<{
|
|
1394
1394
|
code: string;
|
|
1395
1395
|
map: string | null;
|
|
1396
1396
|
}>;
|
|
1397
1397
|
/**
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1398
|
+
* Initializes the plugin runtime by activating all registered plugins.
|
|
1399
|
+
* This method should be called once to set up the plugins.
|
|
1400
|
+
*/
|
|
1401
1401
|
init(): Promise<void>;
|
|
1402
1402
|
/**
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1403
|
+
* Destroys the plugin runtime by deactivating all registered plugins.
|
|
1404
|
+
* This method should be called when the runtime is no longer needed.
|
|
1405
|
+
*/
|
|
1406
1406
|
destroy(): Promise<void>;
|
|
1407
1407
|
/**
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1408
|
+
* Converts the plugin runtime to a JSON representation.
|
|
1409
|
+
* This is useful for serialization or debugging purposes.
|
|
1410
|
+
* @returns An object containing the name of the runtime and the transform method.
|
|
1411
|
+
*/
|
|
1412
1412
|
toJSON(): {
|
|
1413
1413
|
name: string;
|
|
1414
1414
|
transform: (code: string, id: string) => Promise<{
|
|
@@ -1444,32 +1444,32 @@ declare enum PluginType {
|
|
|
1444
1444
|
declare abstract class PluginCommon<T extends PluginOptions = PluginOptions, C extends CommonPluginRuntime = CommonPluginRuntime> {
|
|
1445
1445
|
protected readonly options: T;
|
|
1446
1446
|
/**
|
|
1447
|
-
|
|
1448
|
-
|
|
1447
|
+
* The type of the plugin, either Compiler or Runtime.
|
|
1448
|
+
*/
|
|
1449
1449
|
abstract readonly type: PluginType;
|
|
1450
1450
|
/**
|
|
1451
|
-
|
|
1452
|
-
|
|
1451
|
+
* Unique identifier for the plugin instance.
|
|
1452
|
+
*/
|
|
1453
1453
|
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
1454
1454
|
/**
|
|
1455
|
-
|
|
1456
|
-
|
|
1455
|
+
* The time when the plugin was loaded, in milliseconds since the Unix epoch.
|
|
1456
|
+
*/
|
|
1457
1457
|
readonly loadedAt: number;
|
|
1458
1458
|
/**
|
|
1459
|
-
|
|
1460
|
-
|
|
1459
|
+
* The name of the plugin.
|
|
1460
|
+
*/
|
|
1461
1461
|
abstract readonly name: string;
|
|
1462
1462
|
/**
|
|
1463
|
-
|
|
1464
|
-
|
|
1463
|
+
* Creates a new instance of the plugin.
|
|
1464
|
+
*/
|
|
1465
1465
|
constructor(options: T);
|
|
1466
1466
|
/**
|
|
1467
|
-
|
|
1468
|
-
|
|
1467
|
+
* Called when this plugin is activated
|
|
1468
|
+
*/
|
|
1469
1469
|
activate(ctx: C): Promise<void>;
|
|
1470
1470
|
/**
|
|
1471
|
-
|
|
1472
|
-
|
|
1471
|
+
* Called when this plugin is deactivated
|
|
1472
|
+
*/
|
|
1473
1473
|
deactivate(ctx: C): Promise<void>;
|
|
1474
1474
|
}
|
|
1475
1475
|
/**
|
|
@@ -1487,61 +1487,61 @@ declare class CommandKitPluginRuntime {
|
|
|
1487
1487
|
readonly commandkit: CommandKit;
|
|
1488
1488
|
private plugins;
|
|
1489
1489
|
/**
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1490
|
+
* Creates a new instance of CommandKitPluginRuntime.
|
|
1491
|
+
* @param commandkit The CommandKit instance associated with this runtime.
|
|
1492
|
+
*/
|
|
1493
1493
|
constructor(commandkit: CommandKit);
|
|
1494
1494
|
/**
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1495
|
+
* Returns the plugins registered in this runtime.
|
|
1496
|
+
* @returns A collection of plugins.
|
|
1497
|
+
*/
|
|
1498
1498
|
getPlugins(): Collection<string, RuntimePlugin<PluginOptions>>;
|
|
1499
1499
|
/**
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1500
|
+
* Checks if there are no plugins registered in this runtime.
|
|
1501
|
+
* @param pluginName The name of the plugin to check.
|
|
1502
|
+
* @returns Boolean indicating whether the runtime is empty.
|
|
1503
|
+
*/
|
|
1504
1504
|
getPlugin(pluginName: string): RuntimePlugin | null;
|
|
1505
1505
|
/**
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1506
|
+
* Fetches the given plugin
|
|
1507
|
+
* @param plugin The plugin to be fetched.
|
|
1508
|
+
*/
|
|
1509
1509
|
get<T extends Constructable<any>>(plugin: T): InstanceType<T> | null;
|
|
1510
1510
|
/**
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1511
|
+
* Pre-loads the specified entrypoints for the given plugin.
|
|
1512
|
+
* @param plugin The plugin to pre-load.
|
|
1513
|
+
*/
|
|
1514
1514
|
preload(plugin: RuntimePlugin): Promise<void>;
|
|
1515
1515
|
/**
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1516
|
+
* Soft registers a plugin in the runtime.
|
|
1517
|
+
* @param plugin The plugin to be registered.
|
|
1518
|
+
*/
|
|
1519
1519
|
softRegisterPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
1520
1520
|
/**
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1521
|
+
* Registers a plugin in the runtime.
|
|
1522
|
+
* @param plugin The plugin to be registered.
|
|
1523
|
+
* @throws If a plugin with the same name already exists.
|
|
1524
|
+
*/
|
|
1525
1525
|
registerPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
1526
1526
|
/**
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1527
|
+
* Unregisters a plugin from the runtime.
|
|
1528
|
+
* @param plugin The plugin to be unregistered.
|
|
1529
|
+
* @throws If the plugin does not exist.
|
|
1530
|
+
*/
|
|
1531
1531
|
unregisterPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
1532
1532
|
/**
|
|
1533
|
-
|
|
1534
|
-
|
|
1533
|
+
* Unregisters all plugins from the runtime.
|
|
1534
|
+
*/
|
|
1535
1535
|
unregisterAllPlugins(): Promise<void>;
|
|
1536
1536
|
/**
|
|
1537
|
-
|
|
1538
|
-
|
|
1537
|
+
* Signals the runtime to allow the current plugin take ownership of the execution context.
|
|
1538
|
+
*/
|
|
1539
1539
|
capture(): void;
|
|
1540
1540
|
/**
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1541
|
+
* Executes a function for each plugin in the runtime.
|
|
1542
|
+
* @param f The function to execute for each plugin.
|
|
1543
|
+
* @returns The result of the last executed function, or undefined if no plugins were executed.
|
|
1544
|
+
*/
|
|
1545
1545
|
execute<R = any>(f: AsyncFunction<[CommandKitPluginRuntime, RuntimePlugin], R | undefined>): Promise<true | R | undefined>;
|
|
1546
1546
|
}
|
|
1547
1547
|
//#endregion
|
|
@@ -1553,24 +1553,24 @@ declare class CommandKitPluginRuntime {
|
|
|
1553
1553
|
*/
|
|
1554
1554
|
interface FlagProvider {
|
|
1555
1555
|
/**
|
|
1556
|
-
|
|
1557
|
-
|
|
1556
|
+
* Initialize the provider (e.g., establish connections, load initial config)
|
|
1557
|
+
*/
|
|
1558
1558
|
initialize?(): MaybePromise<void>;
|
|
1559
1559
|
/**
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1560
|
+
* Get the current value/configuration for a feature flag
|
|
1561
|
+
* @param key - The feature flag key
|
|
1562
|
+
* @param context - Optional context for flag evaluation
|
|
1563
|
+
* @returns The flag configuration or null if not found
|
|
1564
|
+
*/
|
|
1565
1565
|
getFlag(key: string, context?: any): MaybePromise<FlagConfiguration | null>;
|
|
1566
1566
|
/**
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1567
|
+
* Check if a flag exists in the external system
|
|
1568
|
+
* @param key - The feature flag key
|
|
1569
|
+
*/
|
|
1570
1570
|
hasFlag(key: string): MaybePromise<boolean>;
|
|
1571
1571
|
/**
|
|
1572
|
-
|
|
1573
|
-
|
|
1572
|
+
* Cleanup resources when the provider is no longer needed
|
|
1573
|
+
*/
|
|
1574
1574
|
destroy?(): MaybePromise<void>;
|
|
1575
1575
|
}
|
|
1576
1576
|
/**
|
|
@@ -1578,20 +1578,20 @@ interface FlagProvider {
|
|
|
1578
1578
|
*/
|
|
1579
1579
|
interface FlagConfiguration {
|
|
1580
1580
|
/**
|
|
1581
|
-
|
|
1582
|
-
|
|
1581
|
+
* Whether the flag is enabled/disabled at the provider level
|
|
1582
|
+
*/
|
|
1583
1583
|
enabled: boolean;
|
|
1584
1584
|
/**
|
|
1585
|
-
|
|
1586
|
-
|
|
1585
|
+
* Optional configuration data that can be used in the decide function
|
|
1586
|
+
*/
|
|
1587
1587
|
config?: Record<string, any>;
|
|
1588
1588
|
/**
|
|
1589
|
-
|
|
1590
|
-
|
|
1589
|
+
* Optional percentage for gradual rollouts (0-100)
|
|
1590
|
+
*/
|
|
1591
1591
|
percentage?: number;
|
|
1592
1592
|
/**
|
|
1593
|
-
|
|
1594
|
-
|
|
1593
|
+
* Optional targeting rules or segments
|
|
1594
|
+
*/
|
|
1595
1595
|
targeting?: {
|
|
1596
1596
|
segments?: string[];
|
|
1597
1597
|
rules?: Array<{
|
|
@@ -1647,30 +1647,30 @@ type DecideFunction<E, R> = (data: {
|
|
|
1647
1647
|
*/
|
|
1648
1648
|
interface FeatureFlagDefinition<R, Entity> {
|
|
1649
1649
|
/**
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1650
|
+
* Unique key for the feature flag.
|
|
1651
|
+
* Should be a string that identifies the flag.
|
|
1652
|
+
*/
|
|
1653
1653
|
key: string;
|
|
1654
1654
|
/**
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1655
|
+
* Optional description of the feature flag.
|
|
1656
|
+
* This can be used for documentation or debugging purposes.
|
|
1657
|
+
*/
|
|
1658
1658
|
description?: string;
|
|
1659
1659
|
/**
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1660
|
+
* Optional flag to enable integration with an external flag provider.
|
|
1661
|
+
* If true, the flag will use the global flag provider to determine its state.
|
|
1662
|
+
* Default: false
|
|
1663
|
+
*/
|
|
1664
1664
|
identify?: IdentifyFunction<Entity>;
|
|
1665
1665
|
/**
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1666
|
+
* Function to decide the outcome of the feature flag.
|
|
1667
|
+
* This function receives the identified entities and should return the result of the decision.
|
|
1668
|
+
*/
|
|
1669
1669
|
decide: DecideFunction<Entity, R>;
|
|
1670
1670
|
/**
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1671
|
+
* Whether to disable analytics tracking for this flag.
|
|
1672
|
+
* Default: false
|
|
1673
|
+
*/
|
|
1674
1674
|
disableAnalytics?: boolean;
|
|
1675
1675
|
}
|
|
1676
1676
|
/**
|
|
@@ -1678,49 +1678,49 @@ interface FeatureFlagDefinition<R, Entity> {
|
|
|
1678
1678
|
*/
|
|
1679
1679
|
interface CommandFlagContext {
|
|
1680
1680
|
/**
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1681
|
+
* The Discord client instance.
|
|
1682
|
+
* This is the main entry point for interacting with the Discord API.
|
|
1683
|
+
*/
|
|
1684
1684
|
client: Client<true>;
|
|
1685
1685
|
/**
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1686
|
+
* The CommandKit instance, which provides access to the command framework.
|
|
1687
|
+
* This includes commands, events, and other features of CommandKit.
|
|
1688
|
+
*/
|
|
1689
1689
|
commandkit: CommandKit;
|
|
1690
1690
|
/**
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1691
|
+
* The command context, which includes information about the command being executed.
|
|
1692
|
+
* This can include the interaction, message, guild, channel, and the loaded command.
|
|
1693
|
+
*/
|
|
1694
1694
|
command: {
|
|
1695
1695
|
/**
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1696
|
+
* The interaction object if the command was invoked via an interaction.
|
|
1697
|
+
* This can be a ChatInputCommandInteraction, AutocompleteInteraction, or ContextMenuCommandInteraction.
|
|
1698
|
+
*/
|
|
1699
1699
|
interaction?: ChatInputCommandInteraction | AutocompleteInteraction | ContextMenuCommandInteraction;
|
|
1700
1700
|
/**
|
|
1701
|
-
|
|
1702
|
-
|
|
1701
|
+
* The message object if the command was invoked via a message.
|
|
1702
|
+
*/
|
|
1703
1703
|
message?: Message;
|
|
1704
1704
|
/**
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1705
|
+
* The guild where the command was invoked, if applicable.
|
|
1706
|
+
* This will be null for commands invoked in DMs.
|
|
1707
|
+
*/
|
|
1708
1708
|
guild: Guild | null;
|
|
1709
1709
|
/**
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1710
|
+
* The channel where the command was invoked.
|
|
1711
|
+
* This can be a text channel, DM channel, or any other type of text-based channel.
|
|
1712
|
+
*/
|
|
1713
1713
|
channel: TextBasedChannel | null;
|
|
1714
1714
|
/**
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1715
|
+
* The loaded command instance that is being executed.
|
|
1716
|
+
* This contains the command's metadata and logic.
|
|
1717
|
+
*/
|
|
1718
1718
|
command: LoadedCommand;
|
|
1719
1719
|
};
|
|
1720
1720
|
/**
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1721
|
+
* The event context is null for command flags, as they are not tied to a specific event.
|
|
1722
|
+
* This is used to differentiate between command and event flags.
|
|
1723
|
+
*/
|
|
1724
1724
|
event: null;
|
|
1725
1725
|
}
|
|
1726
1726
|
/**
|
|
@@ -1728,53 +1728,53 @@ interface CommandFlagContext {
|
|
|
1728
1728
|
*/
|
|
1729
1729
|
interface EventFlagContext {
|
|
1730
1730
|
/**
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1731
|
+
* The Discord client instance.
|
|
1732
|
+
* This is the main entry point for interacting with the Discord API.
|
|
1733
|
+
*/
|
|
1734
1734
|
client: Client<true>;
|
|
1735
1735
|
/**
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1736
|
+
* The CommandKit instance, which provides access to the command framework.
|
|
1737
|
+
* This includes commands, events, and other features of CommandKit.
|
|
1738
|
+
*/
|
|
1739
1739
|
commandkit: CommandKit;
|
|
1740
1740
|
/**
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1741
|
+
* The event context, which includes information about the event being processed.
|
|
1742
|
+
* This can include the parsed event data, the event name, and the namespace if applicable.
|
|
1743
|
+
*/
|
|
1744
1744
|
event: {
|
|
1745
1745
|
/**
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1746
|
+
* The parsed event data, which contains the raw data from the event.
|
|
1747
|
+
* This can include information like user IDs, channel IDs, and other relevant data.
|
|
1748
|
+
*/
|
|
1749
1749
|
data: ParsedEvent;
|
|
1750
1750
|
/**
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1751
|
+
* The name of the event being processed.
|
|
1752
|
+
* This is the string identifier for the event, such as 'messageCreate' or 'guildMemberAdd'.
|
|
1753
|
+
*/
|
|
1754
1754
|
event: string;
|
|
1755
1755
|
/**
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1756
|
+
* The namespace of the event, if applicable.
|
|
1757
|
+
* This can be used to group related events or commands together.
|
|
1758
|
+
* It is null if the event does not belong to a specific namespace.
|
|
1759
|
+
*/
|
|
1760
1760
|
namespace: string | null;
|
|
1761
1761
|
/**
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1762
|
+
* The arguments passed to the event handler.
|
|
1763
|
+
* This is an array of arguments that were passed when the event was triggered.
|
|
1764
|
+
* It can be used to access specific data related to the event.
|
|
1765
|
+
*/
|
|
1766
1766
|
arguments: any[];
|
|
1767
1767
|
/**
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1768
|
+
* A function to retrieve the arguments for a specific event type.
|
|
1769
|
+
* This allows for type-safe access to the arguments based on the event name.
|
|
1770
|
+
* @param event - The name of the event to retrieve arguments for.
|
|
1771
|
+
*/
|
|
1772
1772
|
argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E];
|
|
1773
1773
|
};
|
|
1774
1774
|
/**
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1775
|
+
* The command context is null for event flags, as they are not tied to a specific command.
|
|
1776
|
+
* This is used to differentiate between command and event flags.
|
|
1777
|
+
*/
|
|
1778
1778
|
command: null;
|
|
1779
1779
|
}
|
|
1780
1780
|
/**
|
|
@@ -1794,25 +1794,25 @@ type CustomEvaluationFunction<E> = () => MaybePromise<E>;
|
|
|
1794
1794
|
*/
|
|
1795
1795
|
type CustomEvaluationContext<E> = {
|
|
1796
1796
|
/**
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1797
|
+
* Optional function to identify the entities for evaluation.
|
|
1798
|
+
* This can be a function that returns the entities based on the current context.
|
|
1799
|
+
*/
|
|
1800
1800
|
identify: E | CustomEvaluationFunction<E>;
|
|
1801
1801
|
};
|
|
1802
1802
|
interface FlagRunner<E, R> {
|
|
1803
1803
|
/**
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1804
|
+
* Execute the feature flag evaluation with the provided entities.
|
|
1805
|
+
* This method will run the identify and decide functions to determine the flag's outcome.
|
|
1806
|
+
* @param res - Optional entities to use for evaluation. If not provided, it will call the identify function.
|
|
1807
|
+
* @returns A promise that resolves to the result of the feature flag evaluation.
|
|
1808
|
+
*/
|
|
1809
1809
|
(): Promise<R>;
|
|
1810
1810
|
/**
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1811
|
+
* Run the feature flag evaluation with a custom context.
|
|
1812
|
+
* This allows for more flexible evaluation based on custom logic or external data.
|
|
1813
|
+
* @param context - The custom evaluation context containing the identify function or object.
|
|
1814
|
+
* @returns A promise that resolves to the result of the feature flag evaluation.
|
|
1815
|
+
*/
|
|
1816
1816
|
run(context: CustomEvaluationContext<E>): Promise<R>;
|
|
1817
1817
|
}
|
|
1818
1818
|
/**
|
|
@@ -1822,16 +1822,16 @@ declare class FeatureFlag<R, T> {
|
|
|
1822
1822
|
readonly options: FeatureFlagDefinition<R, T>;
|
|
1823
1823
|
private commandkit;
|
|
1824
1824
|
/**
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1825
|
+
* Create a new feature flag.
|
|
1826
|
+
* @param options - The options for the feature flag.
|
|
1827
|
+
*/
|
|
1828
1828
|
constructor(options: FeatureFlagDefinition<R, T>);
|
|
1829
1829
|
private getContext;
|
|
1830
1830
|
/**
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1831
|
+
* Execute the feature flag evaluation.
|
|
1832
|
+
* @param res - Optional entities to use for evaluation. If not provided, it will call the identify function.
|
|
1833
|
+
* @returns A promise that resolves to the result of the feature flag evaluation.
|
|
1834
|
+
*/
|
|
1835
1835
|
execute(res?: T): Promise<R>;
|
|
1836
1836
|
}
|
|
1837
1837
|
/**
|
|
@@ -1851,114 +1851,114 @@ declare class FlagStore extends Collection<string, FeatureFlag<any, any>> {}
|
|
|
1851
1851
|
//#region src/config/types.d.ts
|
|
1852
1852
|
interface CommandKitCompilerOptions {
|
|
1853
1853
|
/**
|
|
1854
|
-
|
|
1855
|
-
|
|
1854
|
+
* The macro compiler options to use with CommandKit.
|
|
1855
|
+
*/
|
|
1856
1856
|
macro?: {
|
|
1857
1857
|
/**
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1858
|
+
* Whether to enable macro function compilation in development mode.
|
|
1859
|
+
* @default false
|
|
1860
|
+
*/
|
|
1861
1861
|
development?: boolean;
|
|
1862
1862
|
};
|
|
1863
1863
|
/**
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
tsdown?: Partial<
|
|
1864
|
+
* The tsdown compiler options to use with CommandKit.
|
|
1865
|
+
* **DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING** as it alters the behavior of the build process.
|
|
1866
|
+
*/
|
|
1867
|
+
tsdown?: Partial<InlineConfig>;
|
|
1868
1868
|
/**
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1869
|
+
* Disables chunking of the output (production only, development never chunks).
|
|
1870
|
+
* @default false
|
|
1871
|
+
*/
|
|
1872
1872
|
disableChunking?: boolean;
|
|
1873
1873
|
}
|
|
1874
1874
|
interface CommandKitConfig {
|
|
1875
1875
|
/**
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1876
|
+
* The plugins to use with CommandKit.
|
|
1877
|
+
* Can be a single plugin, an array of plugins, or a nested array of plugins.
|
|
1878
|
+
*/
|
|
1879
1879
|
plugins?: MaybeArray<CommandKitPlugin>[] | Array<CommandKitPlugin>;
|
|
1880
1880
|
/**
|
|
1881
|
-
|
|
1882
|
-
|
|
1881
|
+
* The rolldown plugins to use with CommandKit.
|
|
1882
|
+
*/
|
|
1883
1883
|
rolldownPlugins?: any[];
|
|
1884
1884
|
/**
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1885
|
+
* The list of additional entrypoints to compile. Eg, `dir` or `dir/index.ts` or `dir/*.ts`, etc.
|
|
1886
|
+
* Similarly, negative patterns can be used to exclude files. Eg, `!dir/index.ts` or `!dir/*.ts`, etc.
|
|
1887
|
+
*/
|
|
1888
1888
|
entrypoints?: string[];
|
|
1889
1889
|
/**
|
|
1890
|
-
|
|
1891
|
-
|
|
1890
|
+
* The compiler options to use with CommandKit.
|
|
1891
|
+
*/
|
|
1892
1892
|
compilerOptions?: CommandKitCompilerOptions;
|
|
1893
1893
|
/**
|
|
1894
|
-
|
|
1895
|
-
|
|
1894
|
+
* The typescript configuration to use with CommandKit.
|
|
1895
|
+
*/
|
|
1896
1896
|
typescript?: {
|
|
1897
1897
|
/**
|
|
1898
|
-
|
|
1899
|
-
|
|
1898
|
+
* Whether to ignore type checking during builds.
|
|
1899
|
+
*/
|
|
1900
1900
|
ignoreBuildErrors?: boolean;
|
|
1901
1901
|
};
|
|
1902
1902
|
/**
|
|
1903
|
-
|
|
1904
|
-
|
|
1903
|
+
* Whether to generate static command handler data in production builds.
|
|
1904
|
+
*/
|
|
1905
1905
|
static?: boolean;
|
|
1906
1906
|
/**
|
|
1907
|
-
|
|
1908
|
-
|
|
1907
|
+
* Statically define the environment variables to use.
|
|
1908
|
+
*/
|
|
1909
1909
|
env?: Record<string, string>;
|
|
1910
1910
|
/**
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1911
|
+
* The custom build directory name to use.
|
|
1912
|
+
* @default `dist`
|
|
1913
|
+
*/
|
|
1914
1914
|
distDir?: string;
|
|
1915
1915
|
/**
|
|
1916
|
-
|
|
1917
|
-
|
|
1916
|
+
* The anti-crash script configuration.
|
|
1917
|
+
*/
|
|
1918
1918
|
antiCrashScript?: {
|
|
1919
1919
|
/**
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1920
|
+
* Whether to enable the anti-crash script in development mode.
|
|
1921
|
+
* @default true
|
|
1922
|
+
*/
|
|
1923
1923
|
development?: boolean;
|
|
1924
1924
|
/**
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1925
|
+
* Whether to enable the anti-crash script in production mode. Usually, you should use other means to handle errors.
|
|
1926
|
+
* @default false
|
|
1927
|
+
*/
|
|
1928
1928
|
production?: boolean;
|
|
1929
1929
|
};
|
|
1930
1930
|
/**
|
|
1931
|
-
|
|
1932
|
-
|
|
1931
|
+
* Whether or not to enable the source map generation.
|
|
1932
|
+
*/
|
|
1933
1933
|
sourceMap?: {
|
|
1934
1934
|
/**
|
|
1935
|
-
|
|
1936
|
-
|
|
1935
|
+
* Whether to enable source map generation in development mode.
|
|
1936
|
+
*/
|
|
1937
1937
|
development?: boolean;
|
|
1938
1938
|
/**
|
|
1939
|
-
|
|
1940
|
-
|
|
1939
|
+
* Whether to enable source map generation in production mode.
|
|
1940
|
+
*/
|
|
1941
1941
|
production?: boolean;
|
|
1942
1942
|
};
|
|
1943
1943
|
/**
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1944
|
+
* Whether or not to enable the typed commands.
|
|
1945
|
+
* @default true
|
|
1946
|
+
*/
|
|
1947
1947
|
typedCommands?: boolean;
|
|
1948
1948
|
/**
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1949
|
+
* Whether or not to disable the prefix commands.
|
|
1950
|
+
* @default false
|
|
1951
|
+
*/
|
|
1952
1952
|
disablePrefixCommands?: boolean;
|
|
1953
1953
|
/**
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1954
|
+
* Whether or not to disable the built-in permissions middleware. This only affects `botPermissions` and `userPermissions` in the command metadata.
|
|
1955
|
+
* @default false
|
|
1956
|
+
*/
|
|
1957
1957
|
disablePermissionsMiddleware?: boolean;
|
|
1958
1958
|
/**
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1959
|
+
* Whether or not to show a warning when a prefix command is not found. This only affects development mode.
|
|
1960
|
+
* @default true
|
|
1961
|
+
*/
|
|
1962
1962
|
showUnknownPrefixCommandsWarning?: boolean;
|
|
1963
1963
|
}
|
|
1964
1964
|
//#endregion
|
|
@@ -1990,16 +1990,16 @@ type ResolvedCommandKitConfig = DeepRequired<CommandKitConfig, 'compilerOptions'
|
|
|
1990
1990
|
*/
|
|
1991
1991
|
interface CommandKitConfiguration {
|
|
1992
1992
|
/**
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1993
|
+
* The default locale for the CommandKit instance. This will be used to infer the locale of the guild or user if it has not been set explicitly.
|
|
1994
|
+
* @default Locale.EnglishUS
|
|
1995
|
+
*/
|
|
1996
1996
|
defaultLocale: Locale;
|
|
1997
1997
|
/**
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
1998
|
+
* A function that returns the command prefix for a given message.
|
|
1999
|
+
* This is used to determine how to parse commands from messages.
|
|
2000
|
+
* @param message The message to get the command prefix for.
|
|
2001
|
+
* @returns The command prefix or an array of prefixes.
|
|
2002
|
+
*/
|
|
2003
2003
|
getMessageCommandPrefix: (message: Message) => Awaitable<string | string[] | RegExp>;
|
|
2004
2004
|
}
|
|
2005
2005
|
/**
|
|
@@ -2040,133 +2040,133 @@ declare function onApplicationBootstrap<F extends BootstrapFunction>(fn: F): voi
|
|
|
2040
2040
|
declare class CommandKit extends EventEmitter {
|
|
2041
2041
|
#private;
|
|
2042
2042
|
/**
|
|
2043
|
-
|
|
2044
|
-
|
|
2043
|
+
* The event interceptor to quickly register temporary event listeners
|
|
2044
|
+
*/
|
|
2045
2045
|
eventInterceptor: EventInterceptor;
|
|
2046
2046
|
/**
|
|
2047
|
-
|
|
2048
|
-
|
|
2047
|
+
* The static createElement function to create jsx elements
|
|
2048
|
+
*/
|
|
2049
2049
|
static readonly createElement: typeof createElement;
|
|
2050
2050
|
/**
|
|
2051
|
-
|
|
2052
|
-
|
|
2051
|
+
* The static Fragment component to create jsx fragments
|
|
2052
|
+
*/
|
|
2053
2053
|
static readonly Fragment: typeof Fragment;
|
|
2054
2054
|
/**
|
|
2055
|
-
|
|
2056
|
-
|
|
2055
|
+
* The configuration for the CommandKit instance.
|
|
2056
|
+
*/
|
|
2057
2057
|
readonly appConfig: CommandKitConfiguration;
|
|
2058
2058
|
/**
|
|
2059
|
-
|
|
2060
|
-
|
|
2059
|
+
* The configuration for the CommandKit environment.
|
|
2060
|
+
*/
|
|
2061
2061
|
config: ResolvedCommandKitConfig;
|
|
2062
2062
|
/**
|
|
2063
|
-
|
|
2064
|
-
|
|
2063
|
+
* A key-value store for storing arbitrary data.
|
|
2064
|
+
*/
|
|
2065
2065
|
readonly store: Map<string, any>;
|
|
2066
2066
|
/**
|
|
2067
|
-
|
|
2068
|
-
|
|
2067
|
+
* A flag store for storing flags that can be used to enable or disable features.
|
|
2068
|
+
*/
|
|
2069
2069
|
readonly flags: FlagStore;
|
|
2070
2070
|
/**
|
|
2071
|
-
|
|
2072
|
-
|
|
2071
|
+
* The command router for the CommandKit instance.
|
|
2072
|
+
*/
|
|
2073
2073
|
commandsRouter: CommandsRouter;
|
|
2074
2074
|
/**
|
|
2075
|
-
|
|
2076
|
-
|
|
2075
|
+
* The events router for the CommandKit instance.
|
|
2076
|
+
*/
|
|
2077
2077
|
eventsRouter: EventsRouter;
|
|
2078
2078
|
/**
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2079
|
+
* The command handler for the CommandKit instance.
|
|
2080
|
+
* This is responsible for handling commands and their execution.
|
|
2081
|
+
*/
|
|
2082
2082
|
commandHandler: AppCommandHandler;
|
|
2083
2083
|
/**
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2084
|
+
* The event handler for the CommandKit instance.
|
|
2085
|
+
* This is responsible for handling events and their execution.
|
|
2086
|
+
*/
|
|
2087
2087
|
eventHandler: AppEventsHandler;
|
|
2088
2088
|
/**
|
|
2089
|
-
|
|
2090
|
-
|
|
2089
|
+
* The plugins runtime for the CommandKit instance.
|
|
2090
|
+
*/
|
|
2091
2091
|
plugins: CommandKitPluginRuntime;
|
|
2092
2092
|
/**
|
|
2093
|
-
|
|
2094
|
-
|
|
2093
|
+
* The events channel for the CommandKit instance. This can be used to emit custom events.
|
|
2094
|
+
*/
|
|
2095
2095
|
events: CommandKitEventsChannel;
|
|
2096
2096
|
/**
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2097
|
+
* The analytics engine for the CommandKit instance.
|
|
2098
|
+
* This is responsible for tracking events and user interactions.
|
|
2099
|
+
*/
|
|
2100
2100
|
analytics: AnalyticsEngine;
|
|
2101
2101
|
/**
|
|
2102
|
-
|
|
2103
|
-
|
|
2102
|
+
* The static instance of CommandKit.
|
|
2103
|
+
*/
|
|
2104
2104
|
static instance: CommandKit | undefined;
|
|
2105
2105
|
/**
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2106
|
+
* Create a new command and event handler with CommandKit.
|
|
2107
|
+
* @param options - The default CommandKit configuration.
|
|
2108
|
+
*/
|
|
2109
2109
|
constructor(options?: CommandKitOptions);
|
|
2110
2110
|
/**
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2111
|
+
* Starts the commandkit application.
|
|
2112
|
+
* @param token The application token to connect to the discord gateway. If not provided, it will use the `TOKEN` or `DISCORD_TOKEN` environment variable. If set to `false`, it will not login.
|
|
2113
|
+
*/
|
|
2114
2114
|
start(token?: string | false): Promise<void>;
|
|
2115
2115
|
/**
|
|
2116
|
-
|
|
2117
|
-
|
|
2116
|
+
* Loads all the plugins.
|
|
2117
|
+
*/
|
|
2118
2118
|
loadPlugins(): Promise<void>;
|
|
2119
2119
|
/**
|
|
2120
|
-
|
|
2121
|
-
|
|
2120
|
+
* Whether or not the commandkit application has started.
|
|
2121
|
+
*/
|
|
2122
2122
|
get started(): boolean;
|
|
2123
2123
|
/**
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2124
|
+
* Sets the prefix resolver for the command handler.
|
|
2125
|
+
* @param resolver The resolver function.
|
|
2126
|
+
*/
|
|
2127
2127
|
setPrefixResolver(resolver: (message: Message) => Awaitable<string | string[] | RegExp>): this;
|
|
2128
2128
|
/**
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2129
|
+
* Sets the default locale for the command handler.
|
|
2130
|
+
* @param locale The default locale.
|
|
2131
|
+
*/
|
|
2132
2132
|
setDefaultLocale(locale: Locale): this;
|
|
2133
2133
|
/**
|
|
2134
|
-
|
|
2135
|
-
|
|
2134
|
+
* Get the client attached to this CommandKit instance.
|
|
2135
|
+
*/
|
|
2136
2136
|
get client(): Client;
|
|
2137
2137
|
/**
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2138
|
+
* Sets the client attached to this CommandKit instance.
|
|
2139
|
+
* @param client The client to set.
|
|
2140
|
+
*/
|
|
2141
2141
|
setClient(client: Client): this;
|
|
2142
2142
|
/**
|
|
2143
|
-
|
|
2144
|
-
|
|
2143
|
+
* Updates application commands with the latest from "commandsPath".
|
|
2144
|
+
*/
|
|
2145
2145
|
reloadCommands(): Promise<void>;
|
|
2146
2146
|
/**
|
|
2147
|
-
|
|
2148
|
-
|
|
2147
|
+
* Updates application events with the latest from "eventsPath".
|
|
2148
|
+
*/
|
|
2149
2149
|
reloadEvents(): Promise<void>;
|
|
2150
2150
|
/**
|
|
2151
|
-
|
|
2152
|
-
|
|
2151
|
+
* Increment the client listeners count.
|
|
2152
|
+
*/
|
|
2153
2153
|
incrementClientListenersCount(): void;
|
|
2154
2154
|
/**
|
|
2155
|
-
|
|
2156
|
-
|
|
2155
|
+
* Decrement the client listeners count.
|
|
2156
|
+
*/
|
|
2157
2157
|
decrementClientListenersCount(): void;
|
|
2158
2158
|
/**
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2159
|
+
* Path to the app directory. Returns `null` if not found.
|
|
2160
|
+
* The lookup order is:
|
|
2161
|
+
* - `./app`
|
|
2162
|
+
* - `./src/app`
|
|
2163
|
+
*/
|
|
2164
2164
|
getAppDirectory(): string | null;
|
|
2165
2165
|
/**
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2166
|
+
* Get the path to the commands or events directory.
|
|
2167
|
+
* @param to The type of path to get, either 'commands' or 'events'.
|
|
2168
|
+
* @returns The path to the commands or events directory
|
|
2169
|
+
*/
|
|
2170
2170
|
getPath(to: 'commands' | 'events'): string | null;
|
|
2171
2171
|
}
|
|
2172
2172
|
/**
|
|
@@ -2193,19 +2193,19 @@ type IdentifyEvent = Record<string, any>;
|
|
|
2193
2193
|
*/
|
|
2194
2194
|
interface AnalyticsProvider {
|
|
2195
2195
|
/**
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2196
|
+
* The name of the analytics provider.
|
|
2197
|
+
* This is used for logging and identification purposes.
|
|
2198
|
+
*/
|
|
2199
2199
|
readonly name: string;
|
|
2200
2200
|
/**
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2201
|
+
* Initializes the analytics provider.
|
|
2202
|
+
* This method is called when the provider is registered.
|
|
2203
|
+
*/
|
|
2204
2204
|
track(engine: AnalyticsEngine, event: AnalyticsEvent): Promise<void>;
|
|
2205
2205
|
/**
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2206
|
+
* Identifies a user or entity with the analytics provider.
|
|
2207
|
+
* This method is called to associate user data with events.
|
|
2208
|
+
*/
|
|
2209
2209
|
identify?(engine: AnalyticsEngine, event: IdentifyEvent): Promise<void>;
|
|
2210
2210
|
}
|
|
2211
2211
|
//#endregion
|
|
@@ -2225,49 +2225,49 @@ declare class AnalyticsEngine {
|
|
|
2225
2225
|
#private;
|
|
2226
2226
|
readonly commandkit: CommandKit;
|
|
2227
2227
|
/**
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2228
|
+
* Creates an instance of the AnalyticsEngine.
|
|
2229
|
+
* @param commandkit The CommandKit instance.
|
|
2230
|
+
*/
|
|
2231
2231
|
constructor(commandkit: CommandKit);
|
|
2232
2232
|
/**
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2233
|
+
* Sets a filter function for analytics events.
|
|
2234
|
+
* This function will be called before tracking an event to determine if it should be tracked.
|
|
2235
|
+
* If the filter returns `false`, the event will not be tracked.
|
|
2236
|
+
* If the filter is set to `null`, all events will be tracked unless `doNotTrack` is enabled.
|
|
2237
|
+
* @param filter The filter function to set, or `null` to remove the filter.
|
|
2238
|
+
*/
|
|
2239
2239
|
setFilter(filter: FilterFunction | null): void;
|
|
2240
2240
|
/**
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2241
|
+
* Registers an analytics provider.
|
|
2242
|
+
* This provider will be used to track and identify events.
|
|
2243
|
+
* If a provider is already registered, it will be replaced with the new one.
|
|
2244
|
+
* @param provider The analytics provider to register.
|
|
2245
|
+
*/
|
|
2246
2246
|
registerProvider(provider: AnalyticsProvider): void;
|
|
2247
2247
|
/**
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2248
|
+
* Removes the currently registered analytics provider.
|
|
2249
|
+
* @param provider The analytics provider to remove.
|
|
2250
|
+
*/
|
|
2251
2251
|
removeProvider(provider: AnalyticsProvider): void;
|
|
2252
2252
|
/**
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2253
|
+
* Retrieves the currently registered analytics provider.
|
|
2254
|
+
* @returns The currently registered analytics provider, or `null` if no provider is registered.
|
|
2255
|
+
*/
|
|
2256
2256
|
getProvider(): AnalyticsProvider | null;
|
|
2257
2257
|
/**
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2258
|
+
* Identifies a user with the analytics provider.
|
|
2259
|
+
* This method sends an identify event to the provider, which can be used to associate user data with events.
|
|
2260
|
+
* @param event The identify event containing user data to send to the provider.
|
|
2261
|
+
*/
|
|
2262
2262
|
identify(event: IdentifyEvent): Promise<void>;
|
|
2263
2263
|
/**
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2264
|
+
* Tracks an analytics event with the registered provider.
|
|
2265
|
+
* This method sends the event to the provider, which can then process it as needed.
|
|
2266
|
+
* If the `doNotTrack` setting is enabled or if the filter function returns `false`, the event will not be tracked.
|
|
2267
|
+
* @param event The analytics event to track.
|
|
2268
|
+
*/
|
|
2269
2269
|
track(event: AnalyticsEvent): Promise<void>;
|
|
2270
2270
|
}
|
|
2271
2271
|
//#endregion
|
|
2272
2272
|
export { isRuntimePlugin as $, MessageCommand as $t, flag as A, makeContextAwareFunction as At, CommonPluginRuntime as B, PreRegisterCommandsEvent as Bt, EvaluationContext as C, RunCommandOptions as Ct, FlagRunner as D, getCommandKit as Dt, FeatureFlagDefinition as E, exitContext as Et, CommandKitPluginRuntime as F, CommandKitEnvironmentInternalData as Ft, PluginTransformParameters as G, ChatInputCommand as Gt, CommonDirectiveTransformer as H, AutocompleteCommand as Ht, PluginCommon as I, CommandKitEnvironmentType as It, CommandKitEventDispatch as J, CommandExecutionMode as Jt, TransformedResult as K, ChatInputCommandContext as Kt, PluginOptions as L, after as Lt, FlagConfiguration as M, useEnvironment as Mt, FlagProvider as N, useStore as Nt, IdentifyFunction as O, getContext as Ot, JsonFlagProvider as P, CommandKitEnvironment as Pt, RuntimePlugin as Q, InteractionCommandMiddlewareContext as Qt, PluginType as R, cancelAfter as Rt, DecideFunction as S, AppCommandRunner as St, FeatureFlag as T, GenericFunction as Tt, CommonDirectiveTransformerOptions as U, AutocompleteCommandContext as Ut, CompilerPluginRuntime as V, AnyCommandExecute as Vt, CompilerPlugin as W, AutocompleteCommandMiddlewareContext as Wt, MaybeFalsey as X, ContextParameters as Xt, CommandKitPlugin as Y, Context as Yt, TemplateHandler as Z, InteractionCommandContext as Zt, CommandKitConfig as _, CustomAppCommandProps as _t, IdentifyEvent as a, MiddlewareContext as an, EventListener as at, CustomEvaluationContext as b, ResolvableCommand as bt, CommandKitConfiguration as c, UserContextMenuCommand as cn, ListenerFunction as ct, onBootstrap as d, CommandContext as dn, AppCommandNative as dt, MessageCommandContext as en, CommandKitHMREvent as et, DeepPartial as f, CommandData as fn, CommandBuilderLike as ft, CommandKitCompilerOptions as g, EventHandler as gn, CommandTypeData as gt, mergeDeep as h, CommandMetadataFunction as hn, CommandDataSchemaValue as ht, AnalyticsProvider as i, MessageContextMenuCommandMiddlewareContext as in, AppEventsHandlerLoadedData as it, setFlagProvider as j, provideContext as jt, MaybePromise as k, isCommandWorkerContext as kt, commandkit as l, UserContextMenuCommandContext as ln, AppCommand as lt, ResolvedCommandKitConfig as m, CommandMetadata as mn, CommandDataSchemaKey as mt, FilterFunction as n, MessageContextMenuCommand as nn, registerDevHooks as nt, BootstrapFunction as o, MiddlewareContextArgs as on, LoadedEvent as ot, DeepRequired as p, CommandKitOptions as pn, CommandDataSchema as pt, isCompilerPlugin as q, CommandContextOptions as qt, AnalyticsEvent as r, MessageContextMenuCommandContext as rn, AppEventsHandler as rt, CommandKit as s, SlashCommandMiddlewareContext as sn, CommandKitEventsChannel as st, AnalyticsEngine as t, MessageCommandMiddlewareContext as tn, IpcMessageCommand as tt, onApplicationBootstrap as u, UserContextMenuCommandMiddlewareContext as un, AppCommandHandler as ut, FlagStore as v, LoadedCommand as vt, EventFlagContext as w, AsyncFunction as wt, CustomEvaluationFunction as x, RunCommand as xt, CommandFlagContext as y, PreparedAppCommandExecution as yt, isPlugin as z, CommandRegistrar as zt };
|
|
2273
|
-
//# sourceMappingURL=analytics-engine-
|
|
2273
|
+
//# sourceMappingURL=analytics-engine-WQhXmx3H.d.ts.map
|