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