commandkit 1.0.0-dev.20250529125116 → 1.0.0-dev.20250530015910
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/dist/ActionRow-CmTHbo2t.js +25 -0
- package/dist/ActionRow-CmTHbo2t.js.map +1 -0
- package/dist/ActionRow-D0wafJhZ.d.ts +16 -0
- package/dist/Button-Bl5nbwTS.d.ts +32 -0
- package/dist/ButtonKit-BSI7lCI0.d.ts +68 -0
- package/dist/ChannelSelectMenuKit-L15A2jpT.d.ts +51 -0
- package/dist/CommandKit-CDlCsGCx.d.ts +926 -0
- package/dist/CommandKit-DDrQtQns.js +3281 -0
- package/dist/CommandKit-DDrQtQns.js.map +1 -0
- package/dist/CommandKit.d.ts +33 -13
- package/dist/CommandKit.js +46 -16
- package/dist/CommandKitEventsChannel-B6LKgxmv.js +44 -0
- package/dist/CommandKitEventsChannel-B6LKgxmv.js.map +1 -0
- package/dist/CommandsRouter-BHaPno8o.js +127 -0
- package/dist/CommandsRouter-BHaPno8o.js.map +1 -0
- package/dist/CommandsRouter-C7X-eXE2.d.ts +67 -0
- package/dist/CompilerPlugin-XzuGixkC.js +32 -0
- package/dist/CompilerPlugin-XzuGixkC.js.map +1 -0
- package/dist/CompilerPluginRuntime-zFCCw1kM.js +70 -0
- package/dist/CompilerPluginRuntime-zFCCw1kM.js.map +1 -0
- package/dist/DefaultLogger-D3G0rGnV.d.ts +30 -0
- package/dist/EventInterceptor-D_oEWSnF.d.ts +84 -0
- package/dist/EventInterceptor-DtRINyTP.js +140 -0
- package/dist/EventInterceptor-DtRINyTP.js.map +1 -0
- package/dist/EventWorkerContext-C0e23GNY.d.ts +19 -0
- package/dist/EventWorkerContext-XZGSHn5F.js +45 -0
- package/dist/EventWorkerContext-XZGSHn5F.js.map +1 -0
- package/dist/EventsRouter-BacqK6z3.d.ts +90 -0
- package/dist/EventsRouter-CqnrlbjN.js +133 -0
- package/dist/EventsRouter-CqnrlbjN.js.map +1 -0
- package/dist/ILogger-BTMQuall.d.ts +11 -0
- package/dist/ILogger-DucYb0bG.js +0 -0
- package/dist/Logger-A3wjB7L1.d.ts +17 -0
- package/dist/MentionableSelectMenuKit-BiUSKUtZ.d.ts +51 -0
- package/dist/MessageCommandParser-B13Pkwo9.js +200 -0
- package/dist/MessageCommandParser-B13Pkwo9.js.map +1 -0
- package/dist/MessageCommandParser-tzroBwij.d.ts +62 -0
- package/dist/Modal-Cxm6cs5c.d.ts +58 -0
- package/dist/ModalKit-CKtQ8eXW.d.ts +66 -0
- package/dist/PluginCommon-DPqnQngK.js +48 -0
- package/dist/PluginCommon-DPqnQngK.js.map +1 -0
- package/dist/RoleSelectMenuKit-BSMKkru2.d.ts +51 -0
- package/dist/RuntimePlugin-CKsd83M3.js +130 -0
- package/dist/RuntimePlugin-CKsd83M3.js.map +1 -0
- package/dist/SelectMenu-b7jgrkjO.d.ts +36 -0
- package/dist/StringSelectMenuKit-B9FHTe48.d.ts +51 -0
- package/dist/UserSelectMenuKit-DiP0imyo.d.ts +51 -0
- package/dist/app/commands/AppCommandRunner.d.ts +33 -13
- package/dist/app/commands/AppCommandRunner.js +38 -3
- package/dist/app/commands/Context.d.ts +33 -13
- package/dist/app/commands/Context.js +40 -3
- package/dist/app/commands/MessageCommandParser.d.ts +2 -60
- package/dist/app/commands/MessageCommandParser.js +5 -2
- package/dist/app/commands/helpers.d.ts +2 -7
- package/dist/app/commands/helpers.js +4 -2
- package/dist/app/events/EventWorkerContext.d.ts +34 -28
- package/dist/app/events/EventWorkerContext.js +6 -2
- package/dist/app/handlers/AppCommandHandler.d.ts +33 -13
- package/dist/app/handlers/AppCommandHandler.js +38 -8
- package/dist/app/handlers/AppEventsHandler.d.ts +33 -13
- package/dist/app/handlers/AppEventsHandler.js +38 -3
- package/dist/app/index.d.ts +33 -15
- package/dist/app/index.js +51 -8
- package/dist/app/middleware/signals.d.ts +2 -18
- package/dist/app/middleware/signals.js +6 -2
- package/dist/app/register/CommandRegistrar.d.ts +33 -13
- package/dist/app/register/CommandRegistrar.js +38 -3
- package/dist/app/router/CommandsRouter.d.ts +2 -65
- package/dist/app/router/CommandsRouter.js +3 -2
- package/dist/app/router/EventsRouter.d.ts +2 -88
- package/dist/app/router/EventsRouter.js +3 -2
- package/dist/app/router/index.d.ts +4 -3
- package/dist/app/router/index.js +6 -2
- package/dist/app-CXCbKsPz.js +0 -0
- package/dist/app-process-uCX52YaE.js +48 -0
- package/dist/app-process-uCX52YaE.js.map +1 -0
- package/dist/build-Bkb5t3XA.js +122 -0
- package/dist/build-Bkb5t3XA.js.map +1 -0
- package/dist/chunk-nOFOJqeH.js +30 -0
- package/dist/cli/app-process.d.ts +5 -3
- package/dist/cli/app-process.js +8 -3
- package/dist/cli/build.d.ts +46 -21
- package/dist/cli/build.js +40 -48
- package/dist/cli/common.d.ts +39 -19
- package/dist/cli/common.js +13 -10
- package/dist/cli/development.d.ts +3 -1
- package/dist/cli/development.js +185 -50
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.d.ts +7 -5
- package/dist/cli/env.js +9 -2
- package/dist/cli/generators.d.ts +3 -1
- package/dist/cli/generators.js +64 -15
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.d.ts +3 -1
- package/dist/cli/information.js +110 -5
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.d.ts +2 -10
- package/dist/cli/init.js +4 -99
- package/dist/cli/parse-env.d.ts +3 -1
- package/dist/cli/parse-env.js +53 -1
- package/dist/cli/parse-env.js.map +1 -1
- package/dist/cli/production.d.ts +5 -3
- package/dist/cli/production.js +68 -46
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.d.ts +3 -1
- package/dist/cli/type-checker.js +7 -5
- package/dist/cli/utils.d.ts +4 -2
- package/dist/cli/utils.js +3 -2
- package/dist/colors-Cd4Oz-r-.js +14 -0
- package/dist/colors-Cd4Oz-r-.js.map +1 -0
- package/dist/common-CcfjYnPG.js +0 -0
- package/dist/common-CeO-vn8Y.js +14 -0
- package/dist/common-CeO-vn8Y.js.map +1 -0
- package/dist/common-DirpDCa6.js +182 -0
- package/dist/common-DirpDCa6.js.map +1 -0
- package/dist/common-pvPJVTfe.d.ts +25 -0
- package/dist/components/common/EventInterceptor.d.ts +2 -82
- package/dist/components/common/EventInterceptor.js +3 -2
- package/dist/components/common/element.d.ts +5 -29
- package/dist/components/common/element.js +10 -2
- package/dist/components/common/types.d.ts +2 -3
- package/dist/components/common/types.js +1 -2
- package/dist/components/index.d.ts +24 -22
- package/dist/components/index.js +72 -16
- package/dist/components/v1/action-row/ActionRow.d.ts +6 -18
- package/dist/components/v1/action-row/ActionRow.js +3 -2
- package/dist/components/v1/button/Button.d.ts +7 -31
- package/dist/components/v1/button/Button.js +38 -16
- package/dist/components/v1/button/ButtonKit.d.ts +3 -66
- package/dist/components/v1/button/ButtonKit.js +38 -16
- package/dist/components/v1/modal/Modal.d.ts +7 -57
- package/dist/components/v1/modal/Modal.js +41 -16
- package/dist/components/v1/modal/ModalKit.d.ts +3 -64
- package/dist/components/v1/modal/ModalKit.js +38 -16
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.d.ts +4 -49
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +38 -16
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.d.ts +4 -49
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +38 -16
- package/dist/components/v1/select-menu/RoleSelectMenuKit.d.ts +4 -49
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js +38 -16
- package/dist/components/v1/select-menu/SelectMenu.d.ts +10 -40
- package/dist/components/v1/select-menu/SelectMenu.js +43 -16
- package/dist/components/v1/select-menu/StringSelectMenuKit.d.ts +4 -49
- package/dist/components/v1/select-menu/StringSelectMenuKit.js +38 -16
- package/dist/components/v1/select-menu/UserSelectMenuKit.d.ts +4 -49
- package/dist/components/v1/select-menu/UserSelectMenuKit.js +38 -16
- package/dist/components/v1/select-menu/common.d.ts +3 -23
- package/dist/components/v1/select-menu/common.js +1 -2
- package/dist/components/v2/common.d.ts +5 -3
- package/dist/components/v2/common.js +3 -2
- package/dist/components/v2/container.d.ts +2 -8
- package/dist/components/v2/container.js +4 -2
- package/dist/components/v2/file.d.ts +2 -8
- package/dist/components/v2/file.js +3 -2
- package/dist/components/v2/index.d.ts +8 -7
- package/dist/components/v2/index.js +17 -2
- package/dist/components/v2/media-gallery.d.ts +2 -15
- package/dist/components/v2/media-gallery.js +5 -2
- package/dist/components/v2/section.d.ts +2 -16
- package/dist/components/v2/section.js +5 -2
- package/dist/components/v2/separator.d.ts +2 -7
- package/dist/components/v2/separator.js +3 -2
- package/dist/components/v2/text-display.d.ts +2 -10
- package/dist/components/v2/text-display.js +3 -2
- package/dist/config/config.d.ts +36 -28
- package/dist/config/config.js +39 -3
- package/dist/config/default.d.ts +37 -17
- package/dist/config/default.js +38 -3
- package/dist/config/loader.d.ts +37 -17
- package/dist/config/loader.js +39 -11
- package/dist/config/types.d.ts +34 -83
- package/dist/config/types.js +0 -2
- package/dist/config/utils.d.ts +35 -26
- package/dist/config/utils.js +15 -1
- package/dist/config/utils.js.map +1 -1
- package/dist/config-Dyb-zl9w.d.ts +17 -0
- package/dist/constants-Ce6w4OFe.d.ts +17 -0
- package/dist/constants-DOPSzXI0.js +47 -0
- package/dist/constants-DOPSzXI0.js.map +1 -0
- package/dist/container-CpuiLsZM.js +33 -0
- package/dist/container-CpuiLsZM.js.map +1 -0
- package/dist/container-CwEATQy2.d.ts +10 -0
- package/dist/context/async-context.d.ts +33 -13
- package/dist/context/async-context.js +44 -16
- package/dist/context/environment.d.ts +33 -13
- package/dist/context/environment.js +41 -3
- package/dist/element-D_nyVwgB.d.ts +30 -0
- package/dist/element-hdSqnIpC.js +62 -0
- package/dist/element-hdSqnIpC.js.map +1 -0
- package/dist/env-DKFSgEcR.js +68 -0
- package/dist/env-DKFSgEcR.js.map +1 -0
- package/dist/error-codes-C_UO39jz.js +53 -0
- package/dist/error-codes-C_UO39jz.js.map +1 -0
- package/dist/events/CommandKitEventsChannel.d.ts +33 -13
- package/dist/events/CommandKitEventsChannel.js +3 -2
- package/dist/feature-flags-BJp6kYmi.js +85 -0
- package/dist/feature-flags-BJp6kYmi.js.map +1 -0
- package/dist/file-BdyYwkaI.d.ts +10 -0
- package/dist/file-DE69SSOP.js +18 -0
- package/dist/file-DE69SSOP.js.map +1 -0
- package/dist/flags/feature-flags.d.ts +33 -13
- package/dist/flags/feature-flags.js +40 -16
- package/dist/flags/store.d.ts +33 -13
- package/dist/flags/store.js +3 -2
- package/dist/helpers-CswC9gKF.js +25 -0
- package/dist/helpers-CswC9gKF.js.map +1 -0
- package/dist/helpers-DAmE106r.d.ts +9 -0
- package/dist/index-CUPkUUOR.d.ts +1 -0
- package/dist/index-Dw5cCt-A.d.ts +1 -0
- package/dist/index-E7Wvm5uX.d.ts +1 -0
- package/dist/index.d.ts +43 -51
- package/dist/index.js +147 -102
- package/dist/index.js.map +1 -1
- package/dist/init--p1nl1NO.d.ts +13 -0
- package/dist/init-D2me-V0n.js +67 -0
- package/dist/init-D2me-V0n.js.map +1 -0
- package/dist/logger/DefaultLogger.d.ts +3 -28
- package/dist/logger/DefaultLogger.js +38 -3
- package/dist/logger/ILogger.d.ts +2 -9
- package/dist/logger/ILogger.js +1 -2
- package/dist/logger/Logger.d.ts +3 -15
- package/dist/logger/Logger.js +39 -3
- package/dist/media-gallery-DCu02VXc.d.ts +17 -0
- package/dist/media-gallery-nUEHqKVF.js +36 -0
- package/dist/media-gallery-nUEHqKVF.js.map +1 -0
- package/dist/plugins/CompilerPlugin.d.ts +33 -13
- package/dist/plugins/CompilerPlugin.js +5 -2
- package/dist/plugins/PluginCommon.d.ts +33 -13
- package/dist/plugins/PluginCommon.js +5 -2
- package/dist/plugins/RuntimePlugin.d.ts +33 -13
- package/dist/plugins/RuntimePlugin.js +5 -2
- package/dist/plugins/index.d.ts +33 -15
- package/dist/plugins/index.js +44 -3
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +33 -13
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +38 -3
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +33 -13
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +3 -3
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +33 -26
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +38 -3
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +40 -19
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +38 -3
- package/dist/plugins/plugin-runtime/runtime.d.ts +33 -13
- package/dist/plugins/plugin-runtime/runtime.js +1 -2
- package/dist/plugins/plugin-runtime/types.d.ts +2 -72
- package/dist/plugins/plugin-runtime/types.js +1 -2
- package/dist/plugins/types.d.ts +33 -13
- package/dist/plugins/types.js +1 -2
- package/dist/resolve-file-url-pO9_rLft.js +23 -0
- package/dist/resolve-file-url-pO9_rLft.js.map +1 -0
- package/dist/router-Dn35v30f.js +0 -0
- package/dist/runtime-ByJtSXs_.js +0 -0
- package/dist/section-D6t7tyEZ.js +40 -0
- package/dist/section-D6t7tyEZ.js.map +1 -0
- package/dist/section-fktaECHL.d.ts +18 -0
- package/dist/separator-CuesaLrC.d.ts +8 -0
- package/dist/separator-DYAFK-Jj.js +17 -0
- package/dist/separator-DYAFK-Jj.js.map +1 -0
- package/dist/signals-Bp0bzjE6.js +46 -0
- package/dist/signals-Bp0bzjE6.js.map +1 -0
- package/dist/signals-DUoWkeZ7.d.ts +20 -0
- package/dist/store-Ci6ib2C9.js +14 -0
- package/dist/store-Ci6ib2C9.js.map +1 -0
- package/dist/text-display-DNMwmGHJ.d.ts +12 -0
- package/dist/text-display-Dy6JHB5X.js +19 -0
- package/dist/text-display-Dy6JHB5X.js.map +1 -0
- package/dist/type-checker-FOYNSGX0.js +84 -0
- package/dist/type-checker-FOYNSGX0.js.map +1 -0
- package/dist/types-0ADL_reY.d.ts +73 -0
- package/dist/types-B5VPP9ig.js +0 -0
- package/dist/types-BDwNROY2.d.ts +74 -0
- package/dist/types-Bq0EWaM3.js +0 -0
- package/dist/types-CJ-XvOFN.d.ts +5 -0
- package/dist/types-Cdh4uaFR.js +0 -0
- package/dist/types-package-DRhFn59I.js +66 -0
- package/dist/types-package-DRhFn59I.js.map +1 -0
- package/dist/types.d.ts +33 -13
- package/dist/types.js +0 -2
- package/dist/utilities-5Jw5BdE1.d.ts +42 -0
- package/dist/utils/clone.d.ts +3 -1
- package/dist/utils/clone.js +8 -1
- package/dist/utils/clone.js.map +1 -1
- package/dist/utils/colors.d.ts +5 -3
- package/dist/utils/colors.js +4 -2
- package/dist/utils/constants.d.ts +2 -15
- package/dist/utils/constants.js +7 -2
- package/dist/utils/dev-hooks.d.ts +33 -13
- package/dist/utils/dev-hooks.js +38 -3
- package/dist/utils/error-codes.d.ts +9 -7
- package/dist/utils/error-codes.js +6 -2
- package/dist/utils/get-paths.d.ts +3 -1
- package/dist/utils/get-paths.js +33 -1
- package/dist/utils/get-paths.js.map +1 -1
- package/dist/utils/resolve-file-url.d.ts +3 -1
- package/dist/utils/resolve-file-url.js +3 -2
- package/dist/utils/types-package.d.ts +3 -1
- package/dist/utils/types-package.js +5 -14
- package/dist/utils/utilities.d.ts +2 -40
- package/dist/utils/utilities.js +44 -3
- package/dist/utils/warn-unstable.d.ts +3 -1
- package/dist/utils/warn-unstable.js +4 -2
- package/dist/utils-C0V7zD7R.d.ts +10 -0
- package/dist/utils-IYtoeTur.js +19 -0
- package/dist/utils-IYtoeTur.js.map +1 -0
- package/dist/v2-DofkPKHs.js +0 -0
- package/dist/version-DnRxh8U8.js +15 -0
- package/dist/version-DnRxh8U8.js.map +1 -0
- package/dist/version-SMsmj3M1.d.ts +8 -0
- package/dist/version.d.ts +2 -6
- package/dist/version.js +3 -2
- package/dist/warn-unstable-V20WCBDd.js +26 -0
- package/dist/warn-unstable-V20WCBDd.js.map +1 -0
- package/package.json +5 -4
- package/dist/CommandKit-jZCy9fZX.d.ts +0 -914
- package/dist/CommandKit.js.map +0 -1
- package/dist/app/commands/AppCommandRunner.js.map +0 -1
- package/dist/app/commands/Context.js.map +0 -1
- package/dist/app/commands/MessageCommandParser.js.map +0 -1
- package/dist/app/commands/helpers.js.map +0 -1
- package/dist/app/events/EventWorkerContext.js.map +0 -1
- package/dist/app/handlers/AppCommandHandler.js.map +0 -1
- package/dist/app/handlers/AppEventsHandler.js.map +0 -1
- package/dist/app/index.js.map +0 -1
- package/dist/app/middleware/signals.js.map +0 -1
- package/dist/app/register/CommandRegistrar.js.map +0 -1
- package/dist/app/router/CommandsRouter.js.map +0 -1
- package/dist/app/router/EventsRouter.js.map +0 -1
- package/dist/app/router/index.js.map +0 -1
- package/dist/cli/app-process.js.map +0 -1
- package/dist/cli/build.js.map +0 -1
- package/dist/cli/common.js.map +0 -1
- package/dist/cli/env.js.map +0 -1
- package/dist/cli/init.js.map +0 -1
- package/dist/cli/type-checker.js.map +0 -1
- package/dist/cli/utils.js.map +0 -1
- package/dist/components/common/EventInterceptor.js.map +0 -1
- package/dist/components/common/element.js.map +0 -1
- package/dist/components/common/types.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/v1/action-row/ActionRow.js.map +0 -1
- package/dist/components/v1/button/Button.js.map +0 -1
- package/dist/components/v1/button/ButtonKit.js.map +0 -1
- package/dist/components/v1/modal/Modal.js.map +0 -1
- package/dist/components/v1/modal/ModalKit.js.map +0 -1
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js.map +0 -1
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js.map +0 -1
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js.map +0 -1
- package/dist/components/v1/select-menu/SelectMenu.js.map +0 -1
- package/dist/components/v1/select-menu/StringSelectMenuKit.js.map +0 -1
- package/dist/components/v1/select-menu/UserSelectMenuKit.js.map +0 -1
- package/dist/components/v1/select-menu/common.js.map +0 -1
- package/dist/components/v2/common.js.map +0 -1
- package/dist/components/v2/container.js.map +0 -1
- package/dist/components/v2/file.js.map +0 -1
- package/dist/components/v2/index.js.map +0 -1
- package/dist/components/v2/media-gallery.js.map +0 -1
- package/dist/components/v2/section.js.map +0 -1
- package/dist/components/v2/separator.js.map +0 -1
- package/dist/components/v2/text-display.js.map +0 -1
- package/dist/config/config.js.map +0 -1
- package/dist/config/default.js.map +0 -1
- package/dist/config/loader.js.map +0 -1
- package/dist/config/types.js.map +0 -1
- package/dist/context/async-context.js.map +0 -1
- package/dist/context/environment.js.map +0 -1
- package/dist/events/CommandKitEventsChannel.js.map +0 -1
- package/dist/flags/feature-flags.js.map +0 -1
- package/dist/flags/store.js.map +0 -1
- package/dist/logger/DefaultLogger.js.map +0 -1
- package/dist/logger/ILogger.js.map +0 -1
- package/dist/logger/Logger.js.map +0 -1
- package/dist/plugins/CompilerPlugin.js.map +0 -1
- package/dist/plugins/PluginCommon.js.map +0 -1
- package/dist/plugins/RuntimePlugin.js.map +0 -1
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js.map +0 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js.map +0 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js.map +0 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js.map +0 -1
- package/dist/plugins/plugin-runtime/runtime.js.map +0 -1
- package/dist/plugins/plugin-runtime/types.js.map +0 -1
- package/dist/plugins/types.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/constants.js.map +0 -1
- package/dist/utils/dev-hooks.js.map +0 -1
- package/dist/utils/error-codes.js.map +0 -1
- package/dist/utils/resolve-file-url.js.map +0 -1
- package/dist/utils/types-package.js.map +0 -1
- package/dist/utils/utilities.js.map +0 -1
- package/dist/utils/warn-unstable.js.map +0 -1
- package/dist/version.js.map +0 -1
|
@@ -1,914 +0,0 @@
|
|
|
1
|
-
import * as discord_js from 'discord.js';
|
|
2
|
-
import { RESTPostAPIApplicationCommandsJSONBody, Client, Interaction, CacheType, ChatInputCommandInteraction, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, AutocompleteInteraction, Message, Guild, TextBasedChannel, Locale, Awaitable, SlashCommandBuilder, Collection, ContextMenuCommandBuilder, ContextMenuCommandInteraction, ClientEvents } from 'discord.js';
|
|
3
|
-
import EventEmitter from 'node:events';
|
|
4
|
-
import { jsx as createElement, Fragment } from './components/common/element.js';
|
|
5
|
-
import { EventInterceptor } from './components/common/EventInterceptor.js';
|
|
6
|
-
import { MessageCommandParser, MessageCommandOptions } from './app/commands/MessageCommandParser.js';
|
|
7
|
-
import { Command, Middleware, CommandsRouter } from './app/router/CommandsRouter.js';
|
|
8
|
-
import { ParsedEvent, EventsRouter } from './app/router/EventsRouter.js';
|
|
9
|
-
import { OnLoadArgs, Loader, OnResolveArgs, Setup } from './plugins/plugin-runtime/types.js';
|
|
10
|
-
import { HMREventType } from './utils/constants.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Options for instantiating a CommandKit handler.
|
|
14
|
-
*/
|
|
15
|
-
interface CommandKitOptions {
|
|
16
|
-
/**
|
|
17
|
-
* The Discord.js client object to use with CommandKit.
|
|
18
|
-
*/
|
|
19
|
-
client: Client;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Represents a command context.
|
|
23
|
-
*/
|
|
24
|
-
interface CommandContext<T extends Interaction, Cached extends CacheType> {
|
|
25
|
-
/**
|
|
26
|
-
* The interaction that triggered this command.
|
|
27
|
-
*/
|
|
28
|
-
interaction: Interaction<CacheType>;
|
|
29
|
-
/**
|
|
30
|
-
* The client that instantiated this command.
|
|
31
|
-
*/
|
|
32
|
-
client: Client;
|
|
33
|
-
/**
|
|
34
|
-
* The command data.
|
|
35
|
-
*/
|
|
36
|
-
handler: CommandKit;
|
|
37
|
-
}
|
|
38
|
-
type CommandData = RESTPostAPIApplicationCommandsJSONBody & {
|
|
39
|
-
guilds?: string[];
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
type GenericFunction<A extends any[] = any[]> = (...args: A) => any;
|
|
43
|
-
declare function isCommandWorkerContext(worker: any): worker is CommandKitEnvironment;
|
|
44
|
-
/**
|
|
45
|
-
* Represents an async function that can be cached
|
|
46
|
-
* @template R - Array of argument types
|
|
47
|
-
* @template T - Return type
|
|
48
|
-
*/
|
|
49
|
-
type AsyncFunction<R extends any[] = any[], T = any> = (...args: R) => Promise<T>;
|
|
50
|
-
declare function exitContext<T>(fn: () => T): T;
|
|
51
|
-
declare function provideContext<R>(value: CommandKitEnvironment, receiver: () => R): R;
|
|
52
|
-
/**
|
|
53
|
-
* Returns a context-aware version of the given function.
|
|
54
|
-
* @param env - The commandkit environment data.
|
|
55
|
-
* @param fn - The target function.
|
|
56
|
-
* @param finalizer - An optional finalizer function to run after the target function. This function will be context-aware.
|
|
57
|
-
* @internal
|
|
58
|
-
*/
|
|
59
|
-
declare function makeContextAwareFunction<R extends GenericFunction, F extends GenericFunction>(env: CommandKitEnvironment, fn: R, finalizer?: F): R;
|
|
60
|
-
/**
|
|
61
|
-
* Retrieves commandkit
|
|
62
|
-
* @private
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
declare function getCommandKit(): CommandKit | undefined;
|
|
66
|
-
declare function getCommandKit(strict: true): CommandKit;
|
|
67
|
-
declare function getCommandKit(strict: false): CommandKit | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Get the current commandkit context.
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
declare function getContext(): CommandKitEnvironment | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Use current commandkit context. Throws an error if no context is found.
|
|
75
|
-
*/
|
|
76
|
-
declare function useEnvironment(): CommandKitEnvironment;
|
|
77
|
-
|
|
78
|
-
interface PreRegisterCommandsEvent {
|
|
79
|
-
preventDefault(): void;
|
|
80
|
-
commands: CommandData[];
|
|
81
|
-
}
|
|
82
|
-
declare class CommandRegistrar {
|
|
83
|
-
readonly commandkit: CommandKit;
|
|
84
|
-
private api;
|
|
85
|
-
/**
|
|
86
|
-
* Creates an instance of CommandRegistrar.
|
|
87
|
-
* @param commandkit The commandkit instance.
|
|
88
|
-
*/
|
|
89
|
-
constructor(commandkit: CommandKit);
|
|
90
|
-
/**
|
|
91
|
-
* Gets the commands data.
|
|
92
|
-
*/
|
|
93
|
-
getCommandsData(): CommandData[];
|
|
94
|
-
/**
|
|
95
|
-
* Registers loaded commands.
|
|
96
|
-
*/
|
|
97
|
-
register(): Promise<void>;
|
|
98
|
-
/**
|
|
99
|
-
* Updates the global commands.
|
|
100
|
-
*/
|
|
101
|
-
updateGlobalCommands(commands: CommandData[]): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Updates the guild commands.
|
|
104
|
-
*/
|
|
105
|
-
updateGuildCommands(commands: CommandData[]): Promise<void>;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
interface CommandKitEnvironmentInternalData {
|
|
109
|
-
executionError: Error | null;
|
|
110
|
-
type: CommandKitEnvironmentType | null;
|
|
111
|
-
variables: Map<string, any>;
|
|
112
|
-
deferredFunctions: Map<string, GenericFunction<[CommandKitEnvironment]>>;
|
|
113
|
-
marker: string;
|
|
114
|
-
markStart: number;
|
|
115
|
-
markEnd: number;
|
|
116
|
-
context: Context | null;
|
|
117
|
-
}
|
|
118
|
-
declare class CommandKitEnvironment {
|
|
119
|
-
#private;
|
|
120
|
-
readonly commandkit: CommandKit;
|
|
121
|
-
/**
|
|
122
|
-
* Creates the commandkit execution environment.
|
|
123
|
-
* @param commandkit - The commandkit instance.
|
|
124
|
-
*/
|
|
125
|
-
constructor(commandkit: CommandKit);
|
|
126
|
-
/**
|
|
127
|
-
* Set the context.
|
|
128
|
-
* @param context - The context to set.
|
|
129
|
-
*/
|
|
130
|
-
setContext(context: Context): void;
|
|
131
|
-
/**
|
|
132
|
-
* Get the context. `null` if not set.
|
|
133
|
-
* @internal
|
|
134
|
-
*/
|
|
135
|
-
get context(): Context | null;
|
|
136
|
-
/**
|
|
137
|
-
* Get the execution error.
|
|
138
|
-
* @internal
|
|
139
|
-
*/
|
|
140
|
-
getExecutionError(): Error | null;
|
|
141
|
-
/**
|
|
142
|
-
* Set the execution error.
|
|
143
|
-
* @param error - The error to set.
|
|
144
|
-
* @internal
|
|
145
|
-
*/
|
|
146
|
-
setExecutionError(error: Error): void;
|
|
147
|
-
/**
|
|
148
|
-
* Get the environment type.
|
|
149
|
-
*/
|
|
150
|
-
getType(): CommandKitEnvironmentType;
|
|
151
|
-
/**
|
|
152
|
-
* Set the environment type.
|
|
153
|
-
* @param type - The environment type to set.
|
|
154
|
-
* @internal
|
|
155
|
-
*/
|
|
156
|
-
setType(type: CommandKitEnvironmentType): void;
|
|
157
|
-
/**
|
|
158
|
-
* The variables store for this environment.
|
|
159
|
-
*/
|
|
160
|
-
get variables(): Map<string, any>;
|
|
161
|
-
/**
|
|
162
|
-
* Register a deferred function.
|
|
163
|
-
* @param fn - The deferred function to register.
|
|
164
|
-
* @returns The deferred function id.
|
|
165
|
-
* @internal
|
|
166
|
-
*/
|
|
167
|
-
registerDeferredFunction(fn: GenericFunction<[CommandKitEnvironment]>): string;
|
|
168
|
-
/**
|
|
169
|
-
* Clear a deferred function by id.
|
|
170
|
-
* @param id - The deferred function id to clear.
|
|
171
|
-
* @internal
|
|
172
|
-
*/
|
|
173
|
-
clearDeferredFunction(id: string): void;
|
|
174
|
-
/**
|
|
175
|
-
* Run all deferred functions sequentially.
|
|
176
|
-
* @internal
|
|
177
|
-
*/
|
|
178
|
-
runDeferredFunctions(): Promise<void>;
|
|
179
|
-
/**
|
|
180
|
-
* Clear all deferred functions.
|
|
181
|
-
* @internal
|
|
182
|
-
*/
|
|
183
|
-
clearAllDeferredFunctions(): void;
|
|
184
|
-
/**
|
|
185
|
-
* Mark the start of a command execution.
|
|
186
|
-
* @param marker - The marker to set.
|
|
187
|
-
* @internal
|
|
188
|
-
*/
|
|
189
|
-
markStart(marker: string): void;
|
|
190
|
-
/**
|
|
191
|
-
* Mark the end of a command execution.
|
|
192
|
-
* @internal
|
|
193
|
-
*/
|
|
194
|
-
markEnd(): void;
|
|
195
|
-
/**
|
|
196
|
-
* Get the marker.
|
|
197
|
-
* @internal
|
|
198
|
-
*/
|
|
199
|
-
getMarker(): string;
|
|
200
|
-
/**
|
|
201
|
-
* Get the execution time in milliseconds.
|
|
202
|
-
* @internal
|
|
203
|
-
*/
|
|
204
|
-
getExecutionTime(): number;
|
|
205
|
-
}
|
|
206
|
-
declare enum CommandKitEnvironmentType {
|
|
207
|
-
CommandHandler = "COMMAND_HANDLER"
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Runs the given function after the current command has finished executing.
|
|
211
|
-
* @param fn The function to run after the current command.
|
|
212
|
-
* @returns The deferred function id. This can be used to cancel the deferred function.
|
|
213
|
-
*/
|
|
214
|
-
declare function after(fn: GenericFunction<[CommandKitEnvironment]>): string;
|
|
215
|
-
/**
|
|
216
|
-
* Cancels a deferred function registered with `after`.
|
|
217
|
-
* @param id The deferred function id to cancel.
|
|
218
|
-
*/
|
|
219
|
-
declare function cancelAfter(id: string): void;
|
|
220
|
-
|
|
221
|
-
declare const CommandExecutionMode: {
|
|
222
|
-
readonly ChatInputCommand: "chatInput";
|
|
223
|
-
readonly MessageContextMenu: "messageContextMenu";
|
|
224
|
-
readonly UserContextMenu: "userContextMenu";
|
|
225
|
-
readonly Autocomplete: "autocomplete";
|
|
226
|
-
readonly Message: "message";
|
|
227
|
-
};
|
|
228
|
-
type CommandExecutionMode = (typeof CommandExecutionMode)[keyof typeof CommandExecutionMode];
|
|
229
|
-
interface ContextParameters<T extends CommandExecutionMode, Args = Record<string, any>> {
|
|
230
|
-
command: LoadedCommand;
|
|
231
|
-
environment?: CommandKitEnvironment;
|
|
232
|
-
executionMode: T;
|
|
233
|
-
interaction: T extends 'chatInput' ? ChatInputCommandInteraction : T extends 'messageContextMenu' ? MessageContextMenuCommandInteraction : T extends 'userContextMenu' ? UserContextMenuCommandInteraction : T extends 'autocomplete' ? AutocompleteInteraction : never;
|
|
234
|
-
message: T extends 'message' ? Message : never;
|
|
235
|
-
forwarded?: boolean;
|
|
236
|
-
messageCommandParser?: T extends 'message' ? MessageCommandParser : never;
|
|
237
|
-
store?: Map<string, any>;
|
|
238
|
-
customArgs?: Args;
|
|
239
|
-
}
|
|
240
|
-
type MessageCommandContext = Context<'message'>;
|
|
241
|
-
type InteractionCommandContext = Context<'autocomplete' | 'chatInput' | 'messageContextMenu' | 'userContextMenu'>;
|
|
242
|
-
type MessageCommandMiddlewareContext = MiddlewareContext<'message'>;
|
|
243
|
-
type InteractionCommandMiddlewareContext = MiddlewareContext<'autocomplete' | 'chatInput' | 'messageContextMenu' | 'userContextMenu'>;
|
|
244
|
-
type ChatInputCommandContext = Context<'chatInput'>;
|
|
245
|
-
type SlashCommandMiddlewareContext = MiddlewareContext<'chatInput'>;
|
|
246
|
-
type AutocompleteCommandContext = Context<'autocomplete'>;
|
|
247
|
-
type AutocompleteCommandMiddlewareContext = MiddlewareContext<'autocomplete'>;
|
|
248
|
-
type MessageContextMenuCommandContext = Context<'messageContextMenu'>;
|
|
249
|
-
type MessageContextMenuCommandMiddlewareContext = MiddlewareContext<'messageContextMenu'>;
|
|
250
|
-
type UserContextMenuCommandContext = Context<'userContextMenu'>;
|
|
251
|
-
type UserContextMenuCommandMiddlewareContext = MiddlewareContext<'userContextMenu'>;
|
|
252
|
-
type CommandContextOptions<T extends CommandExecutionMode> = T extends 'message' ? MessageCommandOptions : T extends 'chatInput' ? ChatInputCommandInteraction['options'] : T extends 'autocomplete' ? AutocompleteInteraction['options'] : T extends 'messageContextMenu' ? MessageContextMenuCommandInteraction['options'] : T extends 'userContextMenu' ? UserContextMenuCommandInteraction['options'] : never;
|
|
253
|
-
type AnyCommandExecute<ContextType extends Context = Context> = (ctx: ContextType) => Awaitable<unknown>;
|
|
254
|
-
type ChatInputCommand = AnyCommandExecute<ChatInputCommandContext>;
|
|
255
|
-
type AutocompleteCommand = AnyCommandExecute<AutocompleteCommandContext>;
|
|
256
|
-
type MessageContextMenuCommand = AnyCommandExecute<MessageContextMenuCommandContext>;
|
|
257
|
-
type UserContextMenuCommand = AnyCommandExecute<UserContextMenuCommandContext>;
|
|
258
|
-
type MessageCommand = AnyCommandExecute<MessageCommandContext>;
|
|
259
|
-
interface MiddlewareContextArgs {
|
|
260
|
-
setCommandRunner?: GenericFunction<[RunCommand]>;
|
|
261
|
-
}
|
|
262
|
-
declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecutionMode, Args extends Record<string, any> = Record<string, any>> {
|
|
263
|
-
#private;
|
|
264
|
-
readonly commandkit: CommandKit;
|
|
265
|
-
protected readonly config: ContextParameters<ExecutionMode, Args>;
|
|
266
|
-
/**
|
|
267
|
-
* The interaction that triggered the command.
|
|
268
|
-
*/
|
|
269
|
-
readonly interaction: ContextParameters<ExecutionMode>['interaction'];
|
|
270
|
-
/**
|
|
271
|
-
* The message that triggered the command.
|
|
272
|
-
*/
|
|
273
|
-
readonly message: ContextParameters<ExecutionMode>['message'];
|
|
274
|
-
/**
|
|
275
|
-
* The guild where the command was triggered.
|
|
276
|
-
*/
|
|
277
|
-
readonly guild: Guild | null;
|
|
278
|
-
/**
|
|
279
|
-
* The guild ID where the command was triggered.
|
|
280
|
-
*/
|
|
281
|
-
readonly guildId: string | null;
|
|
282
|
-
/**
|
|
283
|
-
* The channel where the command was triggered.
|
|
284
|
-
*/
|
|
285
|
-
readonly channel: TextBasedChannel | null;
|
|
286
|
-
/**
|
|
287
|
-
* The channel id where the command was triggered.
|
|
288
|
-
*/
|
|
289
|
-
readonly channelId: string | null;
|
|
290
|
-
/**
|
|
291
|
-
* The client instance.
|
|
292
|
-
*/
|
|
293
|
-
readonly client: Client;
|
|
294
|
-
/**
|
|
295
|
-
* The command that this context belongs to.
|
|
296
|
-
*/
|
|
297
|
-
readonly command: LoadedCommand;
|
|
298
|
-
private _locale;
|
|
299
|
-
/**
|
|
300
|
-
* Creates a new command context.
|
|
301
|
-
* @param commandkit The command kit instance.
|
|
302
|
-
* @param config The context parameters.
|
|
303
|
-
*/
|
|
304
|
-
constructor(commandkit: CommandKit, config: ContextParameters<ExecutionMode, Args>);
|
|
305
|
-
/**
|
|
306
|
-
* The shared key-value store for this context. This can be used to store data that needs to be shared between middlewares or commands.
|
|
307
|
-
* This store is shared across all contexts in the same command execution, including the cloned contexts and middleware contexts.
|
|
308
|
-
*/
|
|
309
|
-
get store(): Map<string, any>;
|
|
310
|
-
get commandName(): string;
|
|
311
|
-
get options(): CommandContextOptions<ExecutionMode>;
|
|
312
|
-
/**
|
|
313
|
-
* Whether this context was forwarded from another context. This happens when a command forwards its context to another command.
|
|
314
|
-
*/
|
|
315
|
-
get forwarded(): boolean;
|
|
316
|
-
/**
|
|
317
|
-
* Forwards the context to another command. The target handler will be the same as current handler.
|
|
318
|
-
* @param command The command to forward to.
|
|
319
|
-
*/
|
|
320
|
-
forwardCommand<C extends ResolvableCommand>(command: C): Promise<never>;
|
|
321
|
-
/**
|
|
322
|
-
* The execution mode of the command.
|
|
323
|
-
*/
|
|
324
|
-
get executionMode(): ExecutionMode;
|
|
325
|
-
/**
|
|
326
|
-
* Whether the command was triggered by an interaction.
|
|
327
|
-
*/
|
|
328
|
-
isInteraction(): this is InteractionCommandContext;
|
|
329
|
-
/**
|
|
330
|
-
* Whether the command was triggered by a slash command interaction.
|
|
331
|
-
*/
|
|
332
|
-
isChatInputCommand(): this is ChatInputCommandContext;
|
|
333
|
-
/**
|
|
334
|
-
* Whether the command was triggered by an autocomplete interaction.
|
|
335
|
-
*/
|
|
336
|
-
isAutocomplete(): this is AutocompleteCommandContext;
|
|
337
|
-
/**
|
|
338
|
-
* Whether the command was triggered by a message context menu interaction.
|
|
339
|
-
*/
|
|
340
|
-
isMessageContextMenu(): this is MessageContextMenuCommandContext;
|
|
341
|
-
/**
|
|
342
|
-
* Whether the command was triggered by a user context menu interaction.
|
|
343
|
-
*/
|
|
344
|
-
isUserContextMenu(): this is UserContextMenuCommandContext;
|
|
345
|
-
/**
|
|
346
|
-
* Whether the command was triggered by a message.
|
|
347
|
-
*/
|
|
348
|
-
isMessage(): this is Context<'message'>;
|
|
349
|
-
/**
|
|
350
|
-
* Returns the command identifier.
|
|
351
|
-
*/
|
|
352
|
-
getCommandIdentifier(): string;
|
|
353
|
-
/**
|
|
354
|
-
* Returns the locale of the guild where this command was triggered.
|
|
355
|
-
*/
|
|
356
|
-
getGuildLocale(): Locale | null;
|
|
357
|
-
/**
|
|
358
|
-
* Returns the locale of the user who triggered this command.
|
|
359
|
-
*/
|
|
360
|
-
getUserLocale(): Locale | null;
|
|
361
|
-
/**
|
|
362
|
-
* Returns the locale for this command.
|
|
363
|
-
* @param preferUser Whether to prefer the user's locale over the guild's locale.
|
|
364
|
-
* @returns The locale for this command. If no locale is found, the default locale is returned.
|
|
365
|
-
*/
|
|
366
|
-
getLocale(preferUser?: boolean): Locale;
|
|
367
|
-
/**
|
|
368
|
-
* Sets the locale for this command.
|
|
369
|
-
* @param locale The locale to set.
|
|
370
|
-
*/
|
|
371
|
-
setLocale(locale: Locale | null): void;
|
|
372
|
-
/**
|
|
373
|
-
* Creates a clone of this context
|
|
374
|
-
*/
|
|
375
|
-
clone(config?: Partial<ContextParameters<ExecutionMode>>): Context<ExecutionMode>;
|
|
376
|
-
isMiddleware(): this is MiddlewareContext<ExecutionMode>;
|
|
377
|
-
args(): string[];
|
|
378
|
-
/**
|
|
379
|
-
* Stops upcoming middleware or current command execution.
|
|
380
|
-
* If this is called inside pre-stage middleware, the next run will be the actual command, skipping all other pre-stage middlewares.
|
|
381
|
-
* If this is called inside a command itself, it will skip all post-stage middlewares.
|
|
382
|
-
* If this is called inside post-stage middleware, it will skip all other post-stage middlewares.
|
|
383
|
-
*/
|
|
384
|
-
exit(): never;
|
|
385
|
-
}
|
|
386
|
-
declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutionMode> extends Context<T, MiddlewareContextArgs> {
|
|
387
|
-
#private;
|
|
388
|
-
/**
|
|
389
|
-
* Whether the command execution was cancelled.
|
|
390
|
-
*/
|
|
391
|
-
get cancelled(): boolean;
|
|
392
|
-
/**
|
|
393
|
-
* Cancels the command execution.
|
|
394
|
-
*/
|
|
395
|
-
cancel(): void;
|
|
396
|
-
/**
|
|
397
|
-
* Sets command runner function to wrap the command execution.
|
|
398
|
-
* @param fn The function to set.
|
|
399
|
-
* @example ctx.setCommandRunner(async (execute) => {
|
|
400
|
-
* // do something before command execution
|
|
401
|
-
* await execute();
|
|
402
|
-
* // do something after command execution
|
|
403
|
-
* })
|
|
404
|
-
*/
|
|
405
|
-
setCommandRunner(fn: RunCommand): void;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
declare class AppCommandRunner {
|
|
409
|
-
#private;
|
|
410
|
-
private handler;
|
|
411
|
-
constructor(handler: AppCommandHandler);
|
|
412
|
-
runCommand(prepared: PreparedAppCommandExecution, source: Interaction | Message): Promise<void>;
|
|
413
|
-
getExecutionMode(source: Interaction | Message): CommandExecutionMode;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
type RunCommand = <T extends AsyncFunction>(fn: T) => T;
|
|
417
|
-
interface AppCommand {
|
|
418
|
-
command: SlashCommandBuilder | Record<string, any>;
|
|
419
|
-
chatInput?: (ctx: Context) => Awaitable<unknown>;
|
|
420
|
-
autocomplete?: (ctx: Context) => Awaitable<unknown>;
|
|
421
|
-
message?: (ctx: Context) => Awaitable<unknown>;
|
|
422
|
-
messageContextMenu?: (ctx: Context) => Awaitable<unknown>;
|
|
423
|
-
userContextMenu?: (ctx: Context) => Awaitable<unknown>;
|
|
424
|
-
}
|
|
425
|
-
interface AppCommandMiddleware {
|
|
426
|
-
beforeExecute: (ctx: Context) => Awaitable<unknown>;
|
|
427
|
-
afterExecute: (ctx: Context) => Awaitable<unknown>;
|
|
428
|
-
}
|
|
429
|
-
interface LoadedCommand {
|
|
430
|
-
command: Command;
|
|
431
|
-
data: AppCommand;
|
|
432
|
-
guilds?: string[];
|
|
433
|
-
}
|
|
434
|
-
type CommandTypeData = string;
|
|
435
|
-
type ResolvableCommand = CommandTypeData | (string & {});
|
|
436
|
-
interface LoadedMiddleware {
|
|
437
|
-
middleware: Middleware;
|
|
438
|
-
data: AppCommandMiddleware;
|
|
439
|
-
}
|
|
440
|
-
interface PreparedAppCommandExecution {
|
|
441
|
-
command: LoadedCommand;
|
|
442
|
-
middlewares: LoadedMiddleware[];
|
|
443
|
-
messageCommandParser?: MessageCommandParser;
|
|
444
|
-
}
|
|
445
|
-
type CommandBuilderLike = SlashCommandBuilder | ContextMenuCommandBuilder | Record<string, any>;
|
|
446
|
-
declare class AppCommandHandler {
|
|
447
|
-
readonly commandkit: CommandKit;
|
|
448
|
-
private loadedCommands;
|
|
449
|
-
private loadedMiddlewares;
|
|
450
|
-
private commandNameToId;
|
|
451
|
-
private subcommandPathToId;
|
|
452
|
-
readonly registrar: CommandRegistrar;
|
|
453
|
-
private onInteraction;
|
|
454
|
-
private onMessageCreate;
|
|
455
|
-
readonly commandRunner: AppCommandRunner;
|
|
456
|
-
readonly externalCommandData: Collection<string, Command>;
|
|
457
|
-
readonly externalMiddlewareData: Collection<string, Middleware>;
|
|
458
|
-
constructor(commandkit: CommandKit);
|
|
459
|
-
printBanner(): void;
|
|
460
|
-
getCommandsArray(): LoadedCommand[];
|
|
461
|
-
registerCommandHandler(): void;
|
|
462
|
-
prepareCommandRun(source: Interaction | Message, cmdName?: string): Promise<PreparedAppCommandExecution | null>;
|
|
463
|
-
reloadCommands(): Promise<void>;
|
|
464
|
-
addExternalMiddleware(data: Middleware[]): Promise<void>;
|
|
465
|
-
addExternalCommands(data: Command[]): Promise<void>;
|
|
466
|
-
registerExternalLoadedMiddleware(data: LoadedMiddleware[]): Promise<void>;
|
|
467
|
-
registerExternalLoadedCommands(data: LoadedCommand[]): Promise<void>;
|
|
468
|
-
loadCommands(): Promise<void>;
|
|
469
|
-
private loadMiddleware;
|
|
470
|
-
private loadCommand;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
type ListenerFunction = GenericFunction | AsyncFunction;
|
|
474
|
-
declare class CommandKitEventsChannel {
|
|
475
|
-
readonly commandkit: CommandKit;
|
|
476
|
-
private emitter;
|
|
477
|
-
constructor(commandkit: CommandKit);
|
|
478
|
-
to(namespace: string): {
|
|
479
|
-
on: (event: string, listener: ListenerFunction) => void;
|
|
480
|
-
off: (event: string, listener: ListenerFunction) => void;
|
|
481
|
-
once: (event: string, listener: ListenerFunction) => void;
|
|
482
|
-
emit: (event: string, ...args: any[]) => boolean;
|
|
483
|
-
removeAllListeners: (event: string) => void;
|
|
484
|
-
};
|
|
485
|
-
on(namespace: string, event: string, listener: ListenerFunction): void;
|
|
486
|
-
off(namespace: string, event: string, listener: ListenerFunction): void;
|
|
487
|
-
once(namespace: string, event: string, listener: ListenerFunction): void;
|
|
488
|
-
emit(namespace: string, event: string, ...args: any[]): boolean;
|
|
489
|
-
removeAllListeners(namespace: string): void;
|
|
490
|
-
removeAllListeners(namespace: string, event: string): void;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
type EventListener = {
|
|
494
|
-
handler: ListenerFunction;
|
|
495
|
-
once: boolean;
|
|
496
|
-
};
|
|
497
|
-
interface LoadedEvent {
|
|
498
|
-
name: string;
|
|
499
|
-
namespace: string | null;
|
|
500
|
-
event: ParsedEvent;
|
|
501
|
-
listeners: EventListener[];
|
|
502
|
-
mainListener?: EventListener;
|
|
503
|
-
executedOnceListeners?: Set<ListenerFunction>;
|
|
504
|
-
}
|
|
505
|
-
interface AppEventsHandlerLoadedData {
|
|
506
|
-
name: string;
|
|
507
|
-
namespace: string | null;
|
|
508
|
-
onceListeners: number;
|
|
509
|
-
regularListeners: number;
|
|
510
|
-
metadata: ParsedEvent;
|
|
511
|
-
}
|
|
512
|
-
declare class AppEventsHandler {
|
|
513
|
-
readonly commandkit: CommandKit;
|
|
514
|
-
private loadedEvents;
|
|
515
|
-
constructor(commandkit: CommandKit);
|
|
516
|
-
getEvents(): AppEventsHandlerLoadedData[];
|
|
517
|
-
reloadEvents(): Promise<void>;
|
|
518
|
-
loadEvents(): Promise<void>;
|
|
519
|
-
unregisterAll(): void;
|
|
520
|
-
registerAllClientEvents(): void;
|
|
521
|
-
unregisterAllClientListeners(): void;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
interface CommandKitHMREvent {
|
|
525
|
-
event: HMREventType;
|
|
526
|
-
path: string;
|
|
527
|
-
accept: () => void;
|
|
528
|
-
preventDefault: () => void;
|
|
529
|
-
}
|
|
530
|
-
declare function registerDevHooks(commandkit: CommandKit): void;
|
|
531
|
-
|
|
532
|
-
declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CommandKitPluginRuntime> {
|
|
533
|
-
readonly type = PluginType.Runtime;
|
|
534
|
-
/**
|
|
535
|
-
* Called before commands are loaded
|
|
536
|
-
*/
|
|
537
|
-
onBeforeCommandsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
538
|
-
/**
|
|
539
|
-
* Called after commands are loaded
|
|
540
|
-
*/
|
|
541
|
-
onAfterCommandsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
542
|
-
/**
|
|
543
|
-
* Called before events are loaded
|
|
544
|
-
*/
|
|
545
|
-
onBeforeEventsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
546
|
-
/**
|
|
547
|
-
* Called after events are loaded
|
|
548
|
-
*/
|
|
549
|
-
onAfterEventsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
550
|
-
/**
|
|
551
|
-
* Called before the client logs in
|
|
552
|
-
*/
|
|
553
|
-
onBeforeClientLogin(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
554
|
-
/**
|
|
555
|
-
* Called after the client logs in
|
|
556
|
-
*/
|
|
557
|
-
onAfterClientLogin(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
558
|
-
/**
|
|
559
|
-
* Called before interaction is handled
|
|
560
|
-
* @param interaction The interaction
|
|
561
|
-
*/
|
|
562
|
-
onBeforeInteraction(ctx: CommandKitPluginRuntime, interaction: Interaction): Promise<void>;
|
|
563
|
-
/**
|
|
564
|
-
* Called before message command is processed
|
|
565
|
-
* @param message The message
|
|
566
|
-
*/
|
|
567
|
-
onBeforeMessageCommand(ctx: CommandKitPluginRuntime, message: Message): Promise<void>;
|
|
568
|
-
/**
|
|
569
|
-
* Called before command is executed. This method can execute the command itself.
|
|
570
|
-
* @param source The source that triggered the command
|
|
571
|
-
* @param command The command
|
|
572
|
-
* @param execute The function that executes the command
|
|
573
|
-
*/
|
|
574
|
-
executeCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment, source: Interaction | Message, command: PreparedAppCommandExecution, execute: () => Promise<any>): Promise<boolean>;
|
|
575
|
-
/**
|
|
576
|
-
* Called after events router is initialized
|
|
577
|
-
* @param ctx The context
|
|
578
|
-
*/
|
|
579
|
-
onEventsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
580
|
-
/**
|
|
581
|
-
* Called after commands router is initialized
|
|
582
|
-
* @param ctx The context
|
|
583
|
-
*/
|
|
584
|
-
onCommandsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
585
|
-
/**
|
|
586
|
-
* Called when HMR event is received
|
|
587
|
-
* @param ctx The context
|
|
588
|
-
* @param event The event
|
|
589
|
-
*/
|
|
590
|
-
performHMR(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent): Promise<void>;
|
|
591
|
-
/**
|
|
592
|
-
* Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.
|
|
593
|
-
* @param ctx The context
|
|
594
|
-
* @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command
|
|
595
|
-
*/
|
|
596
|
-
prepareCommand(ctx: CommandKitPluginRuntime, commands: CommandBuilderLike): Promise<CommandBuilderLike | null>;
|
|
597
|
-
/**
|
|
598
|
-
* Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.
|
|
599
|
-
* @param ctx The context
|
|
600
|
-
* @param data The command registration data
|
|
601
|
-
*/
|
|
602
|
-
onBeforeRegisterCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
603
|
-
/**
|
|
604
|
-
* Called before global commands registration. This method can cancel the registration of the command and handle it manually.
|
|
605
|
-
* This method is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
606
|
-
* @param ctx The context
|
|
607
|
-
* @param event The command registration data
|
|
608
|
-
*/
|
|
609
|
-
onBeforeRegisterGlobalCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
610
|
-
/**
|
|
611
|
-
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
612
|
-
* This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
613
|
-
* @param ctx The context
|
|
614
|
-
* @param event The command registration data
|
|
615
|
-
*/
|
|
616
|
-
onBeforePrepareGuildCommandsRegistration(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
617
|
-
/**
|
|
618
|
-
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
619
|
-
* This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.
|
|
620
|
-
* @param ctx The context
|
|
621
|
-
* @param event The command registration data
|
|
622
|
-
*/
|
|
623
|
-
onBeforeRegisterGuildCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
|
|
624
|
-
/**
|
|
625
|
-
* Called after command and all of its deferred functions are executed.
|
|
626
|
-
* @param ctx The context
|
|
627
|
-
* @param env The environment of the command. This environment contains the command execution data such as command context and more.
|
|
628
|
-
*/
|
|
629
|
-
onAfterCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment): Promise<void>;
|
|
630
|
-
/**
|
|
631
|
-
* Called before emitting an event
|
|
632
|
-
* @param ctx The context
|
|
633
|
-
* @param event The event that is being emitted
|
|
634
|
-
*/
|
|
635
|
-
willEmitEvent(ctx: CommandKitPluginRuntime, event: CommandKitEventDispatch): Promise<void>;
|
|
636
|
-
}
|
|
637
|
-
declare function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin;
|
|
638
|
-
|
|
639
|
-
type CommandKitPlugin = RuntimePlugin | CompilerPlugin;
|
|
640
|
-
type MaybeFalsey<T> = T | false | null | undefined;
|
|
641
|
-
interface CommandKitEventDispatch {
|
|
642
|
-
name: string;
|
|
643
|
-
args: unknown[];
|
|
644
|
-
namespace: string | null;
|
|
645
|
-
once: boolean;
|
|
646
|
-
metadata: ParsedEvent;
|
|
647
|
-
accept(): void;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
interface PluginTransformParameters {
|
|
651
|
-
args: OnLoadArgs;
|
|
652
|
-
path: string;
|
|
653
|
-
contents: string | Uint8Array;
|
|
654
|
-
loader?: Loader;
|
|
655
|
-
}
|
|
656
|
-
interface TransformedResult {
|
|
657
|
-
contents?: string | Uint8Array;
|
|
658
|
-
loader?: Loader;
|
|
659
|
-
}
|
|
660
|
-
interface ResolveResult {
|
|
661
|
-
path?: string;
|
|
662
|
-
external?: boolean;
|
|
663
|
-
}
|
|
664
|
-
declare abstract class CompilerPlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CompilerPluginRuntime> {
|
|
665
|
-
readonly type = PluginType.Compiler;
|
|
666
|
-
/**
|
|
667
|
-
* Called when transformation is requested to this plugin
|
|
668
|
-
* @param params The parameters for the transformation
|
|
669
|
-
* @returns The transformed result
|
|
670
|
-
*/
|
|
671
|
-
transform(params: PluginTransformParameters): Promise<MaybeFalsey<TransformedResult>>;
|
|
672
|
-
/**
|
|
673
|
-
* Called when a resolve is requested to this plugin
|
|
674
|
-
* @param args The arguments for the resolve
|
|
675
|
-
* @returns The resolved result
|
|
676
|
-
*/
|
|
677
|
-
resolve(args: OnResolveArgs): Promise<MaybeFalsey<ResolveResult>>;
|
|
678
|
-
/**
|
|
679
|
-
* Called when a build is started
|
|
680
|
-
*/
|
|
681
|
-
onBuildStart(): Promise<void>;
|
|
682
|
-
/**
|
|
683
|
-
* Called when a build is ended
|
|
684
|
-
*/
|
|
685
|
-
onBuildEnd(): Promise<void>;
|
|
686
|
-
}
|
|
687
|
-
declare function isCompilerPlugin(plugin: unknown): plugin is CompilerPlugin;
|
|
688
|
-
|
|
689
|
-
declare class CompilerPluginRuntime {
|
|
690
|
-
private readonly plugins;
|
|
691
|
-
readonly name = "CompilerPluginRuntime";
|
|
692
|
-
constructor(plugins: CompilerPlugin[]);
|
|
693
|
-
getPlugins(): CompilerPlugin<PluginOptions>[];
|
|
694
|
-
isEmpty(): boolean;
|
|
695
|
-
private onLoad;
|
|
696
|
-
private onResolve;
|
|
697
|
-
private onStart;
|
|
698
|
-
private onEnd;
|
|
699
|
-
private onDispose;
|
|
700
|
-
private onInit;
|
|
701
|
-
cleanup(): Promise<void>;
|
|
702
|
-
setup(build: Setup): Promise<void>;
|
|
703
|
-
toEsbuildPlugin(): {
|
|
704
|
-
name: string;
|
|
705
|
-
setup: (build: Setup) => Promise<void>;
|
|
706
|
-
};
|
|
707
|
-
}
|
|
708
|
-
declare function fromEsbuildPlugin(plugin: any): typeof CompilerPlugin;
|
|
709
|
-
|
|
710
|
-
type CommonPluginRuntime = CommandKitPluginRuntime | CompilerPluginRuntime;
|
|
711
|
-
|
|
712
|
-
type PluginOptions = Record<string, any>;
|
|
713
|
-
declare enum PluginType {
|
|
714
|
-
Compiler = "compiler",
|
|
715
|
-
Runtime = "runtime"
|
|
716
|
-
}
|
|
717
|
-
declare abstract class PluginCommon<T extends PluginOptions = PluginOptions, C extends CommonPluginRuntime = CommonPluginRuntime> {
|
|
718
|
-
protected readonly options: T;
|
|
719
|
-
abstract readonly type: PluginType;
|
|
720
|
-
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
721
|
-
readonly loadedAt: number;
|
|
722
|
-
abstract readonly name: string;
|
|
723
|
-
constructor(options: T);
|
|
724
|
-
/**
|
|
725
|
-
* Called when this plugin is activated
|
|
726
|
-
*/
|
|
727
|
-
activate(ctx: C): Promise<void>;
|
|
728
|
-
/**
|
|
729
|
-
* Called when this plugin is deactivated
|
|
730
|
-
*/
|
|
731
|
-
deactivate(ctx: C): Promise<void>;
|
|
732
|
-
}
|
|
733
|
-
declare function isPlugin(plugin: unknown): plugin is PluginCommon<PluginOptions>;
|
|
734
|
-
|
|
735
|
-
declare class CommandKitPluginRuntime {
|
|
736
|
-
readonly commandkit: CommandKit;
|
|
737
|
-
private plugins;
|
|
738
|
-
constructor(commandkit: CommandKit);
|
|
739
|
-
getPlugins(): Collection<string, RuntimePlugin<PluginOptions>>;
|
|
740
|
-
getPlugin(pluginName: string): RuntimePlugin | null;
|
|
741
|
-
softRegisterPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
742
|
-
registerPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
743
|
-
unregisterPlugin(plugin: RuntimePlugin): Promise<void>;
|
|
744
|
-
unregisterAllPlugins(): Promise<void>;
|
|
745
|
-
capture(): void;
|
|
746
|
-
execute<R = any>(f: AsyncFunction<[CommandKitPluginRuntime, RuntimePlugin], R | undefined>): Promise<true | R | undefined>;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
750
|
-
type IdentifyFunction<R> = (context: EvaluationContext) => MaybePromise<R>;
|
|
751
|
-
type DecideFunction<E, R> = (data: {
|
|
752
|
-
entities: E;
|
|
753
|
-
}) => MaybePromise<R>;
|
|
754
|
-
interface FeatureFlagDefinition<R, Entity> {
|
|
755
|
-
key: string;
|
|
756
|
-
description?: string;
|
|
757
|
-
identify?: IdentifyFunction<Entity>;
|
|
758
|
-
decide: DecideFunction<Entity, R>;
|
|
759
|
-
}
|
|
760
|
-
interface CommandFlagContext {
|
|
761
|
-
client: Client<true>;
|
|
762
|
-
commandkit: CommandKit;
|
|
763
|
-
command: {
|
|
764
|
-
interaction?: ChatInputCommandInteraction | AutocompleteInteraction | ContextMenuCommandInteraction;
|
|
765
|
-
message?: Message;
|
|
766
|
-
guild: Guild | null;
|
|
767
|
-
channel: TextBasedChannel | null;
|
|
768
|
-
command: LoadedCommand;
|
|
769
|
-
};
|
|
770
|
-
event: null;
|
|
771
|
-
}
|
|
772
|
-
interface EventFlagContext {
|
|
773
|
-
client: Client<true>;
|
|
774
|
-
commandkit: CommandKit;
|
|
775
|
-
event: {
|
|
776
|
-
data: ParsedEvent;
|
|
777
|
-
event: string;
|
|
778
|
-
namespace: string | null;
|
|
779
|
-
arguments: any[];
|
|
780
|
-
argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E];
|
|
781
|
-
};
|
|
782
|
-
command: null;
|
|
783
|
-
}
|
|
784
|
-
type EvaluationContext = CommandFlagContext | EventFlagContext;
|
|
785
|
-
type CustomEvaluationFunction<E> = () => MaybePromise<E>;
|
|
786
|
-
type CustomEvaluationContext<E> = {
|
|
787
|
-
identify: E | CustomEvaluationFunction<E>;
|
|
788
|
-
};
|
|
789
|
-
interface FlagRunner<E, R> {
|
|
790
|
-
(): Promise<R>;
|
|
791
|
-
run(context: CustomEvaluationContext<E>): Promise<R>;
|
|
792
|
-
}
|
|
793
|
-
declare class FeatureFlag<R, T> {
|
|
794
|
-
readonly options: FeatureFlagDefinition<R, T>;
|
|
795
|
-
constructor(options: FeatureFlagDefinition<R, T>);
|
|
796
|
-
private getContext;
|
|
797
|
-
execute(res?: T): Promise<R>;
|
|
798
|
-
}
|
|
799
|
-
declare function flag<Returns = boolean, Entity = Record<any, any>>(options: FeatureFlagDefinition<Returns, Entity>): FlagRunner<Entity, Returns>;
|
|
800
|
-
|
|
801
|
-
declare class FlagStore extends Collection<string, FeatureFlag<any, any>> {
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
interface CommandKitConfiguration {
|
|
805
|
-
defaultLocale: Locale;
|
|
806
|
-
getMessageCommandPrefix: (message: Message) => Awaitable<string | string[]>;
|
|
807
|
-
}
|
|
808
|
-
declare let commandkit: CommandKit;
|
|
809
|
-
type BootstrapFunction = GenericFunction<[CommandKit]> | AsyncFunction<[CommandKit]>;
|
|
810
|
-
/**
|
|
811
|
-
* Registers a bootstrap hook that will be called when the CommandKit instance is created.
|
|
812
|
-
* This is useful for plugins that need to run some code after the CommandKit instance is fully initialized.
|
|
813
|
-
* Note that not all commandkit dependiencs are available at this point. It is recommended to use the `onApplicationBootstrap` hook instead,
|
|
814
|
-
* if you need access to the commandkit dependencies.
|
|
815
|
-
* @param fn The bootstrap function to register.
|
|
816
|
-
* @example ```ts
|
|
817
|
-
* import { onBootstrap } from 'commandkit';
|
|
818
|
-
*
|
|
819
|
-
* onBootstrap(async (commandkit) => {
|
|
820
|
-
* // Do something with the commandkit instance
|
|
821
|
-
* })
|
|
822
|
-
* ```
|
|
823
|
-
*/
|
|
824
|
-
declare function onBootstrap<F extends BootstrapFunction>(fn: F): void;
|
|
825
|
-
/**
|
|
826
|
-
* Registers a bootstrap hook that will be called when the CommandKit instance is created.
|
|
827
|
-
* This is useful for plugins that need to run some code after the CommandKit instance is fully initialized.
|
|
828
|
-
* @param fn The bootstrap function to register.
|
|
829
|
-
* @example ```ts
|
|
830
|
-
* import { onApplicationBootstrap } from 'commandkit';
|
|
831
|
-
*
|
|
832
|
-
* onApplicationBootstrap(async (commandkit) => {
|
|
833
|
-
* // Do something with the commandkit instance
|
|
834
|
-
* })
|
|
835
|
-
* ```
|
|
836
|
-
*/
|
|
837
|
-
declare function onApplicationBootstrap<F extends BootstrapFunction>(fn: F): void;
|
|
838
|
-
declare class CommandKit extends EventEmitter {
|
|
839
|
-
#private;
|
|
840
|
-
private readonly options;
|
|
841
|
-
eventInterceptor: EventInterceptor;
|
|
842
|
-
static readonly createElement: typeof createElement;
|
|
843
|
-
static readonly Fragment: typeof Fragment;
|
|
844
|
-
readonly config: CommandKitConfiguration;
|
|
845
|
-
readonly store: Map<string, any>;
|
|
846
|
-
readonly flags: FlagStore;
|
|
847
|
-
commandsRouter: CommandsRouter;
|
|
848
|
-
eventsRouter: EventsRouter;
|
|
849
|
-
readonly commandHandler: AppCommandHandler;
|
|
850
|
-
readonly eventHandler: AppEventsHandler;
|
|
851
|
-
readonly plugins: CommandKitPluginRuntime;
|
|
852
|
-
readonly events: CommandKitEventsChannel;
|
|
853
|
-
static instance: CommandKit | undefined;
|
|
854
|
-
/**
|
|
855
|
-
* Create a new command and event handler with CommandKit.
|
|
856
|
-
*
|
|
857
|
-
* @param options - The default CommandKit configuration.
|
|
858
|
-
* @see {@link https://commandkit.js.org/docs/guide/commandkit-setup}
|
|
859
|
-
*/
|
|
860
|
-
constructor(options: CommandKitOptions);
|
|
861
|
-
/**
|
|
862
|
-
* Starts the commandkit application.
|
|
863
|
-
* @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.
|
|
864
|
-
*/
|
|
865
|
-
start(token?: string | false): Promise<void>;
|
|
866
|
-
/**
|
|
867
|
-
* Loads all the plugins.
|
|
868
|
-
*/
|
|
869
|
-
loadPlugins(): Promise<void>;
|
|
870
|
-
/**
|
|
871
|
-
* Whether or not the commandkit application has started.
|
|
872
|
-
*/
|
|
873
|
-
get started(): boolean;
|
|
874
|
-
/**
|
|
875
|
-
* Sets the prefix resolver for the command handler.
|
|
876
|
-
* @param resolver The resolver function.
|
|
877
|
-
*/
|
|
878
|
-
setPrefixResolver(resolver: (message: Message) => Awaitable<string | string[]>): this;
|
|
879
|
-
/**
|
|
880
|
-
* Sets the default locale for the command handler.
|
|
881
|
-
* @param locale The default locale.
|
|
882
|
-
*/
|
|
883
|
-
setDefaultLocale(locale: Locale): this;
|
|
884
|
-
/**
|
|
885
|
-
* Get the client attached to this CommandKit instance.
|
|
886
|
-
*/
|
|
887
|
-
get client(): discord_js.Client<boolean>;
|
|
888
|
-
/**
|
|
889
|
-
* Updates application commands with the latest from "commandsPath".
|
|
890
|
-
*/
|
|
891
|
-
reloadCommands(): Promise<void>;
|
|
892
|
-
/**
|
|
893
|
-
* Updates application events with the latest from "eventsPath".
|
|
894
|
-
*/
|
|
895
|
-
reloadEvents(): Promise<void>;
|
|
896
|
-
/**
|
|
897
|
-
* Increment the client listeners count.
|
|
898
|
-
*/
|
|
899
|
-
incrementClientListenersCount(): void;
|
|
900
|
-
/**
|
|
901
|
-
* Decrement the client listeners count.
|
|
902
|
-
*/
|
|
903
|
-
decrementClientListenersCount(): void;
|
|
904
|
-
/**
|
|
905
|
-
* Path to the app directory. Returns `null` if not found.
|
|
906
|
-
* The lookup order is:
|
|
907
|
-
* - `./app`
|
|
908
|
-
* - `./src/app`
|
|
909
|
-
*/
|
|
910
|
-
getAppDirectory(): string | null;
|
|
911
|
-
getPath(to: 'commands' | 'events'): string | null;
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
export { cancelAfter as $, AppCommandHandler as A, type CommandKitConfiguration as B, type CommandTypeData as C, commandkit as D, type BootstrapFunction as E, onBootstrap as F, onApplicationBootstrap as G, type GenericFunction as H, type InteractionCommandContext as I, isCommandWorkerContext as J, type AsyncFunction as K, type LoadedCommand as L, type MessageCommandContext as M, exitContext as N, provideContext as O, type PreparedAppCommandExecution as P, makeContextAwareFunction as Q, type RunCommand as R, type SlashCommandMiddlewareContext as S, getCommandKit as T, type UserContextMenuCommandContext as U, getContext as V, useEnvironment as W, type CommandKitEnvironmentInternalData as X, CommandKitEnvironment as Y, CommandKitEnvironmentType as Z, after as _, type ResolvableCommand as a, type CommandKitOptions as a0, type CommandContext as a1, type CommandData as a2, type PluginTransformParameters as a3, type TransformedResult as a4, type ResolveResult as a5, CompilerPlugin as a6, isCompilerPlugin as a7, RuntimePlugin as a8, isRuntimePlugin as a9, registerDevHooks as aA, type PluginOptions as aB, PluginType as aC, PluginCommon as aD, isPlugin as aE, FlagStore as aF, type CommandKitPlugin as aa, type MaybeFalsey as ab, type CommandKitEventDispatch as ac, CommandKitPluginRuntime as ad, CompilerPluginRuntime as ae, fromEsbuildPlugin as af, type CommonPluginRuntime as ag, type MaybePromise as ah, type IdentifyFunction as ai, type DecideFunction as aj, type FeatureFlagDefinition as ak, type CommandFlagContext as al, type EventFlagContext as am, type EvaluationContext as an, type CustomEvaluationFunction as ao, type CustomEvaluationContext as ap, type FlagRunner as aq, FeatureFlag as ar, flag as as, AppCommandRunner as at, type ListenerFunction as au, CommandKitEventsChannel as av, type EventListener as aw, type LoadedEvent as ax, type AppEventsHandlerLoadedData as ay, AppEventsHandler as az, type CommandBuilderLike as b, CommandExecutionMode as c, type ContextParameters as d, type MessageCommandMiddlewareContext as e, type InteractionCommandMiddlewareContext as f, type ChatInputCommandContext as g, type AutocompleteCommandContext as h, type AutocompleteCommandMiddlewareContext as i, type MessageContextMenuCommandContext as j, type MessageContextMenuCommandMiddlewareContext as k, type UserContextMenuCommandMiddlewareContext as l, type CommandContextOptions as m, type AnyCommandExecute as n, type ChatInputCommand as o, type AutocompleteCommand as p, type MessageContextMenuCommand as q, type UserContextMenuCommand as r, type MessageCommand as s, type MiddlewareContextArgs as t, Context as u, MiddlewareContext as v, type PreRegisterCommandsEvent as w, CommandRegistrar as x, CommandKit as y, type CommandKitHMREvent as z };
|