commandkit 1.2.0-rc.11 → 1.2.0-rc.13
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/bin/index.mjs +1 -1
- package/cli.d.ts +19 -0
- package/config.cjs +3 -0
- package/config.d.ts +1 -0
- package/dist/{ActionRow-DKnFVDME.d.ts → ActionRow-B-CGmjDp.d.ts} +4 -5
- package/dist/{ActionRow-CbdGFWMT.js → ActionRow-CSN_UKmM.js} +3 -4
- package/dist/ActionRow-CSN_UKmM.js.map +1 -0
- package/dist/{Button-4ZUXdA56.d.ts → Button-C-GPeFA3.d.ts} +7 -8
- package/dist/{ButtonKit-C7r7RPNf.d.ts → ButtonKit-DKu0VAe4.d.ts} +37 -38
- package/dist/ChannelSelectMenuKit-HQZ4hH5s.d.ts +66 -0
- package/dist/{CommandKitEventsChannel-BtRzr3Tz.js → CommandKitEventsChannel-CnT5ymYe.js} +2 -2
- package/dist/{CommandKitEventsChannel-BtRzr3Tz.js.map → CommandKitEventsChannel-CnT5ymYe.js.map} +1 -1
- package/dist/{CommandsRouter-CoOA7hkf.d.ts → CommandsRouter-C7dZEepB.d.ts} +49 -50
- package/dist/{CommandsRouter-Dmzw-ikm.js → CommandsRouter-C_HLsrGX.js} +2 -6
- package/dist/{CommandsRouter-Dmzw-ikm.js.map → CommandsRouter-C_HLsrGX.js.map} +1 -1
- package/dist/{CompilerPlugin-M8r3yNAl.js → CompilerPlugin-CUsGAfgl.js} +2 -2
- package/dist/{CompilerPlugin-M8r3yNAl.js.map → CompilerPlugin-CUsGAfgl.js.map} +1 -1
- package/dist/{EventInterceptor-CQEXyUTp.js → EventInterceptor-BWoEJMHZ.js} +1 -1
- package/dist/{EventInterceptor-CQEXyUTp.js.map → EventInterceptor-BWoEJMHZ.js.map} +1 -1
- package/dist/{EventInterceptor-x-R2qshQ.d.ts → EventInterceptor-CZmWpS08.d.ts} +40 -40
- package/dist/{EventWorkerContext-Dq29tieI.js → EventWorkerContext-Dfhgv329.js} +2 -3
- package/dist/EventWorkerContext-Dfhgv329.js.map +1 -0
- package/dist/EventsRouter-DZ37r54v.d.ts +90 -0
- package/dist/{EventsRouter-3Gygh-km.js → EventsRouter-DZYIha6m.js} +2 -6
- package/dist/{EventsRouter-3Gygh-km.js.map → EventsRouter-DZYIha6m.js.map} +1 -1
- package/dist/MentionableSelectMenuKit-7URDUM3-.d.ts +61 -0
- package/dist/{MessageCommandParser-Dl0xxtdr.js → MessageCommandParser-Bs9fimmd.js} +53 -55
- package/dist/{MessageCommandParser-Dl0xxtdr.js.map → MessageCommandParser-Bs9fimmd.js.map} +1 -1
- package/dist/MessageCommandParser-q3dQcE5N.d.ts +194 -0
- package/dist/{Modal-C6UTRdYQ.d.ts → Modal-CZT9MZsy.d.ts} +25 -12
- package/dist/{ModalKit-Btz58KYn.d.ts → ModalKit-BWXI3Z26.d.ts} +34 -35
- package/dist/{PluginCommon-Cvl5yYM_.js → PluginCommon-BLxWww5u.js} +6 -7
- package/dist/{PluginCommon-Cvl5yYM_.js.map → PluginCommon-BLxWww5u.js.map} +1 -1
- package/dist/RoleSelectMenuKit-BY-JJ18w.d.ts +66 -0
- package/dist/{RuntimePlugin-BUecuBIU.js → RuntimePlugin-CtobluSU.js} +2 -2
- package/dist/{RuntimePlugin-BUecuBIU.js.map → RuntimePlugin-CtobluSU.js.map} +1 -1
- package/dist/{SelectMenu-Diy87_ba.d.ts → SelectMenu-q_b3Mjv9.d.ts} +10 -11
- package/dist/StringSelectMenuKit-lVhUMc3g.d.ts +66 -0
- package/dist/UserSelectMenuKit-CCj4Fpkr.d.ts +66 -0
- package/dist/analytics/analytics-engine.d.ts +1 -31
- package/dist/analytics/analytics-engine.js +24 -36
- package/dist/analytics/analytics-provider.d.ts +1 -31
- package/dist/analytics/constants.js +1 -1
- package/dist/analytics/utils.js +24 -36
- package/dist/{analytics-engine-AaAl3kQM.d.ts → analytics-engine-WQhXmx3H.d.ts} +855 -830
- package/dist/app/commands/AppCommandRunner.d.ts +1 -31
- package/dist/app/commands/AppCommandRunner.js +24 -36
- package/dist/app/commands/Context.d.ts +1 -31
- package/dist/app/commands/Context.js +24 -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 -33
- package/dist/app/events/EventWorkerContext.js +1 -1
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -31
- package/dist/app/handlers/AppCommandHandler.js +24 -36
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -31
- package/dist/app/handlers/AppEventsHandler.js +24 -36
- package/dist/app/index.d.ts +4 -31
- package/dist/app/index.js +24 -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 -31
- package/dist/app/middlewares/permissions.js +24 -36
- package/dist/app/register/CommandRegistrar.d.ts +1 -31
- package/dist/app/register/CommandRegistrar.js +24 -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 +3 -3
- 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 +62 -7
- package/dist/cli/app-process.js.map +1 -0
- package/dist/cli/build.d.ts +2 -31
- package/dist/cli/build.js +191 -41
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/common.d.ts +1 -31
- package/dist/cli/common.js +4 -4
- package/dist/cli/development.d.ts +18 -1
- package/dist/cli/development.js +43 -48
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.d.ts +4 -0
- package/dist/cli/env.js +1 -1
- package/dist/cli/generators.js +5 -8
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.js +5 -5
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.d.ts +12 -2
- package/dist/cli/init.js +102 -38
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/production.d.ts +0 -1
- package/dist/cli/production.js +38 -49
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.js +5 -5
- 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-DL3ucTiT.js → colors-Csc0X4QJ.js} +2 -3
- package/dist/{colors-DL3ucTiT.js.map → colors-Csc0X4QJ.js.map} +1 -1
- package/dist/{commandkit-ZoBBh0Q_.js → commandkit-SIjTLD2R.js} +229 -88
- package/dist/commandkit-SIjTLD2R.js.map +1 -0
- package/dist/commandkit.d.ts +1 -31
- package/dist/commandkit.js +24 -36
- package/dist/{common-vnMIelAE.js → common-CEordwf3.js} +3 -3
- package/dist/common-CEordwf3.js.map +1 -0
- package/dist/{common-CrqwC-sx.js → common-DSRs_mfw.js} +10 -14
- package/dist/{common-CrqwC-sx.js.map → common-DSRs_mfw.js.map} +1 -1
- package/dist/{common-DOCvOVC4.d.ts → common-DnwCYit8.d.ts} +4 -5
- package/dist/components/common/EventInterceptor.d.ts +1 -1
- package/dist/components/common/EventInterceptor.js +1 -1
- package/dist/components/common/element.d.ts +1 -4
- package/dist/components/common/element.js +1 -1
- package/dist/components/common/types.d.ts +1 -1
- package/dist/components/common/types.js +0 -1
- package/dist/components/{v2 → display}/common.d.ts +1 -2
- package/dist/components/display/common.js +3 -0
- package/dist/components/display/container.d.ts +2 -0
- package/dist/components/display/container.js +3 -0
- package/dist/components/display/file.d.ts +2 -0
- package/dist/components/display/file.js +3 -0
- package/dist/components/display/index.d.ts +9 -0
- package/dist/components/display/index.js +22 -0
- package/dist/components/display/label.d.ts +2 -0
- package/dist/components/display/label.js +3 -0
- package/dist/components/display/media-gallery.d.ts +2 -0
- package/dist/components/{v2 → display}/media-gallery.js +1 -2
- package/dist/components/display/poll.d.ts +2 -0
- package/dist/components/display/poll.js +5 -0
- package/dist/components/display/section.d.ts +2 -0
- package/dist/components/display/section.js +4 -0
- package/dist/components/display/separator.d.ts +2 -0
- package/dist/components/display/separator.js +3 -0
- package/dist/components/display/text-display.d.ts +2 -0
- package/dist/components/display/text-display.js +3 -0
- package/dist/components/index.d.ts +23 -24
- package/dist/components/index.js +30 -37
- package/dist/components/interactive/action-row/ActionRow.d.ts +2 -0
- package/dist/components/interactive/action-row/ActionRow.js +3 -0
- package/dist/components/interactive/button/Button.d.ts +2 -0
- package/dist/components/interactive/button/Button.js +26 -0
- package/dist/components/interactive/button/ButtonKit.d.ts +2 -0
- package/dist/components/interactive/button/ButtonKit.js +26 -0
- package/dist/components/interactive/modal/Modal.d.ts +2 -0
- package/dist/components/interactive/modal/Modal.js +30 -0
- package/dist/components/interactive/modal/ModalKit.d.ts +2 -0
- package/dist/components/interactive/modal/ModalKit.js +26 -0
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +2 -0
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +26 -0
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +2 -0
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +26 -0
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +2 -0
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +26 -0
- package/dist/components/interactive/select-menu/SelectMenu.d.ts +2 -0
- package/dist/components/interactive/select-menu/SelectMenu.js +31 -0
- package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +2 -0
- package/dist/components/interactive/select-menu/StringSelectMenuKit.js +26 -0
- package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +2 -0
- package/dist/components/interactive/select-menu/UserSelectMenuKit.js +26 -0
- package/dist/components/interactive/select-menu/common.d.ts +2 -0
- package/dist/config/config.d.ts +15 -33
- package/dist/config/config.js +24 -36
- package/dist/config/default.d.ts +1 -31
- package/dist/config/default.js +24 -36
- package/dist/config/loader.d.ts +1 -31
- package/dist/config/loader.js +24 -36
- package/dist/config/types.d.ts +1 -31
- package/dist/config/utils.d.ts +1 -31
- package/dist/config/utils.js +1 -1
- package/dist/constants-BFFK-hfP.js +27 -0
- package/dist/{constants-4oxxvaJA.js.map → constants-BFFK-hfP.js.map} +1 -1
- package/dist/{constants-MKu-Q1jh.d.ts → constants-CuYW0K10.d.ts} +14 -8
- package/dist/{constants-BOOGN85p.js → constants-Cw8VjCVz.js} +2 -3
- package/dist/{constants-BOOGN85p.js.map → constants-Cw8VjCVz.js.map} +1 -1
- package/dist/{constants-B5_Ta7PR.js → constants-CxkFFZ7p.js} +16 -1
- package/dist/constants-CxkFFZ7p.js.map +1 -0
- package/dist/{constants-D8PMA9on.d.ts → constants-EpKcj0dH.d.ts} +2 -2
- package/dist/{container-C6GtfAPW.js → container-DCPljKVH.js} +4 -5
- package/dist/container-DCPljKVH.js.map +1 -0
- package/dist/{container-DHBELeJ3.d.ts → container-DYcb7zGw.d.ts} +3 -4
- package/dist/context/async-context.d.ts +1 -31
- package/dist/context/async-context.js +24 -36
- package/dist/context/environment.d.ts +1 -31
- package/dist/context/environment.js +24 -36
- package/dist/{element-Bak9llw_.js → element-DibzzA5L.js} +1 -1
- package/dist/element-DibzzA5L.js.map +1 -0
- package/dist/{element-CAXu1XtK.d.ts → element-wQo0heGj.d.ts} +4 -5
- package/dist/{env-_68PRRoA.js → env-CmspDhHy.js} +7 -3
- package/dist/env-CmspDhHy.js.map +1 -0
- package/dist/error-codes-Ds0bnPvT.js.map +1 -1
- package/dist/events/CommandKitEventsChannel.d.ts +1 -31
- package/dist/events/CommandKitEventsChannel.js +1 -1
- package/dist/{file-DVOELoNv.js → file-Ca1kpEtE.js} +3 -4
- package/dist/file-Ca1kpEtE.js.map +1 -0
- package/dist/{file-DTrr-p09.d.ts → file-CrV4lSnl.d.ts} +3 -4
- package/dist/flags/FlagProvider.d.ts +1 -31
- package/dist/flags/feature-flags.d.ts +1 -31
- package/dist/flags/feature-flags.js +165 -40
- package/dist/flags/feature-flags.js.map +1 -0
- package/dist/flags/store.d.ts +1 -31
- package/dist/flags/store.js +1 -1
- package/dist/{helpers-Wg6P5fRQ.d.ts → helpers-AQPLVY35.d.ts} +2 -3
- package/dist/{helpers-Dl8wW6aO.js → helpers-Btx1FSZx.js} +2 -3
- package/dist/{helpers-Dl8wW6aO.js.map → helpers-Btx1FSZx.js.map} +1 -1
- package/dist/index.d.ts +41 -42
- package/dist/index.js +47 -46
- 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 -18
- 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-37kaNWMH.d.ts +28 -0
- package/dist/label-B6vXvwLM.js +35 -0
- package/dist/label-B6vXvwLM.js.map +1 -0
- package/dist/logger/DefaultLogger.d.ts +66 -3
- package/dist/logger/DefaultLogger.js +24 -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 +24 -36
- package/dist/logger/NoopLogger.d.ts +36 -37
- package/dist/{media-gallery-BMsXSot3.d.ts → media-gallery-Ci3I4ElH.d.ts} +3 -4
- package/dist/{media-gallery-zDtJ3kxb.js → media-gallery-u3gjX7yD.js} +4 -5
- package/dist/media-gallery-u3gjX7yD.js.map +1 -0
- package/dist/plugins/CompilerPlugin.d.ts +1 -31
- package/dist/plugins/CompilerPlugin.js +1 -2
- package/dist/plugins/PluginCommon.d.ts +1 -31
- package/dist/plugins/PluginCommon.js +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +1 -31
- package/dist/plugins/RuntimePlugin.js +1 -2
- package/dist/plugins/index.d.ts +1 -31
- package/dist/plugins/index.js +26 -36
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -31
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +24 -36
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -31
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +24 -36
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -31
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +24 -36
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -31
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +24 -36
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -31
- package/dist/plugins/plugin-runtime/runtime.js +0 -1
- package/dist/plugins/types.d.ts +1 -31
- package/dist/plugins/types.js +0 -1
- package/dist/poll-CFe8yvoJ.js +100 -0
- package/dist/poll-CFe8yvoJ.js.map +1 -0
- package/dist/poll-Ddtapd6n.d.ts +88 -0
- package/dist/{resolve-file-url-ChIyw-Vf.js → resolve-file-url-CdHqwWs3.js} +2 -2
- package/dist/{resolve-file-url-ChIyw-Vf.js.map → resolve-file-url-CdHqwWs3.js.map} +1 -1
- package/dist/{section-DlvrDoJK.js → section-BC8LF-B2.js} +4 -5
- package/dist/section-BC8LF-B2.js.map +1 -0
- package/dist/{section-Dh_FhPeC.d.ts → section-DkUKULnB.d.ts} +3 -4
- package/dist/{separator-DL6QH5H1.js → separator-BUTiW7uz.js} +3 -4
- package/dist/separator-BUTiW7uz.js.map +1 -0
- package/dist/{separator-CMf6Cyy5.d.ts → separator-CbXsIFCa.d.ts} +3 -4
- package/dist/{signals-ChFMD7mB.js → signals-B8z1wJ6W.js} +2 -2
- package/dist/{signals-ChFMD7mB.js.map → signals-B8z1wJ6W.js.map} +1 -1
- package/dist/{signals-SHg7J1U_.d.ts → signals-BbTgTc0i.d.ts} +2 -2
- package/dist/{store-CM6pWVZh.js → store-D8r_hryO.js} +2 -3
- package/dist/{store-CM6pWVZh.js.map → store-D8r_hryO.js.map} +1 -1
- package/dist/{text-display-DRw3r_lK.d.ts → text-display-D7j39VC-.d.ts} +3 -4
- package/dist/{text-display-DbMumig_.js → text-display-DANahMN3.js} +3 -4
- package/dist/text-display-DANahMN3.js.map +1 -0
- package/dist/{type-checker-ocNSZh0W.js → type-checker-cVd3Hpnh.js} +4 -6
- package/dist/{type-checker-ocNSZh0W.js.map → type-checker-cVd3Hpnh.js.map} +1 -1
- package/dist/{types-CJ-XvOFN.d.ts → types-BywA9d2Z.d.ts} +2 -2
- package/dist/{types-package-BWArjyBF.js → types-package-CsTNfvv2.js} +4 -8
- package/dist/{types-package-BWArjyBF.js.map → types-package-CsTNfvv2.js.map} +1 -1
- package/dist/types.d.ts +1 -31
- package/dist/utils/colors.js +1 -1
- package/dist/utils/constants.d.ts +2 -2
- package/dist/utils/constants.js +3 -2
- package/dist/utils/dev-hooks.d.ts +1 -31
- package/dist/utils/dev-hooks.js +24 -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 +2 -2
- package/dist/utils/useful-stuff/async-queue.d.ts +21 -21
- package/dist/utils/useful-stuff/async-queue.js +1 -2
- package/dist/utils/useful-stuff/async-queue.js.map +1 -1
- 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 +1 -2
- package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
- package/dist/utils/useful-stuff/semaphore.d.ts +82 -82
- package/dist/utils/useful-stuff/semaphore.js +1 -3
- package/dist/utils/useful-stuff/semaphore.js.map +1 -1
- package/dist/utils/utilities.d.ts +113 -2
- package/dist/utils/utilities.js +27 -37
- package/dist/utils/{warn-unstable.d.ts → warning.d.ts} +12 -3
- package/dist/utils/warning.js +5 -0
- package/dist/{utils-KsNof0Xz.js → utils-Br3eenD1.js} +1 -1
- package/dist/{utils-KsNof0Xz.js.map → 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 +53 -0
- package/dist/warning-CszH8HeS.js.map +1 -0
- package/hooks.cjs +11 -4
- package/package.json +14 -7
- package/dist/ActionRow-CbdGFWMT.js.map +0 -1
- package/dist/ChannelSelectMenuKit-BrXvBYNH.d.ts +0 -67
- package/dist/DefaultLogger-XCOl5nLd.d.ts +0 -67
- package/dist/EventWorkerContext-Dq29tieI.js.map +0 -1
- package/dist/EventWorkerContext-XNgriym3.d.ts +0 -43
- package/dist/EventsRouter-BacqK6z3.d.ts +0 -90
- package/dist/ILogger-BW8GM-YZ.d.ts +0 -64
- package/dist/Logger-DyfkPk7u.d.ts +0 -37
- package/dist/MentionableSelectMenuKit-CPTKqx-O.d.ts +0 -62
- package/dist/MessageCommandParser-BsGMOTDo.d.ts +0 -195
- package/dist/RoleSelectMenuKit-C26lU3sN.d.ts +0 -67
- package/dist/StringSelectMenuKit-Bhs8U6WI.d.ts +0 -67
- package/dist/UserSelectMenuKit-CfqFJdxz.d.ts +0 -67
- package/dist/app-process-cj2vF12T.js +0 -68
- package/dist/app-process-cj2vF12T.js.map +0 -1
- package/dist/build-B5qTswWF.js +0 -174
- package/dist/build-B5qTswWF.js.map +0 -1
- package/dist/commandkit-ZoBBh0Q_.js.map +0 -1
- package/dist/common-vnMIelAE.js.map +0 -1
- package/dist/components/v1/action-row/ActionRow.d.ts +0 -6
- package/dist/components/v1/action-row/ActionRow.js +0 -3
- package/dist/components/v1/button/Button.d.ts +0 -7
- package/dist/components/v1/button/Button.js +0 -38
- package/dist/components/v1/button/ButtonKit.d.ts +0 -3
- package/dist/components/v1/button/ButtonKit.js +0 -38
- package/dist/components/v1/modal/Modal.d.ts +0 -7
- package/dist/components/v1/modal/Modal.js +0 -41
- package/dist/components/v1/modal/ModalKit.d.ts +0 -3
- package/dist/components/v1/modal/ModalKit.js +0 -38
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.d.ts +0 -4
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +0 -38
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.d.ts +0 -4
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +0 -38
- package/dist/components/v1/select-menu/RoleSelectMenuKit.d.ts +0 -4
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js +0 -38
- package/dist/components/v1/select-menu/SelectMenu.d.ts +0 -10
- package/dist/components/v1/select-menu/SelectMenu.js +0 -43
- package/dist/components/v1/select-menu/StringSelectMenuKit.d.ts +0 -4
- package/dist/components/v1/select-menu/StringSelectMenuKit.js +0 -38
- package/dist/components/v1/select-menu/UserSelectMenuKit.d.ts +0 -4
- package/dist/components/v1/select-menu/UserSelectMenuKit.js +0 -38
- package/dist/components/v1/select-menu/common.d.ts +0 -3
- package/dist/components/v1/select-menu/common.js +0 -1
- package/dist/components/v2/common.js +0 -3
- package/dist/components/v2/container.d.ts +0 -2
- package/dist/components/v2/container.js +0 -4
- package/dist/components/v2/file.d.ts +0 -2
- package/dist/components/v2/file.js +0 -3
- package/dist/components/v2/index.d.ts +0 -8
- package/dist/components/v2/index.js +0 -17
- package/dist/components/v2/media-gallery.d.ts +0 -2
- package/dist/components/v2/section.d.ts +0 -2
- package/dist/components/v2/section.js +0 -5
- package/dist/components/v2/separator.d.ts +0 -2
- package/dist/components/v2/separator.js +0 -3
- package/dist/components/v2/text-display.d.ts +0 -2
- package/dist/components/v2/text-display.js +0 -3
- package/dist/config-D-JMp2IO.d.ts +0 -16
- package/dist/constants-4oxxvaJA.js +0 -27
- package/dist/constants-B5_Ta7PR.js.map +0 -1
- package/dist/container-C6GtfAPW.js.map +0 -1
- package/dist/dotprops-tnhpnszJ.js +0 -36
- package/dist/dotprops-tnhpnszJ.js.map +0 -1
- package/dist/element-Bak9llw_.js.map +0 -1
- package/dist/env-_68PRRoA.js.map +0 -1
- package/dist/error-codes-B4TyW4Ct.d.ts +0 -54
- package/dist/feature-flags-CKNrjgqg.js +0 -160
- package/dist/feature-flags-CKNrjgqg.js.map +0 -1
- package/dist/file-DVOELoNv.js.map +0 -1
- package/dist/init-DOr-Y3GQ.d.ts +0 -13
- package/dist/init-_7_QDifv.js +0 -95
- package/dist/init-_7_QDifv.js.map +0 -1
- package/dist/media-gallery-zDtJ3kxb.js.map +0 -1
- package/dist/resolve-file-url-yO8bUxok.d.ts +0 -11
- package/dist/section-DlvrDoJK.js.map +0 -1
- package/dist/separator-DL6QH5H1.js.map +0 -1
- package/dist/serde-BYaKrsOV.d.ts +0 -12
- package/dist/serde-Cc8iUa9J.js +0 -97
- package/dist/serde-Cc8iUa9J.js.map +0 -1
- package/dist/text-display-DbMumig_.js.map +0 -1
- package/dist/utilities-DtdPlr4c.d.ts +0 -87
- package/dist/utils/warn-unstable.js +0 -26
- package/dist/utils/warn-unstable.js.map +0 -1
- package/dist/utils-DCSnVAZ6.js +0 -23
- package/dist/utils-DCSnVAZ6.js.map +0 -1
- package/dist/v2-DofkPKHs.js +0 -0
- package/dist/version--Q1nmlBz.js +0 -18
- package/dist/version--Q1nmlBz.js.map +0 -1
- package/dist/version-CtJtBJXI.d.ts +0 -8
- /package/dist/{ILogger-dQ7Y9X1f.js → common-C2jAjX4U.js} +0 -0
- /package/dist/{app-HN1cVg8J.js → components/interactive/select-menu/common.js} +0 -0
- /package/dist/{common-CcfjYnPG.js → display-WDb9wMCv.js} +0 -0
- /package/dist/{index-CUPkUUOR.d.ts → index-BJfko-dP.d.ts} +0 -0
- /package/dist/{index-Dw5cCt-A.d.ts → index-CCggO_hw.d.ts} +0 -0
- /package/dist/{index-E7Wvm5uX.d.ts → index-CLjpoGi1.d.ts} +0 -0
- /package/dist/{router-Dn35v30f.js → router-BvamdzoF.js} +0 -0
- /package/dist/{runtime-DB9CiPfe.js → runtime-Skt5NiOc.js} +0 -0
- /package/dist/{types-CUZOquUl.js → types-Cdh4uaFR.js} +0 -0
- /package/dist/{types-q0Nm882H.js → types-TC4g3w91.js} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { EventInterceptor } from "./EventInterceptor-
|
|
2
|
-
import { Fragment, createElement } from "./element-
|
|
3
|
-
import { MaybeArray } from "./types-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { 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,134 +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
|
+
get invokedCommandName(): string;
|
|
259
|
+
/**
|
|
260
|
+
* Gets the command options based on the execution mode.
|
|
261
|
+
*/
|
|
258
262
|
get options(): CommandContextOptions<ExecutionMode>;
|
|
259
263
|
/**
|
|
260
|
-
|
|
261
|
-
|
|
264
|
+
* Whether this context was forwarded from another context. This happens when a command forwards its context to another command.
|
|
265
|
+
*/
|
|
262
266
|
get forwarded(): boolean;
|
|
263
267
|
/**
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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
|
+
*/
|
|
267
271
|
forwardCommand<C extends ResolvableCommand>(command: C): Promise<never>;
|
|
268
272
|
/**
|
|
269
|
-
|
|
270
|
-
|
|
273
|
+
* The execution mode of the command.
|
|
274
|
+
*/
|
|
271
275
|
get executionMode(): ExecutionMode;
|
|
272
276
|
/**
|
|
273
|
-
|
|
274
|
-
|
|
277
|
+
* Whether the command was triggered by an interaction.
|
|
278
|
+
*/
|
|
275
279
|
isInteraction(): this is InteractionCommandContext;
|
|
276
280
|
/**
|
|
277
|
-
|
|
278
|
-
|
|
281
|
+
* Whether the command was triggered by a slash command interaction.
|
|
282
|
+
*/
|
|
279
283
|
isChatInputCommand(): this is ChatInputCommandContext;
|
|
280
284
|
/**
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
* Whether the command was triggered by an autocomplete interaction.
|
|
286
|
+
*/
|
|
283
287
|
isAutocomplete(): this is AutocompleteCommandContext;
|
|
284
288
|
/**
|
|
285
|
-
|
|
286
|
-
|
|
289
|
+
* Whether the command was triggered by a message context menu interaction.
|
|
290
|
+
*/
|
|
287
291
|
isMessageContextMenu(): this is MessageContextMenuCommandContext;
|
|
288
292
|
/**
|
|
289
|
-
|
|
290
|
-
|
|
293
|
+
* Whether the command was triggered by a user context menu interaction.
|
|
294
|
+
*/
|
|
291
295
|
isUserContextMenu(): this is UserContextMenuCommandContext;
|
|
292
296
|
/**
|
|
293
|
-
|
|
294
|
-
|
|
297
|
+
* Whether the command was triggered by a message.
|
|
298
|
+
*/
|
|
295
299
|
isMessage(): this is Context<'message'>;
|
|
296
300
|
/**
|
|
297
|
-
|
|
298
|
-
|
|
301
|
+
* Returns the command identifier.
|
|
302
|
+
*/
|
|
299
303
|
getCommandIdentifier(): string;
|
|
300
304
|
/**
|
|
301
|
-
|
|
302
|
-
|
|
305
|
+
* Returns the locale of the guild where this command was triggered.
|
|
306
|
+
*/
|
|
303
307
|
getGuildLocale(): Locale | null;
|
|
304
308
|
/**
|
|
305
|
-
|
|
306
|
-
|
|
309
|
+
* Returns the locale of the user who triggered this command.
|
|
310
|
+
*/
|
|
307
311
|
getUserLocale(): Locale | null;
|
|
308
312
|
/**
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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
|
+
*/
|
|
313
317
|
getLocale(preferUser?: boolean): Locale;
|
|
314
318
|
/**
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
319
|
+
* Sets the locale for this command.
|
|
320
|
+
* @param locale The locale to set.
|
|
321
|
+
*/
|
|
318
322
|
setLocale(locale: Locale | null): void;
|
|
319
323
|
/**
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
324
|
+
* Creates a clone of this context
|
|
325
|
+
* @param config - Optional partial config to override in the clone
|
|
326
|
+
*/
|
|
323
327
|
clone(config?: Partial<ContextParameters<ExecutionMode>>): Context<ExecutionMode>;
|
|
324
328
|
/**
|
|
325
|
-
|
|
326
|
-
|
|
329
|
+
* Checks if this context is a middleware context.
|
|
330
|
+
*/
|
|
327
331
|
isMiddleware(): this is MiddlewareContext<ExecutionMode>;
|
|
328
332
|
/**
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
333
|
+
* Gets the command arguments (only available for message commands).
|
|
334
|
+
* @returns Array of command arguments
|
|
335
|
+
*/
|
|
332
336
|
args(): string[];
|
|
333
337
|
}
|
|
334
338
|
/**
|
|
@@ -336,14 +340,14 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
|
|
|
336
340
|
*/
|
|
337
341
|
declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutionMode> extends Context<T, MiddlewareContextArgs> {
|
|
338
342
|
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
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
|
+
*/
|
|
347
351
|
setCommandRunner(fn: RunCommand): void;
|
|
348
352
|
}
|
|
349
353
|
//#endregion
|
|
@@ -361,36 +365,39 @@ interface PreRegisterCommandsEvent {
|
|
|
361
365
|
declare class CommandRegistrar {
|
|
362
366
|
readonly commandkit: CommandKit;
|
|
363
367
|
/**
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
368
|
+
* @private
|
|
369
|
+
* @internal
|
|
370
|
+
*/
|
|
367
371
|
private api;
|
|
368
372
|
/**
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
373
|
+
* Creates an instance of CommandRegistrar.
|
|
374
|
+
* @param commandkit The commandkit instance.
|
|
375
|
+
*/
|
|
372
376
|
constructor(commandkit: CommandKit);
|
|
373
377
|
/**
|
|
374
|
-
|
|
375
|
-
|
|
378
|
+
* Gets the commands data.
|
|
379
|
+
*/
|
|
376
380
|
getCommandsData(): (CommandData & {
|
|
377
381
|
__metadata?: CommandMetadata;
|
|
382
|
+
__applyId(id: string): void;
|
|
378
383
|
})[];
|
|
379
384
|
/**
|
|
380
|
-
|
|
381
|
-
|
|
385
|
+
* Registers loaded commands.
|
|
386
|
+
*/
|
|
382
387
|
register(): Promise<void>;
|
|
383
388
|
/**
|
|
384
|
-
|
|
385
|
-
|
|
389
|
+
* Updates the global commands.
|
|
390
|
+
*/
|
|
386
391
|
updateGlobalCommands(commands: (CommandData & {
|
|
387
392
|
__metadata?: CommandMetadata;
|
|
393
|
+
__applyId(id: string): void;
|
|
388
394
|
})[]): Promise<void>;
|
|
389
395
|
/**
|
|
390
|
-
|
|
391
|
-
|
|
396
|
+
* Updates the guild commands.
|
|
397
|
+
*/
|
|
392
398
|
updateGuildCommands(commands: (CommandData & {
|
|
393
399
|
__metadata?: CommandMetadata;
|
|
400
|
+
__applyId(id: string): void;
|
|
394
401
|
})[]): Promise<void>;
|
|
395
402
|
}
|
|
396
403
|
//#endregion
|
|
@@ -400,46 +407,46 @@ declare class CommandRegistrar {
|
|
|
400
407
|
*/
|
|
401
408
|
interface CommandKitEnvironmentInternalData {
|
|
402
409
|
/**
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
+
*/
|
|
406
413
|
executionError: Error | null;
|
|
407
414
|
/**
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
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
|
+
*/
|
|
411
418
|
type: CommandKitEnvironmentType | null;
|
|
412
419
|
/**
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
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
|
+
*/
|
|
416
423
|
variables: Map<string, any>;
|
|
417
424
|
/**
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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
|
+
*/
|
|
421
428
|
deferredFunctions: Map<string, GenericFunction<[CommandKitEnvironment]>>;
|
|
422
429
|
/**
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
430
|
+
* A marker string that can be used to identify the command execution.
|
|
431
|
+
* This is useful for logging and debugging purposes.
|
|
432
|
+
*/
|
|
426
433
|
marker: string;
|
|
427
434
|
/**
|
|
428
|
-
|
|
429
|
-
|
|
435
|
+
* The start time of the command execution.
|
|
436
|
+
*/
|
|
430
437
|
markStart: number;
|
|
431
438
|
/**
|
|
432
|
-
|
|
433
|
-
|
|
439
|
+
* The end time of the command execution.
|
|
440
|
+
*/
|
|
434
441
|
markEnd: number;
|
|
435
442
|
/**
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
443
|
+
* The context associated with the command execution.
|
|
444
|
+
* This can be used to access request-specific data or application state.
|
|
445
|
+
*/
|
|
439
446
|
context: Context | null;
|
|
440
447
|
/**
|
|
441
|
-
|
|
442
|
-
|
|
448
|
+
* Shared collection instance for arbitrary data storage
|
|
449
|
+
*/
|
|
443
450
|
store: Collection<any, any>;
|
|
444
451
|
}
|
|
445
452
|
/**
|
|
@@ -449,92 +456,92 @@ declare class CommandKitEnvironment {
|
|
|
449
456
|
#private;
|
|
450
457
|
readonly commandkit: CommandKit;
|
|
451
458
|
/**
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
459
|
+
* Creates the commandkit execution environment.
|
|
460
|
+
* @param commandkit - The commandkit instance.
|
|
461
|
+
*/
|
|
455
462
|
constructor(commandkit: CommandKit);
|
|
456
463
|
/**
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
464
|
+
* Set the context.
|
|
465
|
+
* @param context - The context to set.
|
|
466
|
+
*/
|
|
460
467
|
setContext(context: Context): void;
|
|
461
468
|
/**
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
469
|
+
* Get the context. `null` if not set.
|
|
470
|
+
* @internal
|
|
471
|
+
*/
|
|
465
472
|
get context(): Context | null;
|
|
466
473
|
/**
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
474
|
+
* Get the execution error.
|
|
475
|
+
* @internal
|
|
476
|
+
*/
|
|
470
477
|
getExecutionError(): Error | null;
|
|
471
478
|
/**
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
479
|
+
* Set the execution error.
|
|
480
|
+
* @param error - The error to set.
|
|
481
|
+
* @internal
|
|
482
|
+
*/
|
|
476
483
|
setExecutionError(error: Error): void;
|
|
477
484
|
/**
|
|
478
|
-
|
|
479
|
-
|
|
485
|
+
* Get the environment type.
|
|
486
|
+
*/
|
|
480
487
|
getType(): CommandKitEnvironmentType;
|
|
481
488
|
/**
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
489
|
+
* Set the environment type.
|
|
490
|
+
* @param type - The environment type to set.
|
|
491
|
+
* @internal
|
|
492
|
+
*/
|
|
486
493
|
setType(type: CommandKitEnvironmentType): void;
|
|
487
494
|
/**
|
|
488
|
-
|
|
489
|
-
|
|
495
|
+
* The variables store for this environment.
|
|
496
|
+
*/
|
|
490
497
|
get variables(): Map<string, any>;
|
|
491
498
|
/**
|
|
492
|
-
|
|
493
|
-
|
|
499
|
+
* The shared store for this environment
|
|
500
|
+
*/
|
|
494
501
|
get store(): Collection<any, any>;
|
|
495
502
|
/**
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
503
|
+
* Register a deferred function.
|
|
504
|
+
* @param fn - The deferred function to register.
|
|
505
|
+
* @returns The deferred function id.
|
|
506
|
+
* @internal
|
|
507
|
+
*/
|
|
501
508
|
registerDeferredFunction(fn: GenericFunction<[CommandKitEnvironment]>): string;
|
|
502
509
|
/**
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
510
|
+
* Clear a deferred function by id.
|
|
511
|
+
* @param id - The deferred function id to clear.
|
|
512
|
+
* @internal
|
|
513
|
+
*/
|
|
507
514
|
clearDeferredFunction(id: string): void;
|
|
508
515
|
/**
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
516
|
+
* Run all deferred functions sequentially.
|
|
517
|
+
* @internal
|
|
518
|
+
*/
|
|
512
519
|
runDeferredFunctions(): Promise<void>;
|
|
513
520
|
/**
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
521
|
+
* Clear all deferred functions.
|
|
522
|
+
* @internal
|
|
523
|
+
*/
|
|
517
524
|
clearAllDeferredFunctions(): void;
|
|
518
525
|
/**
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
526
|
+
* Mark the start of a command execution.
|
|
527
|
+
* @param marker - The marker to set.
|
|
528
|
+
* @internal
|
|
529
|
+
*/
|
|
523
530
|
markStart(marker: string): void;
|
|
524
531
|
/**
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
532
|
+
* Mark the end of a command execution.
|
|
533
|
+
* @internal
|
|
534
|
+
*/
|
|
528
535
|
markEnd(): void;
|
|
529
536
|
/**
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
537
|
+
* Get the marker.
|
|
538
|
+
* @internal
|
|
539
|
+
*/
|
|
533
540
|
getMarker(): string;
|
|
534
541
|
/**
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
542
|
+
* Get the execution time in milliseconds.
|
|
543
|
+
* @internal
|
|
544
|
+
*/
|
|
538
545
|
getExecutionTime(): number;
|
|
539
546
|
}
|
|
540
547
|
declare enum CommandKitEnvironmentType {
|
|
@@ -633,17 +640,17 @@ declare function useStore(): Collection<any, any>;
|
|
|
633
640
|
*/
|
|
634
641
|
interface RunCommandOptions {
|
|
635
642
|
/**
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
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
|
+
*/
|
|
640
647
|
handler?: string;
|
|
641
648
|
/**
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
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
|
+
*/
|
|
647
654
|
throwOnError?: boolean;
|
|
648
655
|
}
|
|
649
656
|
/**
|
|
@@ -654,23 +661,23 @@ declare class AppCommandRunner {
|
|
|
654
661
|
#private;
|
|
655
662
|
private handler;
|
|
656
663
|
/**
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
664
|
+
* Creates a new AppCommandRunner instance.
|
|
665
|
+
* @param handler - The app command handler instance to use for command execution
|
|
666
|
+
*/
|
|
660
667
|
constructor(handler: AppCommandHandler);
|
|
661
668
|
/**
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
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
|
+
*/
|
|
668
675
|
runCommand(prepared: PreparedAppCommandExecution, source: Interaction | Message, options?: RunCommandOptions): Promise<any>;
|
|
669
676
|
/**
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
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
|
+
*/
|
|
674
681
|
getExecutionMode(source: Interaction | Message): CommandExecutionMode;
|
|
675
682
|
}
|
|
676
683
|
//#endregion
|
|
@@ -718,8 +725,22 @@ interface AppCommandMiddleware {
|
|
|
718
725
|
* Represents a loaded command with its metadata and configuration.
|
|
719
726
|
*/
|
|
720
727
|
interface LoadedCommand {
|
|
728
|
+
/**
|
|
729
|
+
* The associated discord snowflake id for this command.
|
|
730
|
+
* If the information is not yet available, this will be `null`.
|
|
731
|
+
*/
|
|
732
|
+
discordId: string | null;
|
|
733
|
+
/**
|
|
734
|
+
* The command data.
|
|
735
|
+
*/
|
|
721
736
|
command: Command;
|
|
737
|
+
/**
|
|
738
|
+
* The metadata for this command.
|
|
739
|
+
*/
|
|
722
740
|
metadata: CommandMetadata;
|
|
741
|
+
/**
|
|
742
|
+
* The data for this command.
|
|
743
|
+
*/
|
|
723
744
|
data: AppCommand;
|
|
724
745
|
}
|
|
725
746
|
/**
|
|
@@ -784,117 +805,118 @@ type CommandDataSchemaValue = CommandDataSchema[CommandDataSchemaKey];
|
|
|
784
805
|
declare class AppCommandHandler {
|
|
785
806
|
readonly commandkit: CommandKit;
|
|
786
807
|
/**
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
808
|
+
* @private
|
|
809
|
+
* @internal
|
|
810
|
+
*/
|
|
790
811
|
private loadedCommands;
|
|
791
812
|
/**
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
813
|
+
* @private
|
|
814
|
+
* @internal
|
|
815
|
+
*/
|
|
795
816
|
private loadedMiddlewares;
|
|
796
817
|
/**
|
|
797
|
-
|
|
798
|
-
|
|
818
|
+
* Command registrar for handling Discord API registration.
|
|
819
|
+
*/
|
|
799
820
|
readonly registrar: CommandRegistrar;
|
|
800
821
|
/**
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
822
|
+
* @private
|
|
823
|
+
* @internal
|
|
824
|
+
*/
|
|
804
825
|
private onInteraction;
|
|
805
826
|
/**
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
827
|
+
* @private
|
|
828
|
+
* @internal
|
|
829
|
+
*/
|
|
809
830
|
private onMessageCreate;
|
|
810
831
|
/**
|
|
811
|
-
|
|
812
|
-
|
|
832
|
+
* Command runner instance for executing commands.
|
|
833
|
+
*/
|
|
813
834
|
readonly commandRunner: AppCommandRunner;
|
|
814
835
|
/**
|
|
815
|
-
|
|
816
|
-
|
|
836
|
+
* External command data storage.
|
|
837
|
+
*/
|
|
817
838
|
readonly externalCommandData: Collection<string, Command>;
|
|
818
839
|
/**
|
|
819
|
-
|
|
820
|
-
|
|
840
|
+
* External middleware data storage.
|
|
841
|
+
*/
|
|
821
842
|
readonly externalMiddlewareData: Collection<string, Middleware>;
|
|
822
843
|
/**
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
844
|
+
* Creates a new AppCommandHandler instance.
|
|
845
|
+
* @param commandkit - The CommandKit instance
|
|
846
|
+
*/
|
|
826
847
|
constructor(commandkit: CommandKit);
|
|
827
848
|
/**
|
|
828
|
-
|
|
829
|
-
|
|
849
|
+
* Prints a formatted banner showing all loaded commands organized by category.
|
|
850
|
+
*/
|
|
830
851
|
printBanner(): void;
|
|
831
852
|
/**
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
853
|
+
* Gets an array of all loaded commands.
|
|
854
|
+
* @returns Array of loaded commands
|
|
855
|
+
*/
|
|
835
856
|
getCommandsArray(): LoadedCommand[];
|
|
836
857
|
/**
|
|
837
|
-
|
|
838
|
-
|
|
858
|
+
* Registers event handlers for Discord interactions and messages.
|
|
859
|
+
*/
|
|
839
860
|
registerCommandHandler(): void;
|
|
840
861
|
/**
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
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
|
+
*/
|
|
846
867
|
prepareCommandRun(source: Interaction | Message, cmdName?: string): Promise<PreparedAppCommandExecution | null>;
|
|
847
868
|
/**
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
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
|
+
*/
|
|
853
874
|
private findCommandByName;
|
|
875
|
+
resolveMessageCommandName(name: string): string;
|
|
854
876
|
/**
|
|
855
|
-
|
|
856
|
-
|
|
877
|
+
* Reloads all commands and middleware from scratch.
|
|
878
|
+
*/
|
|
857
879
|
reloadCommands(): Promise<void>;
|
|
858
880
|
/**
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
881
|
+
* Adds external middleware data to be loaded.
|
|
882
|
+
* @param data - Array of middleware data to add
|
|
883
|
+
*/
|
|
862
884
|
addExternalMiddleware(data: Middleware[]): Promise<void>;
|
|
863
885
|
/**
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
886
|
+
* Adds external command data to be loaded.
|
|
887
|
+
* @param data - Array of command data to add
|
|
888
|
+
*/
|
|
867
889
|
addExternalCommands(data: Command[]): Promise<void>;
|
|
868
890
|
/**
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
891
|
+
* Registers externally loaded middleware.
|
|
892
|
+
* @param data - Array of loaded middleware to register
|
|
893
|
+
*/
|
|
872
894
|
registerExternalLoadedMiddleware(data: LoadedMiddleware[]): Promise<void>;
|
|
873
895
|
/**
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
896
|
+
* Registers externally loaded commands.
|
|
897
|
+
* @param data - Array of loaded commands to register
|
|
898
|
+
*/
|
|
877
899
|
registerExternalLoadedCommands(data: LoadedCommand[]): Promise<void>;
|
|
878
900
|
/**
|
|
879
|
-
|
|
880
|
-
|
|
901
|
+
* Loads all commands and middleware from the router.
|
|
902
|
+
*/
|
|
881
903
|
loadCommands(): Promise<void>;
|
|
882
904
|
/**
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
905
|
+
* @private
|
|
906
|
+
* @internal
|
|
907
|
+
*/
|
|
886
908
|
private loadMiddleware;
|
|
887
909
|
/**
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
910
|
+
* @private
|
|
911
|
+
* @internal
|
|
912
|
+
*/
|
|
891
913
|
private loadCommand;
|
|
892
914
|
/**
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
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
|
+
*/
|
|
898
920
|
getMetadataFor(command: string, hint?: 'user' | 'message'): CommandMetadata | null;
|
|
899
921
|
}
|
|
900
922
|
//#endregion
|
|
@@ -912,18 +934,18 @@ declare class CommandKitEventsChannel {
|
|
|
912
934
|
readonly commandkit: CommandKit;
|
|
913
935
|
private emitter;
|
|
914
936
|
/**
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
937
|
+
* Creates a new instance of CommandKitEventsChannel.
|
|
938
|
+
* @param commandkit The CommandKit instance that this channel belongs to.
|
|
939
|
+
*/
|
|
918
940
|
constructor(commandkit: CommandKit);
|
|
919
941
|
/**
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
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
|
+
*/
|
|
927
949
|
to(namespace: string): {
|
|
928
950
|
on: (event: string, listener: ListenerFunction) => void;
|
|
929
951
|
off: (event: string, listener: ListenerFunction) => void;
|
|
@@ -932,40 +954,40 @@ declare class CommandKitEventsChannel {
|
|
|
932
954
|
removeAllListeners: (event: string) => void;
|
|
933
955
|
};
|
|
934
956
|
/**
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
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
|
+
*/
|
|
940
962
|
on(namespace: string, event: string, listener: ListenerFunction): void;
|
|
941
963
|
/**
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
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
|
+
*/
|
|
947
969
|
off(namespace: string, event: string, listener: ListenerFunction): void;
|
|
948
970
|
/**
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
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
|
+
*/
|
|
955
977
|
once(namespace: string, event: string, listener: ListenerFunction): void;
|
|
956
978
|
/**
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
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
|
+
*/
|
|
963
985
|
emit(namespace: string, event: string, ...args: any[]): boolean;
|
|
964
986
|
/**
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
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
|
+
*/
|
|
969
991
|
removeAllListeners(namespace: string): void;
|
|
970
992
|
removeAllListeners(namespace: string, event: string): void;
|
|
971
993
|
}
|
|
@@ -977,6 +999,7 @@ declare class CommandKitEventsChannel {
|
|
|
977
999
|
type EventListener = {
|
|
978
1000
|
handler: ListenerFunction;
|
|
979
1001
|
once: boolean;
|
|
1002
|
+
parallel: boolean;
|
|
980
1003
|
};
|
|
981
1004
|
/**
|
|
982
1005
|
* Represents a loaded event with all its listeners.
|
|
@@ -1005,39 +1028,39 @@ interface AppEventsHandlerLoadedData {
|
|
|
1005
1028
|
declare class AppEventsHandler {
|
|
1006
1029
|
readonly commandkit: CommandKit;
|
|
1007
1030
|
/**
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1031
|
+
* @private
|
|
1032
|
+
* @internal
|
|
1033
|
+
*/
|
|
1011
1034
|
private loadedEvents;
|
|
1012
1035
|
/**
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1036
|
+
* Creates a new AppEventsHandler instance.
|
|
1037
|
+
* @param commandkit - The CommandKit instance
|
|
1038
|
+
*/
|
|
1016
1039
|
constructor(commandkit: CommandKit);
|
|
1017
1040
|
/**
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1041
|
+
* Gets information about all loaded events.
|
|
1042
|
+
* @returns Array of loaded event data
|
|
1043
|
+
*/
|
|
1021
1044
|
getEvents(): AppEventsHandlerLoadedData[];
|
|
1022
1045
|
/**
|
|
1023
|
-
|
|
1024
|
-
|
|
1046
|
+
* Reloads all events by unregistering existing ones and loading them again.
|
|
1047
|
+
*/
|
|
1025
1048
|
reloadEvents(): Promise<void>;
|
|
1026
1049
|
/**
|
|
1027
|
-
|
|
1028
|
-
|
|
1050
|
+
* Loads all events from the events router and registers them with Discord.js client.
|
|
1051
|
+
*/
|
|
1029
1052
|
loadEvents(): Promise<void>;
|
|
1030
1053
|
/**
|
|
1031
|
-
|
|
1032
|
-
|
|
1054
|
+
* Unregisters all event listeners and clears loaded events.
|
|
1055
|
+
*/
|
|
1033
1056
|
unregisterAll(): void;
|
|
1034
1057
|
/**
|
|
1035
|
-
|
|
1036
|
-
|
|
1058
|
+
* Registers all loaded events with the Discord.js client and CommandKit event system.
|
|
1059
|
+
*/
|
|
1037
1060
|
registerAllClientEvents(): void;
|
|
1038
1061
|
/**
|
|
1039
|
-
|
|
1040
|
-
|
|
1062
|
+
* Unregisters all client event listeners and cleans up loaded events.
|
|
1063
|
+
*/
|
|
1041
1064
|
unregisterAllClientListeners(): void;
|
|
1042
1065
|
}
|
|
1043
1066
|
//#endregion
|
|
@@ -1047,16 +1070,16 @@ declare class AppEventsHandler {
|
|
|
1047
1070
|
*/
|
|
1048
1071
|
interface IpcMessageCommand {
|
|
1049
1072
|
/**
|
|
1050
|
-
|
|
1051
|
-
|
|
1073
|
+
* The type of HMR event being communicated.
|
|
1074
|
+
*/
|
|
1052
1075
|
event: HMREventType;
|
|
1053
1076
|
/**
|
|
1054
|
-
|
|
1055
|
-
|
|
1077
|
+
* The path associated with the HMR event.
|
|
1078
|
+
*/
|
|
1056
1079
|
path: string;
|
|
1057
1080
|
/**
|
|
1058
|
-
|
|
1059
|
-
|
|
1081
|
+
* An optional identifier for the HMR event, used for acknowledgment.
|
|
1082
|
+
*/
|
|
1060
1083
|
id?: string;
|
|
1061
1084
|
}
|
|
1062
1085
|
/**
|
|
@@ -1064,22 +1087,22 @@ interface IpcMessageCommand {
|
|
|
1064
1087
|
*/
|
|
1065
1088
|
interface CommandKitHMREvent {
|
|
1066
1089
|
/**
|
|
1067
|
-
|
|
1068
|
-
|
|
1090
|
+
* The type of HMR event.
|
|
1091
|
+
*/
|
|
1069
1092
|
event: HMREventType;
|
|
1070
1093
|
/**
|
|
1071
|
-
|
|
1072
|
-
|
|
1094
|
+
* The path associated with the HMR event.
|
|
1095
|
+
*/
|
|
1073
1096
|
path: string;
|
|
1074
1097
|
/**
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1098
|
+
* Accepts the HMR event, indicating that it has been handled.
|
|
1099
|
+
* This prevents further processing of the event.
|
|
1100
|
+
*/
|
|
1078
1101
|
accept: () => void;
|
|
1079
1102
|
/**
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1103
|
+
* Prevents the default action for the HMR event.
|
|
1104
|
+
* This can be used to stop further processing of the event.
|
|
1105
|
+
*/
|
|
1083
1106
|
preventDefault: () => void;
|
|
1084
1107
|
}
|
|
1085
1108
|
/**
|
|
@@ -1096,106 +1119,106 @@ declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> ex
|
|
|
1096
1119
|
readonly type = PluginType.Runtime;
|
|
1097
1120
|
readonly preload: Set<string>;
|
|
1098
1121
|
/**
|
|
1099
|
-
|
|
1100
|
-
|
|
1122
|
+
* Called before commands are loaded
|
|
1123
|
+
*/
|
|
1101
1124
|
onBeforeCommandsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1102
1125
|
/**
|
|
1103
|
-
|
|
1104
|
-
|
|
1126
|
+
* Called after commands are loaded
|
|
1127
|
+
*/
|
|
1105
1128
|
onAfterCommandsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1106
1129
|
/**
|
|
1107
|
-
|
|
1108
|
-
|
|
1130
|
+
* Called before events are loaded
|
|
1131
|
+
*/
|
|
1109
1132
|
onBeforeEventsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1110
1133
|
/**
|
|
1111
|
-
|
|
1112
|
-
|
|
1134
|
+
* Called after events are loaded
|
|
1135
|
+
*/
|
|
1113
1136
|
onAfterEventsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1114
1137
|
/**
|
|
1115
|
-
|
|
1116
|
-
|
|
1138
|
+
* Called before the client logs in
|
|
1139
|
+
*/
|
|
1117
1140
|
onBeforeClientLogin(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1118
1141
|
/**
|
|
1119
|
-
|
|
1120
|
-
|
|
1142
|
+
* Called after the client logs in
|
|
1143
|
+
*/
|
|
1121
1144
|
onAfterClientLogin(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1122
1145
|
/**
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1146
|
+
* Called before interaction is handled
|
|
1147
|
+
* @param interaction The interaction
|
|
1148
|
+
*/
|
|
1126
1149
|
onBeforeInteraction(ctx: CommandKitPluginRuntime, interaction: Interaction): Promise<void>;
|
|
1127
1150
|
/**
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1151
|
+
* Called before message command is processed
|
|
1152
|
+
* @param message The message
|
|
1153
|
+
*/
|
|
1131
1154
|
onBeforeMessageCommand(ctx: CommandKitPluginRuntime, message: Message): Promise<void>;
|
|
1132
1155
|
/**
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
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
|
+
*/
|
|
1138
1161
|
executeCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment, source: Interaction | Message, command: PreparedAppCommandExecution, execute: () => Promise<any>): Promise<boolean>;
|
|
1139
1162
|
/**
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1163
|
+
* Called after events router is initialized
|
|
1164
|
+
* @param ctx The context
|
|
1165
|
+
*/
|
|
1143
1166
|
onEventsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1144
1167
|
/**
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1168
|
+
* Called after commands router is initialized
|
|
1169
|
+
* @param ctx The context
|
|
1170
|
+
*/
|
|
1148
1171
|
onCommandsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1149
1172
|
/**
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1173
|
+
* Called when HMR event is received
|
|
1174
|
+
* @param ctx The context
|
|
1175
|
+
* @param event The event
|
|
1176
|
+
*/
|
|
1154
1177
|
performHMR(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent): Promise<void>;
|
|
1155
1178
|
/**
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
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
|
+
*/
|
|
1160
1183
|
prepareCommand(ctx: CommandKitPluginRuntime, commands: CommandBuilderLike): Promise<CommandBuilderLike | null>;
|
|
1161
1184
|
/**
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
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
|
+
*/
|
|
1166
1189
|
onBeforeRegisterCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1167
1190
|
/**
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
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
|
+
*/
|
|
1173
1196
|
onBeforeRegisterGlobalCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1174
1197
|
/**
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
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
|
+
*/
|
|
1180
1203
|
onBeforePrepareGuildCommandsRegistration(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1181
1204
|
/**
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
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
|
+
*/
|
|
1187
1210
|
onBeforeRegisterGuildCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
1188
1211
|
/**
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
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
|
+
*/
|
|
1193
1216
|
onAfterCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment): Promise<void>;
|
|
1194
1217
|
/**
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1218
|
+
* Called before emitting an event
|
|
1219
|
+
* @param ctx The context
|
|
1220
|
+
* @param event The event that is being emitted
|
|
1221
|
+
*/
|
|
1199
1222
|
willEmitEvent(ctx: CommandKitPluginRuntime, event: CommandKitEventDispatch): Promise<void>;
|
|
1200
1223
|
}
|
|
1201
1224
|
declare function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin;
|
|
@@ -1214,28 +1237,28 @@ type MaybeFalsey<T> = T | false | null | undefined;
|
|
|
1214
1237
|
*/
|
|
1215
1238
|
interface CommandKitEventDispatch {
|
|
1216
1239
|
/**
|
|
1217
|
-
|
|
1218
|
-
|
|
1240
|
+
* The name of the event.
|
|
1241
|
+
*/
|
|
1219
1242
|
name: string;
|
|
1220
1243
|
/**
|
|
1221
|
-
|
|
1222
|
-
|
|
1244
|
+
* The arguments passed to the event.
|
|
1245
|
+
*/
|
|
1223
1246
|
args: unknown[];
|
|
1224
1247
|
/**
|
|
1225
|
-
|
|
1226
|
-
|
|
1248
|
+
* The namespace of the event, if any.
|
|
1249
|
+
*/
|
|
1227
1250
|
namespace: string | null;
|
|
1228
1251
|
/**
|
|
1229
|
-
|
|
1230
|
-
|
|
1252
|
+
* If this event runs only once, it will be set to true.
|
|
1253
|
+
*/
|
|
1231
1254
|
once: boolean;
|
|
1232
1255
|
/**
|
|
1233
|
-
|
|
1234
|
-
|
|
1256
|
+
* The additional metadata associated with the event.
|
|
1257
|
+
*/
|
|
1235
1258
|
metadata: ParsedEvent;
|
|
1236
1259
|
/**
|
|
1237
|
-
|
|
1238
|
-
|
|
1260
|
+
* Captures the owner of the event, preventing other plugins from handling it.
|
|
1261
|
+
*/
|
|
1239
1262
|
accept(): void;
|
|
1240
1263
|
}
|
|
1241
1264
|
/**
|
|
@@ -1250,22 +1273,22 @@ type TemplateHandler = (args: string[]) => Promise<void> | void;
|
|
|
1250
1273
|
*/
|
|
1251
1274
|
interface PluginTransformParameters {
|
|
1252
1275
|
/**
|
|
1253
|
-
|
|
1254
|
-
|
|
1276
|
+
* The code to be transformed.
|
|
1277
|
+
*/
|
|
1255
1278
|
code: string;
|
|
1256
1279
|
/**
|
|
1257
|
-
|
|
1258
|
-
|
|
1280
|
+
* The filename of the code being transformed.
|
|
1281
|
+
*/
|
|
1259
1282
|
id: string;
|
|
1260
1283
|
}
|
|
1261
1284
|
interface TransformedResult {
|
|
1262
1285
|
/**
|
|
1263
|
-
|
|
1264
|
-
|
|
1286
|
+
* The transformed code.
|
|
1287
|
+
*/
|
|
1265
1288
|
code?: string;
|
|
1266
1289
|
/**
|
|
1267
|
-
|
|
1268
|
-
|
|
1290
|
+
* The source map for the transformed code, if applicable.
|
|
1291
|
+
*/
|
|
1269
1292
|
map?: string | null;
|
|
1270
1293
|
}
|
|
1271
1294
|
/**
|
|
@@ -1273,14 +1296,14 @@ interface TransformedResult {
|
|
|
1273
1296
|
*/
|
|
1274
1297
|
declare abstract class CompilerPlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CompilerPluginRuntime> {
|
|
1275
1298
|
/**
|
|
1276
|
-
|
|
1277
|
-
|
|
1299
|
+
* The type of the plugin, which is Compiler.
|
|
1300
|
+
*/
|
|
1278
1301
|
readonly type = PluginType.Compiler;
|
|
1279
1302
|
/**
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1303
|
+
* Called when transformation is requested to this plugin
|
|
1304
|
+
* @param params The parameters for the transformation
|
|
1305
|
+
* @returns The transformed result
|
|
1306
|
+
*/
|
|
1284
1307
|
transform(params: PluginTransformParameters): Promise<MaybeFalsey<TransformedResult>>;
|
|
1285
1308
|
}
|
|
1286
1309
|
/**
|
|
@@ -1296,9 +1319,9 @@ declare function isCompilerPlugin(plugin: unknown): plugin is CompilerPlugin;
|
|
|
1296
1319
|
*/
|
|
1297
1320
|
type CommonDirectiveTransformerOptions = DirectiveTransformerOptions & {
|
|
1298
1321
|
/**
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1322
|
+
* Whether the directive transformer is enabled.
|
|
1323
|
+
* Defaults to true.
|
|
1324
|
+
*/
|
|
1302
1325
|
enabled?: boolean;
|
|
1303
1326
|
};
|
|
1304
1327
|
/**
|
|
@@ -1318,72 +1341,74 @@ declare abstract class CommonDirectiveTransformer extends CompilerPlugin<CommonD
|
|
|
1318
1341
|
declare class CompilerPluginRuntime {
|
|
1319
1342
|
#private;
|
|
1320
1343
|
private readonly plugins;
|
|
1344
|
+
readonly isDevMode: boolean;
|
|
1321
1345
|
readonly name = "CompilerPluginRuntime";
|
|
1322
1346
|
private initialized;
|
|
1323
1347
|
private templates;
|
|
1324
1348
|
/**
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
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
|
+
constructor(plugins: CompilerPlugin[], isDevMode: boolean);
|
|
1329
1354
|
/**
|
|
1330
|
-
|
|
1331
|
-
|
|
1355
|
+
* Returns the plugins managed by this runtime.
|
|
1356
|
+
*/
|
|
1332
1357
|
getPlugins(): CompilerPlugin<PluginOptions>[];
|
|
1333
1358
|
/**
|
|
1334
|
-
|
|
1335
|
-
|
|
1359
|
+
* Checks if there are no plugins registered in this runtime.
|
|
1360
|
+
*/
|
|
1336
1361
|
isEmpty(): boolean;
|
|
1337
1362
|
/**
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
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
|
+
*/
|
|
1343
1368
|
registerTemplate(name: string, handler: TemplateHandler): void;
|
|
1344
1369
|
/**
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
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
|
+
*/
|
|
1349
1374
|
unregisterTemplate(name: string): void;
|
|
1350
1375
|
/**
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
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
|
+
*/
|
|
1355
1380
|
getTemplate(name: string): TemplateHandler | undefined;
|
|
1356
1381
|
/**
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
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
|
+
*/
|
|
1360
1385
|
getTemplates(): Map<string, TemplateHandler>;
|
|
1361
1386
|
/**
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
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
|
+
*/
|
|
1368
1393
|
transform(code: string, id: string): Promise<{
|
|
1369
1394
|
code: string;
|
|
1370
1395
|
map: string | null;
|
|
1371
1396
|
}>;
|
|
1372
1397
|
/**
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1398
|
+
* Initializes the plugin runtime by activating all registered plugins.
|
|
1399
|
+
* This method should be called once to set up the plugins.
|
|
1400
|
+
*/
|
|
1376
1401
|
init(): Promise<void>;
|
|
1377
1402
|
/**
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1403
|
+
* Destroys the plugin runtime by deactivating all registered plugins.
|
|
1404
|
+
* This method should be called when the runtime is no longer needed.
|
|
1405
|
+
*/
|
|
1381
1406
|
destroy(): Promise<void>;
|
|
1382
1407
|
/**
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
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
|
+
*/
|
|
1387
1412
|
toJSON(): {
|
|
1388
1413
|
name: string;
|
|
1389
1414
|
transform: (code: string, id: string) => Promise<{
|
|
@@ -1419,32 +1444,32 @@ declare enum PluginType {
|
|
|
1419
1444
|
declare abstract class PluginCommon<T extends PluginOptions = PluginOptions, C extends CommonPluginRuntime = CommonPluginRuntime> {
|
|
1420
1445
|
protected readonly options: T;
|
|
1421
1446
|
/**
|
|
1422
|
-
|
|
1423
|
-
|
|
1447
|
+
* The type of the plugin, either Compiler or Runtime.
|
|
1448
|
+
*/
|
|
1424
1449
|
abstract readonly type: PluginType;
|
|
1425
1450
|
/**
|
|
1426
|
-
|
|
1427
|
-
|
|
1451
|
+
* Unique identifier for the plugin instance.
|
|
1452
|
+
*/
|
|
1428
1453
|
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
1429
1454
|
/**
|
|
1430
|
-
|
|
1431
|
-
|
|
1455
|
+
* The time when the plugin was loaded, in milliseconds since the Unix epoch.
|
|
1456
|
+
*/
|
|
1432
1457
|
readonly loadedAt: number;
|
|
1433
1458
|
/**
|
|
1434
|
-
|
|
1435
|
-
|
|
1459
|
+
* The name of the plugin.
|
|
1460
|
+
*/
|
|
1436
1461
|
abstract readonly name: string;
|
|
1437
1462
|
/**
|
|
1438
|
-
|
|
1439
|
-
|
|
1463
|
+
* Creates a new instance of the plugin.
|
|
1464
|
+
*/
|
|
1440
1465
|
constructor(options: T);
|
|
1441
1466
|
/**
|
|
1442
|
-
|
|
1443
|
-
|
|
1467
|
+
* Called when this plugin is activated
|
|
1468
|
+
*/
|
|
1444
1469
|
activate(ctx: C): Promise<void>;
|
|
1445
1470
|
/**
|
|
1446
|
-
|
|
1447
|
-
|
|
1471
|
+
* Called when this plugin is deactivated
|
|
1472
|
+
*/
|
|
1448
1473
|
deactivate(ctx: C): Promise<void>;
|
|
1449
1474
|
}
|
|
1450
1475
|
/**
|
|
@@ -1462,61 +1487,61 @@ declare class CommandKitPluginRuntime {
|
|
|
1462
1487
|
readonly commandkit: CommandKit;
|
|
1463
1488
|
private plugins;
|
|
1464
1489
|
/**
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1490
|
+
* Creates a new instance of CommandKitPluginRuntime.
|
|
1491
|
+
* @param commandkit The CommandKit instance associated with this runtime.
|
|
1492
|
+
*/
|
|
1468
1493
|
constructor(commandkit: CommandKit);
|
|
1469
1494
|
/**
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1495
|
+
* Returns the plugins registered in this runtime.
|
|
1496
|
+
* @returns A collection of plugins.
|
|
1497
|
+
*/
|
|
1473
1498
|
getPlugins(): Collection<string, RuntimePlugin<PluginOptions>>;
|
|
1474
1499
|
/**
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
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
|
+
*/
|
|
1479
1504
|
getPlugin(pluginName: string): RuntimePlugin | null;
|
|
1480
1505
|
/**
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1506
|
+
* Fetches the given plugin
|
|
1507
|
+
* @param plugin The plugin to be fetched.
|
|
1508
|
+
*/
|
|
1484
1509
|
get<T extends Constructable<any>>(plugin: T): InstanceType<T> | null;
|
|
1485
1510
|
/**
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1511
|
+
* Pre-loads the specified entrypoints for the given plugin.
|
|
1512
|
+
* @param plugin The plugin to pre-load.
|
|
1513
|
+
*/
|
|
1489
1514
|
preload(plugin: RuntimePlugin): Promise<void>;
|
|
1490
1515
|
/**
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1516
|
+
* Soft registers a plugin in the runtime.
|
|
1517
|
+
* @param plugin The plugin to be registered.
|
|
1518
|
+
*/
|
|
1494
1519
|
softRegisterPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
1495
1520
|
/**
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
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
|
+
*/
|
|
1500
1525
|
registerPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
1501
1526
|
/**
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1527
|
+
* Unregisters a plugin from the runtime.
|
|
1528
|
+
* @param plugin The plugin to be unregistered.
|
|
1529
|
+
* @throws If the plugin does not exist.
|
|
1530
|
+
*/
|
|
1506
1531
|
unregisterPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
1507
1532
|
/**
|
|
1508
|
-
|
|
1509
|
-
|
|
1533
|
+
* Unregisters all plugins from the runtime.
|
|
1534
|
+
*/
|
|
1510
1535
|
unregisterAllPlugins(): Promise<void>;
|
|
1511
1536
|
/**
|
|
1512
|
-
|
|
1513
|
-
|
|
1537
|
+
* Signals the runtime to allow the current plugin take ownership of the execution context.
|
|
1538
|
+
*/
|
|
1514
1539
|
capture(): void;
|
|
1515
1540
|
/**
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
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
|
+
*/
|
|
1520
1545
|
execute<R = any>(f: AsyncFunction<[CommandKitPluginRuntime, RuntimePlugin], R | undefined>): Promise<true | R | undefined>;
|
|
1521
1546
|
}
|
|
1522
1547
|
//#endregion
|
|
@@ -1528,24 +1553,24 @@ declare class CommandKitPluginRuntime {
|
|
|
1528
1553
|
*/
|
|
1529
1554
|
interface FlagProvider {
|
|
1530
1555
|
/**
|
|
1531
|
-
|
|
1532
|
-
|
|
1556
|
+
* Initialize the provider (e.g., establish connections, load initial config)
|
|
1557
|
+
*/
|
|
1533
1558
|
initialize?(): MaybePromise<void>;
|
|
1534
1559
|
/**
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
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
|
+
*/
|
|
1540
1565
|
getFlag(key: string, context?: any): MaybePromise<FlagConfiguration | null>;
|
|
1541
1566
|
/**
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1567
|
+
* Check if a flag exists in the external system
|
|
1568
|
+
* @param key - The feature flag key
|
|
1569
|
+
*/
|
|
1545
1570
|
hasFlag(key: string): MaybePromise<boolean>;
|
|
1546
1571
|
/**
|
|
1547
|
-
|
|
1548
|
-
|
|
1572
|
+
* Cleanup resources when the provider is no longer needed
|
|
1573
|
+
*/
|
|
1549
1574
|
destroy?(): MaybePromise<void>;
|
|
1550
1575
|
}
|
|
1551
1576
|
/**
|
|
@@ -1553,20 +1578,20 @@ interface FlagProvider {
|
|
|
1553
1578
|
*/
|
|
1554
1579
|
interface FlagConfiguration {
|
|
1555
1580
|
/**
|
|
1556
|
-
|
|
1557
|
-
|
|
1581
|
+
* Whether the flag is enabled/disabled at the provider level
|
|
1582
|
+
*/
|
|
1558
1583
|
enabled: boolean;
|
|
1559
1584
|
/**
|
|
1560
|
-
|
|
1561
|
-
|
|
1585
|
+
* Optional configuration data that can be used in the decide function
|
|
1586
|
+
*/
|
|
1562
1587
|
config?: Record<string, any>;
|
|
1563
1588
|
/**
|
|
1564
|
-
|
|
1565
|
-
|
|
1589
|
+
* Optional percentage for gradual rollouts (0-100)
|
|
1590
|
+
*/
|
|
1566
1591
|
percentage?: number;
|
|
1567
1592
|
/**
|
|
1568
|
-
|
|
1569
|
-
|
|
1593
|
+
* Optional targeting rules or segments
|
|
1594
|
+
*/
|
|
1570
1595
|
targeting?: {
|
|
1571
1596
|
segments?: string[];
|
|
1572
1597
|
rules?: Array<{
|
|
@@ -1622,30 +1647,30 @@ type DecideFunction<E, R> = (data: {
|
|
|
1622
1647
|
*/
|
|
1623
1648
|
interface FeatureFlagDefinition<R, Entity> {
|
|
1624
1649
|
/**
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1650
|
+
* Unique key for the feature flag.
|
|
1651
|
+
* Should be a string that identifies the flag.
|
|
1652
|
+
*/
|
|
1628
1653
|
key: string;
|
|
1629
1654
|
/**
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1655
|
+
* Optional description of the feature flag.
|
|
1656
|
+
* This can be used for documentation or debugging purposes.
|
|
1657
|
+
*/
|
|
1633
1658
|
description?: string;
|
|
1634
1659
|
/**
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
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
|
+
*/
|
|
1639
1664
|
identify?: IdentifyFunction<Entity>;
|
|
1640
1665
|
/**
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
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
|
+
*/
|
|
1644
1669
|
decide: DecideFunction<Entity, R>;
|
|
1645
1670
|
/**
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1671
|
+
* Whether to disable analytics tracking for this flag.
|
|
1672
|
+
* Default: false
|
|
1673
|
+
*/
|
|
1649
1674
|
disableAnalytics?: boolean;
|
|
1650
1675
|
}
|
|
1651
1676
|
/**
|
|
@@ -1653,49 +1678,49 @@ interface FeatureFlagDefinition<R, Entity> {
|
|
|
1653
1678
|
*/
|
|
1654
1679
|
interface CommandFlagContext {
|
|
1655
1680
|
/**
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1681
|
+
* The Discord client instance.
|
|
1682
|
+
* This is the main entry point for interacting with the Discord API.
|
|
1683
|
+
*/
|
|
1659
1684
|
client: Client<true>;
|
|
1660
1685
|
/**
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1686
|
+
* The CommandKit instance, which provides access to the command framework.
|
|
1687
|
+
* This includes commands, events, and other features of CommandKit.
|
|
1688
|
+
*/
|
|
1664
1689
|
commandkit: CommandKit;
|
|
1665
1690
|
/**
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
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
|
+
*/
|
|
1669
1694
|
command: {
|
|
1670
1695
|
/**
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1696
|
+
* The interaction object if the command was invoked via an interaction.
|
|
1697
|
+
* This can be a ChatInputCommandInteraction, AutocompleteInteraction, or ContextMenuCommandInteraction.
|
|
1698
|
+
*/
|
|
1674
1699
|
interaction?: ChatInputCommandInteraction | AutocompleteInteraction | ContextMenuCommandInteraction;
|
|
1675
1700
|
/**
|
|
1676
|
-
|
|
1677
|
-
|
|
1701
|
+
* The message object if the command was invoked via a message.
|
|
1702
|
+
*/
|
|
1678
1703
|
message?: Message;
|
|
1679
1704
|
/**
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1705
|
+
* The guild where the command was invoked, if applicable.
|
|
1706
|
+
* This will be null for commands invoked in DMs.
|
|
1707
|
+
*/
|
|
1683
1708
|
guild: Guild | null;
|
|
1684
1709
|
/**
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
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
|
+
*/
|
|
1688
1713
|
channel: TextBasedChannel | null;
|
|
1689
1714
|
/**
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1715
|
+
* The loaded command instance that is being executed.
|
|
1716
|
+
* This contains the command's metadata and logic.
|
|
1717
|
+
*/
|
|
1693
1718
|
command: LoadedCommand;
|
|
1694
1719
|
};
|
|
1695
1720
|
/**
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
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
|
+
*/
|
|
1699
1724
|
event: null;
|
|
1700
1725
|
}
|
|
1701
1726
|
/**
|
|
@@ -1703,53 +1728,53 @@ interface CommandFlagContext {
|
|
|
1703
1728
|
*/
|
|
1704
1729
|
interface EventFlagContext {
|
|
1705
1730
|
/**
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1731
|
+
* The Discord client instance.
|
|
1732
|
+
* This is the main entry point for interacting with the Discord API.
|
|
1733
|
+
*/
|
|
1709
1734
|
client: Client<true>;
|
|
1710
1735
|
/**
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1736
|
+
* The CommandKit instance, which provides access to the command framework.
|
|
1737
|
+
* This includes commands, events, and other features of CommandKit.
|
|
1738
|
+
*/
|
|
1714
1739
|
commandkit: CommandKit;
|
|
1715
1740
|
/**
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
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
|
+
*/
|
|
1719
1744
|
event: {
|
|
1720
1745
|
/**
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
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
|
+
*/
|
|
1724
1749
|
data: ParsedEvent;
|
|
1725
1750
|
/**
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1751
|
+
* The name of the event being processed.
|
|
1752
|
+
* This is the string identifier for the event, such as 'messageCreate' or 'guildMemberAdd'.
|
|
1753
|
+
*/
|
|
1729
1754
|
event: string;
|
|
1730
1755
|
/**
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
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
|
+
*/
|
|
1735
1760
|
namespace: string | null;
|
|
1736
1761
|
/**
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
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
|
+
*/
|
|
1741
1766
|
arguments: any[];
|
|
1742
1767
|
/**
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
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
|
+
*/
|
|
1747
1772
|
argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E];
|
|
1748
1773
|
};
|
|
1749
1774
|
/**
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
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
|
+
*/
|
|
1753
1778
|
command: null;
|
|
1754
1779
|
}
|
|
1755
1780
|
/**
|
|
@@ -1769,25 +1794,25 @@ type CustomEvaluationFunction<E> = () => MaybePromise<E>;
|
|
|
1769
1794
|
*/
|
|
1770
1795
|
type CustomEvaluationContext<E> = {
|
|
1771
1796
|
/**
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
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
|
+
*/
|
|
1775
1800
|
identify: E | CustomEvaluationFunction<E>;
|
|
1776
1801
|
};
|
|
1777
1802
|
interface FlagRunner<E, R> {
|
|
1778
1803
|
/**
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
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
|
+
*/
|
|
1784
1809
|
(): Promise<R>;
|
|
1785
1810
|
/**
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
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
|
+
*/
|
|
1791
1816
|
run(context: CustomEvaluationContext<E>): Promise<R>;
|
|
1792
1817
|
}
|
|
1793
1818
|
/**
|
|
@@ -1797,16 +1822,16 @@ declare class FeatureFlag<R, T> {
|
|
|
1797
1822
|
readonly options: FeatureFlagDefinition<R, T>;
|
|
1798
1823
|
private commandkit;
|
|
1799
1824
|
/**
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1825
|
+
* Create a new feature flag.
|
|
1826
|
+
* @param options - The options for the feature flag.
|
|
1827
|
+
*/
|
|
1803
1828
|
constructor(options: FeatureFlagDefinition<R, T>);
|
|
1804
1829
|
private getContext;
|
|
1805
1830
|
/**
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
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
|
+
*/
|
|
1810
1835
|
execute(res?: T): Promise<R>;
|
|
1811
1836
|
}
|
|
1812
1837
|
/**
|
|
@@ -1826,114 +1851,114 @@ declare class FlagStore extends Collection<string, FeatureFlag<any, any>> {}
|
|
|
1826
1851
|
//#region src/config/types.d.ts
|
|
1827
1852
|
interface CommandKitCompilerOptions {
|
|
1828
1853
|
/**
|
|
1829
|
-
|
|
1830
|
-
|
|
1854
|
+
* The macro compiler options to use with CommandKit.
|
|
1855
|
+
*/
|
|
1831
1856
|
macro?: {
|
|
1832
1857
|
/**
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1858
|
+
* Whether to enable macro function compilation in development mode.
|
|
1859
|
+
* @default false
|
|
1860
|
+
*/
|
|
1836
1861
|
development?: boolean;
|
|
1837
1862
|
};
|
|
1838
1863
|
/**
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
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>;
|
|
1843
1868
|
/**
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1869
|
+
* Disables chunking of the output (production only, development never chunks).
|
|
1870
|
+
* @default false
|
|
1871
|
+
*/
|
|
1847
1872
|
disableChunking?: boolean;
|
|
1848
1873
|
}
|
|
1849
1874
|
interface CommandKitConfig {
|
|
1850
1875
|
/**
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1876
|
+
* The plugins to use with CommandKit.
|
|
1877
|
+
* Can be a single plugin, an array of plugins, or a nested array of plugins.
|
|
1878
|
+
*/
|
|
1854
1879
|
plugins?: MaybeArray<CommandKitPlugin>[] | Array<CommandKitPlugin>;
|
|
1855
1880
|
/**
|
|
1856
|
-
|
|
1857
|
-
|
|
1881
|
+
* The rolldown plugins to use with CommandKit.
|
|
1882
|
+
*/
|
|
1858
1883
|
rolldownPlugins?: any[];
|
|
1859
1884
|
/**
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
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
|
+
*/
|
|
1863
1888
|
entrypoints?: string[];
|
|
1864
1889
|
/**
|
|
1865
|
-
|
|
1866
|
-
|
|
1890
|
+
* The compiler options to use with CommandKit.
|
|
1891
|
+
*/
|
|
1867
1892
|
compilerOptions?: CommandKitCompilerOptions;
|
|
1868
1893
|
/**
|
|
1869
|
-
|
|
1870
|
-
|
|
1894
|
+
* The typescript configuration to use with CommandKit.
|
|
1895
|
+
*/
|
|
1871
1896
|
typescript?: {
|
|
1872
1897
|
/**
|
|
1873
|
-
|
|
1874
|
-
|
|
1898
|
+
* Whether to ignore type checking during builds.
|
|
1899
|
+
*/
|
|
1875
1900
|
ignoreBuildErrors?: boolean;
|
|
1876
1901
|
};
|
|
1877
1902
|
/**
|
|
1878
|
-
|
|
1879
|
-
|
|
1903
|
+
* Whether to generate static command handler data in production builds.
|
|
1904
|
+
*/
|
|
1880
1905
|
static?: boolean;
|
|
1881
1906
|
/**
|
|
1882
|
-
|
|
1883
|
-
|
|
1907
|
+
* Statically define the environment variables to use.
|
|
1908
|
+
*/
|
|
1884
1909
|
env?: Record<string, string>;
|
|
1885
1910
|
/**
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1911
|
+
* The custom build directory name to use.
|
|
1912
|
+
* @default `dist`
|
|
1913
|
+
*/
|
|
1889
1914
|
distDir?: string;
|
|
1890
1915
|
/**
|
|
1891
|
-
|
|
1892
|
-
|
|
1916
|
+
* The anti-crash script configuration.
|
|
1917
|
+
*/
|
|
1893
1918
|
antiCrashScript?: {
|
|
1894
1919
|
/**
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1920
|
+
* Whether to enable the anti-crash script in development mode.
|
|
1921
|
+
* @default true
|
|
1922
|
+
*/
|
|
1898
1923
|
development?: boolean;
|
|
1899
1924
|
/**
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1925
|
+
* Whether to enable the anti-crash script in production mode. Usually, you should use other means to handle errors.
|
|
1926
|
+
* @default false
|
|
1927
|
+
*/
|
|
1903
1928
|
production?: boolean;
|
|
1904
1929
|
};
|
|
1905
1930
|
/**
|
|
1906
|
-
|
|
1907
|
-
|
|
1931
|
+
* Whether or not to enable the source map generation.
|
|
1932
|
+
*/
|
|
1908
1933
|
sourceMap?: {
|
|
1909
1934
|
/**
|
|
1910
|
-
|
|
1911
|
-
|
|
1935
|
+
* Whether to enable source map generation in development mode.
|
|
1936
|
+
*/
|
|
1912
1937
|
development?: boolean;
|
|
1913
1938
|
/**
|
|
1914
|
-
|
|
1915
|
-
|
|
1939
|
+
* Whether to enable source map generation in production mode.
|
|
1940
|
+
*/
|
|
1916
1941
|
production?: boolean;
|
|
1917
1942
|
};
|
|
1918
1943
|
/**
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1944
|
+
* Whether or not to enable the typed commands.
|
|
1945
|
+
* @default true
|
|
1946
|
+
*/
|
|
1922
1947
|
typedCommands?: boolean;
|
|
1923
1948
|
/**
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1949
|
+
* Whether or not to disable the prefix commands.
|
|
1950
|
+
* @default false
|
|
1951
|
+
*/
|
|
1927
1952
|
disablePrefixCommands?: boolean;
|
|
1928
1953
|
/**
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
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
|
+
*/
|
|
1932
1957
|
disablePermissionsMiddleware?: boolean;
|
|
1933
1958
|
/**
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1959
|
+
* Whether or not to show a warning when a prefix command is not found. This only affects development mode.
|
|
1960
|
+
* @default true
|
|
1961
|
+
*/
|
|
1937
1962
|
showUnknownPrefixCommandsWarning?: boolean;
|
|
1938
1963
|
}
|
|
1939
1964
|
//#endregion
|
|
@@ -1965,16 +1990,16 @@ type ResolvedCommandKitConfig = DeepRequired<CommandKitConfig, 'compilerOptions'
|
|
|
1965
1990
|
*/
|
|
1966
1991
|
interface CommandKitConfiguration {
|
|
1967
1992
|
/**
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
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
|
+
*/
|
|
1971
1996
|
defaultLocale: Locale;
|
|
1972
1997
|
/**
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
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
|
+
*/
|
|
1978
2003
|
getMessageCommandPrefix: (message: Message) => Awaitable<string | string[] | RegExp>;
|
|
1979
2004
|
}
|
|
1980
2005
|
/**
|
|
@@ -2015,133 +2040,133 @@ declare function onApplicationBootstrap<F extends BootstrapFunction>(fn: F): voi
|
|
|
2015
2040
|
declare class CommandKit extends EventEmitter {
|
|
2016
2041
|
#private;
|
|
2017
2042
|
/**
|
|
2018
|
-
|
|
2019
|
-
|
|
2043
|
+
* The event interceptor to quickly register temporary event listeners
|
|
2044
|
+
*/
|
|
2020
2045
|
eventInterceptor: EventInterceptor;
|
|
2021
2046
|
/**
|
|
2022
|
-
|
|
2023
|
-
|
|
2047
|
+
* The static createElement function to create jsx elements
|
|
2048
|
+
*/
|
|
2024
2049
|
static readonly createElement: typeof createElement;
|
|
2025
2050
|
/**
|
|
2026
|
-
|
|
2027
|
-
|
|
2051
|
+
* The static Fragment component to create jsx fragments
|
|
2052
|
+
*/
|
|
2028
2053
|
static readonly Fragment: typeof Fragment;
|
|
2029
2054
|
/**
|
|
2030
|
-
|
|
2031
|
-
|
|
2055
|
+
* The configuration for the CommandKit instance.
|
|
2056
|
+
*/
|
|
2032
2057
|
readonly appConfig: CommandKitConfiguration;
|
|
2033
2058
|
/**
|
|
2034
|
-
|
|
2035
|
-
|
|
2059
|
+
* The configuration for the CommandKit environment.
|
|
2060
|
+
*/
|
|
2036
2061
|
config: ResolvedCommandKitConfig;
|
|
2037
2062
|
/**
|
|
2038
|
-
|
|
2039
|
-
|
|
2063
|
+
* A key-value store for storing arbitrary data.
|
|
2064
|
+
*/
|
|
2040
2065
|
readonly store: Map<string, any>;
|
|
2041
2066
|
/**
|
|
2042
|
-
|
|
2043
|
-
|
|
2067
|
+
* A flag store for storing flags that can be used to enable or disable features.
|
|
2068
|
+
*/
|
|
2044
2069
|
readonly flags: FlagStore;
|
|
2045
2070
|
/**
|
|
2046
|
-
|
|
2047
|
-
|
|
2071
|
+
* The command router for the CommandKit instance.
|
|
2072
|
+
*/
|
|
2048
2073
|
commandsRouter: CommandsRouter;
|
|
2049
2074
|
/**
|
|
2050
|
-
|
|
2051
|
-
|
|
2075
|
+
* The events router for the CommandKit instance.
|
|
2076
|
+
*/
|
|
2052
2077
|
eventsRouter: EventsRouter;
|
|
2053
2078
|
/**
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2079
|
+
* The command handler for the CommandKit instance.
|
|
2080
|
+
* This is responsible for handling commands and their execution.
|
|
2081
|
+
*/
|
|
2057
2082
|
commandHandler: AppCommandHandler;
|
|
2058
2083
|
/**
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2084
|
+
* The event handler for the CommandKit instance.
|
|
2085
|
+
* This is responsible for handling events and their execution.
|
|
2086
|
+
*/
|
|
2062
2087
|
eventHandler: AppEventsHandler;
|
|
2063
2088
|
/**
|
|
2064
|
-
|
|
2065
|
-
|
|
2089
|
+
* The plugins runtime for the CommandKit instance.
|
|
2090
|
+
*/
|
|
2066
2091
|
plugins: CommandKitPluginRuntime;
|
|
2067
2092
|
/**
|
|
2068
|
-
|
|
2069
|
-
|
|
2093
|
+
* The events channel for the CommandKit instance. This can be used to emit custom events.
|
|
2094
|
+
*/
|
|
2070
2095
|
events: CommandKitEventsChannel;
|
|
2071
2096
|
/**
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2097
|
+
* The analytics engine for the CommandKit instance.
|
|
2098
|
+
* This is responsible for tracking events and user interactions.
|
|
2099
|
+
*/
|
|
2075
2100
|
analytics: AnalyticsEngine;
|
|
2076
2101
|
/**
|
|
2077
|
-
|
|
2078
|
-
|
|
2102
|
+
* The static instance of CommandKit.
|
|
2103
|
+
*/
|
|
2079
2104
|
static instance: CommandKit | undefined;
|
|
2080
2105
|
/**
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2106
|
+
* Create a new command and event handler with CommandKit.
|
|
2107
|
+
* @param options - The default CommandKit configuration.
|
|
2108
|
+
*/
|
|
2084
2109
|
constructor(options?: CommandKitOptions);
|
|
2085
2110
|
/**
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
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
|
+
*/
|
|
2089
2114
|
start(token?: string | false): Promise<void>;
|
|
2090
2115
|
/**
|
|
2091
|
-
|
|
2092
|
-
|
|
2116
|
+
* Loads all the plugins.
|
|
2117
|
+
*/
|
|
2093
2118
|
loadPlugins(): Promise<void>;
|
|
2094
2119
|
/**
|
|
2095
|
-
|
|
2096
|
-
|
|
2120
|
+
* Whether or not the commandkit application has started.
|
|
2121
|
+
*/
|
|
2097
2122
|
get started(): boolean;
|
|
2098
2123
|
/**
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2124
|
+
* Sets the prefix resolver for the command handler.
|
|
2125
|
+
* @param resolver The resolver function.
|
|
2126
|
+
*/
|
|
2102
2127
|
setPrefixResolver(resolver: (message: Message) => Awaitable<string | string[] | RegExp>): this;
|
|
2103
2128
|
/**
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2129
|
+
* Sets the default locale for the command handler.
|
|
2130
|
+
* @param locale The default locale.
|
|
2131
|
+
*/
|
|
2107
2132
|
setDefaultLocale(locale: Locale): this;
|
|
2108
2133
|
/**
|
|
2109
|
-
|
|
2110
|
-
|
|
2134
|
+
* Get the client attached to this CommandKit instance.
|
|
2135
|
+
*/
|
|
2111
2136
|
get client(): Client;
|
|
2112
2137
|
/**
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2138
|
+
* Sets the client attached to this CommandKit instance.
|
|
2139
|
+
* @param client The client to set.
|
|
2140
|
+
*/
|
|
2116
2141
|
setClient(client: Client): this;
|
|
2117
2142
|
/**
|
|
2118
|
-
|
|
2119
|
-
|
|
2143
|
+
* Updates application commands with the latest from "commandsPath".
|
|
2144
|
+
*/
|
|
2120
2145
|
reloadCommands(): Promise<void>;
|
|
2121
2146
|
/**
|
|
2122
|
-
|
|
2123
|
-
|
|
2147
|
+
* Updates application events with the latest from "eventsPath".
|
|
2148
|
+
*/
|
|
2124
2149
|
reloadEvents(): Promise<void>;
|
|
2125
2150
|
/**
|
|
2126
|
-
|
|
2127
|
-
|
|
2151
|
+
* Increment the client listeners count.
|
|
2152
|
+
*/
|
|
2128
2153
|
incrementClientListenersCount(): void;
|
|
2129
2154
|
/**
|
|
2130
|
-
|
|
2131
|
-
|
|
2155
|
+
* Decrement the client listeners count.
|
|
2156
|
+
*/
|
|
2132
2157
|
decrementClientListenersCount(): void;
|
|
2133
2158
|
/**
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2159
|
+
* Path to the app directory. Returns `null` if not found.
|
|
2160
|
+
* The lookup order is:
|
|
2161
|
+
* - `./app`
|
|
2162
|
+
* - `./src/app`
|
|
2163
|
+
*/
|
|
2139
2164
|
getAppDirectory(): string | null;
|
|
2140
2165
|
/**
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
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
|
+
*/
|
|
2145
2170
|
getPath(to: 'commands' | 'events'): string | null;
|
|
2146
2171
|
}
|
|
2147
2172
|
/**
|
|
@@ -2168,19 +2193,19 @@ type IdentifyEvent = Record<string, any>;
|
|
|
2168
2193
|
*/
|
|
2169
2194
|
interface AnalyticsProvider {
|
|
2170
2195
|
/**
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2196
|
+
* The name of the analytics provider.
|
|
2197
|
+
* This is used for logging and identification purposes.
|
|
2198
|
+
*/
|
|
2174
2199
|
readonly name: string;
|
|
2175
2200
|
/**
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2201
|
+
* Initializes the analytics provider.
|
|
2202
|
+
* This method is called when the provider is registered.
|
|
2203
|
+
*/
|
|
2179
2204
|
track(engine: AnalyticsEngine, event: AnalyticsEvent): Promise<void>;
|
|
2180
2205
|
/**
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2206
|
+
* Identifies a user or entity with the analytics provider.
|
|
2207
|
+
* This method is called to associate user data with events.
|
|
2208
|
+
*/
|
|
2184
2209
|
identify?(engine: AnalyticsEngine, event: IdentifyEvent): Promise<void>;
|
|
2185
2210
|
}
|
|
2186
2211
|
//#endregion
|
|
@@ -2200,49 +2225,49 @@ declare class AnalyticsEngine {
|
|
|
2200
2225
|
#private;
|
|
2201
2226
|
readonly commandkit: CommandKit;
|
|
2202
2227
|
/**
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2228
|
+
* Creates an instance of the AnalyticsEngine.
|
|
2229
|
+
* @param commandkit The CommandKit instance.
|
|
2230
|
+
*/
|
|
2206
2231
|
constructor(commandkit: CommandKit);
|
|
2207
2232
|
/**
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
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
|
+
*/
|
|
2214
2239
|
setFilter(filter: FilterFunction | null): void;
|
|
2215
2240
|
/**
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
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
|
+
*/
|
|
2221
2246
|
registerProvider(provider: AnalyticsProvider): void;
|
|
2222
2247
|
/**
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2248
|
+
* Removes the currently registered analytics provider.
|
|
2249
|
+
* @param provider The analytics provider to remove.
|
|
2250
|
+
*/
|
|
2226
2251
|
removeProvider(provider: AnalyticsProvider): void;
|
|
2227
2252
|
/**
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2253
|
+
* Retrieves the currently registered analytics provider.
|
|
2254
|
+
* @returns The currently registered analytics provider, or `null` if no provider is registered.
|
|
2255
|
+
*/
|
|
2231
2256
|
getProvider(): AnalyticsProvider | null;
|
|
2232
2257
|
/**
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
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
|
+
*/
|
|
2237
2262
|
identify(event: IdentifyEvent): Promise<void>;
|
|
2238
2263
|
/**
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
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
|
+
*/
|
|
2244
2269
|
track(event: AnalyticsEvent): Promise<void>;
|
|
2245
2270
|
}
|
|
2246
2271
|
//#endregion
|
|
2247
|
-
export {
|
|
2248
|
-
//# sourceMappingURL=analytics-engine-
|
|
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-WQhXmx3H.d.ts.map
|