commandkit 1.0.0-dev.20250529020123 → 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,8 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
${r} ${h.dim(ie.corner)}`,...t.map(s=>a(s))):this.logger.log(`${n} ${h.dim(ie.corner)}`,...t.map(s=>a(s)))}debug(...e){this._log(0,...e)}error(...e){this._log(3,...e)}log(...e){this._log(4,...e)}info(...e){this._log(1,...e)}warn(...e){this._log(2,...e)}};o(Ie,"DefaultLogger");var ae=Ie;function Zt(i){let e=i;if(!(e!=null&&e.provider))throw new Error("A logger provider must be provided.");let t=["log","error","warn","info","debug"],n={configure(r){e=r}};for(let r of t)n[r]=(...a)=>{e.provider[r](...a)};return n}o(Zt,"createLogger");var b=Zt({provider:new ae});var Se=class Se{constructor(e){this.commandkit=e;this.api.setToken(this.commandkit.client.token??process.env.DISCORD_TOKEN??process.env.TOKEN??"")}api=new T.REST;getCommandsData(){return this.commandkit.commandHandler.getCommandsArray().flatMap(n=>{let r="toJSON"in n.data.command?n.data.command.toJSON():n.data.command,a=[r];return n.data.userContextMenu&&r.type!==T.ApplicationCommandType.User&&a.push({...r,type:T.ApplicationCommandType.User,options:void 0,description_localizations:void 0,description:void 0}),n.data.messageContextMenu&&r.type!==T.ApplicationCommandType.Message&&a.push({...r,type:T.ApplicationCommandType.Message,description_localizations:void 0,description:void 0,options:void 0}),a})}async register(){let e=this.getCommandsData(),t=!1,n={preventDefault(){t=!0},commands:e};if(await this.commandkit.plugins.execute(async(s,u)=>{if(!t)return u.onBeforeRegisterCommands(s,n)}),t)return;if(!this.commandkit.client.isReady())throw new Error("Cannot register commands before the client is ready");let r=e.filter(s=>{var u;return(u=s.guilds)==null?void 0:u.filter(Boolean).length}).map(s=>{var u;return{...s,guilds:Array.from(new Set((u=s.guilds)==null?void 0:u.filter(Boolean)))}}),a=e.filter(s=>{var u;return!((u=s.guilds)!=null&&u.filter(Boolean).length)});await this.updateGlobalCommands(a),await this.updateGuildCommands(r)}async updateGlobalCommands(e){if(!e.length)return;let t=!1,n={preventDefault(){t=!0},commands:e};await this.commandkit.plugins.execute(async(r,a)=>{if(!t)return a.onBeforeRegisterGlobalCommands(r,n)});try{let r=await this.api.put(T.Routes.applicationCommands(this.commandkit.client.user.id),{body:e.map(a=>({...a,guilds:void 0}))});b.info(`\u2728 Refreshed ${r.length} global application (/) commands`)}catch(r){b.error("Failed to update global application (/) commands",r)}}async updateGuildCommands(e){if(!e.length)return;let t=!1,n={preventDefault(){t=!0},commands:e};if(await this.commandkit.plugins.execute(async(r,a)=>{if(!t)return a.onBeforePrepareGuildCommandsRegistration(r,n)}),!t)try{let r=new Map;if(e.forEach(s=>{var u;(u=s.guilds)!=null&&u.length&&s.guilds.forEach(c=>{r.has(c)||r.set(c,[]),r.get(c).push(s)})}),!r.size)return;let a=0;for(let[s,u]of r){let c=!1,d={preventDefault(){c=!0},commands:u};if(await this.commandkit.plugins.execute(async(f,x)=>{if(!c)return x.onBeforeRegisterGuildCommands(f,d)}),c)continue;let m=await this.api.put(T.Routes.applicationGuildCommands(this.commandkit.client.user.id,s),{body:u.map(f=>({...f,guilds:void 0}))});a+=m.length}b.info(`\u2728 Refreshed ${a} guild application (/) commands`)}catch(r){b.error("Failed to update guild application (/) commands",r)}}};o(Se,"CommandRegistrar");var se=Se;var ce=require("discord.js");var Ze=require("crypto");var C,Re=class Re{constructor(e){this.commandkit=e;g(this,C,{executionError:null,type:null,variables:new Map,deferredFunctions:new Map,marker:"",markStart:0,markEnd:0,context:null})}setContext(e){p(this,C).context=e}get context(){return p(this,C).context}getExecutionError(){return p(this,C).executionError}setExecutionError(e){if(p(this,C).executionError)throw new Error("Execution error already set.");p(this,C).executionError=e}getType(){let e=p(this,C).type;if(!e)throw new Error("Environment type not set.");return e}setType(e){p(this,C).type=e}get variables(){return p(this,C).variables}registerDeferredFunction(e){let t=(0,Ze.randomUUID)();return p(this,C).deferredFunctions.set(t,e),t}clearDeferredFunction(e){p(this,C).deferredFunctions.delete(e)}async runDeferredFunctions(){for(let[e,t]of p(this,C).deferredFunctions)try{await t(this)}catch(n){this.commandkit.emit("unhandledDeferredFunctionRejection",n)}finally{this.clearDeferredFunction(e)}}clearAllDeferredFunctions(){p(this,C).deferredFunctions.clear()}markStart(e){p(this,C).marker=e,p(this,C).markStart=performance.now()}markEnd(){p(this,C).markEnd||(p(this,C).markEnd=performance.now())}getMarker(){return p(this,C).marker}getExecutionTime(){return Math.abs(p(this,C).markEnd-p(this,C).markStart)}};C=new WeakMap,o(Re,"CommandKitEnvironment");var le=Re;function et(){throw F(y.ExitMiddleware)}o(et,"exitMiddleware");function tt(){throw F(y.ForwardedCommand)}o(tt,"redirect");var M={ChatInputCommand:"chatInput",MessageContextMenu:"messageContextMenu",UserContextMenu:"userContextMenu",Autocomplete:"autocomplete",Message:"message"},_,z=class z{constructor(e,t){this.commandkit=e;this.config=t;R(this,"interaction");R(this,"message");R(this,"guild");R(this,"guildId");R(this,"channel");R(this,"channelId");R(this,"client");R(this,"command");g(this,_);R(this,"_locale",null);this.interaction=t.interaction,this.message=t.message,this.client=e.client,v(this,_,t.store??new Map),this.command=t.command,t.interaction&&(this.guild=t.interaction.guild,this.guildId=t.interaction.guildId,this.channel=t.interaction.channel,this.channelId=t.interaction.channelId),t.message&&(this.guild=t.message.guild,this.guildId=t.message.guildId,this.channel=t.message.channel,this.channelId=t.message.channelId),this.config.environment&&this.config.environment.setContext(this)}get store(){return p(this,_)}get commandName(){return this.isInteraction()?this.interaction.commandName:this.config.messageCommandParser.getCommand()}get options(){return this.isMessage()?this.config.messageCommandParser.options:this.interaction.options}get forwarded(){return this.config.forwarded??!1}async forwardCommand(e){let t=await this.commandkit.commandHandler.prepareCommandRun(this.isInteraction()?this.interaction:this.message,e);if(!t)throw new Error(`Command ${e} not found`);let n=this.config.environment??P();if(!n)throw new Error("No commandkit environment found.");let r={chatInput:t.command.data.chatInput,autocomplete:t.command.data.autocomplete,message:t.command.data.message,messageContextMenu:t.command.data.messageContextMenu,userContextMenu:t.command.data.userContextMenu},a=n.variables.get("execHandlerKind");if(!a)throw new Error("No execution handler kind found.");let s=r[a];if(!s)throw new Error(`No handler found for ${a}`);n.variables.set("forwardedBy",this.commandName),n.variables.set("forwardedTo",e),await s(this.clone({forwarded:!0})),tt()}get executionMode(){return this.config.executionMode}isInteraction(){return this.executionMode===M.ChatInputCommand||this.executionMode===M.Autocomplete||this.executionMode===M.MessageContextMenu||this.executionMode===M.UserContextMenu}isChatInputCommand(){return this.executionMode===M.ChatInputCommand}isAutocomplete(){return this.executionMode===M.Autocomplete}isMessageContextMenu(){return this.executionMode===M.MessageContextMenu}isUserContextMenu(){return this.executionMode===M.UserContextMenu}isMessage(){return this.executionMode===M.Message}getCommandIdentifier(){return this.isInteraction()?this.interaction.commandName:this.message.content.split(" ")[0].slice(1)}getGuildLocale(){var e;return this.isInteraction()?this.interaction.guildLocale:((e=this.message.guild)==null?void 0:e.preferredLocale)??null}getUserLocale(){return this.isInteraction()?this.interaction.locale:null}getLocale(e=!1){if(this._locale)return this._locale;let t=e?this.getUserLocale():this.getGuildLocale();return t||this.commandkit.config.defaultLocale}setLocale(e){this._locale=e}clone(e){return e?new z(this.commandkit,{...this.config,...e,store:p(this,_)}):new z(this.commandkit,this.config)}isMiddleware(){return this instanceof J}args(){return this.isMessage()?this.config.messageCommandParser.getArgs():[]}exit(){et()}};_=new WeakMap,o(z,"Context");var Pe=z,Y,Ke=class Ke extends Pe{constructor(){super(...arguments);g(this,Y,!1)}get cancelled(){return p(this,Y)}cancel(){v(this,Y,!0)}setCommandRunner(t){var n,r;(r=(n=this.config.customArgs)==null?void 0:n.setCommandRunner)==null||r.call(n,t)}};Y=new WeakMap,o(Ke,"MiddlewareContext");var J=Ke;var ue,nt,De=class De{constructor(e){this.handler=e;g(this,ue)}async runCommand(e,t){let{commandkit:n}=this.handler,r=this.getExecutionMode(t),a=null,s=new le(n);s.setType("COMMAND_HANDLER"),s.variables.set("commandHandlerType","app"),s.variables.set("currentCommandName",e.command.command.name),s.variables.set("execHandlerKind",r);let u=new J(n,{command:e.command,environment:s,executionMode:r,interaction:t instanceof ce.Message?null:t,message:t instanceof ce.Message?t:null,forwarded:!1,customArgs:{setCommandRunner:o(d=>{a=d},"setCommandRunner")},messageCommandParser:e.messageCommandParser}),c=!1;if(e.middlewares.length&&await oe(s,async()=>{for(let d of e.middlewares)if(d.data.beforeExecute)try{await d.data.beforeExecute(u)}catch(m){if(A(m,y.ExitMiddleware)){c=!0;return}if(A(m,[y.ForwardedCommand,y.InvalidCommandPrefix]))continue;throw m}}),!u.cancelled){let m=e.command.data[r];if(m||b.warn(`Command ${e.command.command.name} has no handler for ${r}`),m)try{let f=Xe(s,async()=>(s.registerDeferredFunction(K=>{K.markEnd();let S=K.getExecutionError(),I=K.getMarker(),L=`${K.getExecutionTime().toFixed(2)}ms`;if(S){b.error(`[${I} - ${L}] Error executing command: ${S.stack||S}`);return}b.info(`[${I} - ${L}] Command executed successfully`)}),m(u.clone())),D(this,ue,nt).bind(this)),x=a!=null?a(f):f;s.markStart(e.command.data.command.name),await n.plugins.execute(async(K,S)=>S.executeCommand(K,s,t,e,x))||await x()}catch(f){A(f,y.ExitMiddleware)&&(c=!0),A(f,[y.ForwardedCommand,y.ExitMiddleware])||b.error(f)}}!c&&e.middlewares.length&&await oe(s,async()=>{for(let d of e.middlewares)if(d.data.afterExecute)try{await d.data.afterExecute(u)}catch(m){if(A(m,y.ExitMiddleware))return;throw m}})}getExecutionMode(e){return e instanceof ce.Message?M.Message:e.isChatInputCommand()?M.ChatInputCommand:e.isAutocomplete()?M.Autocomplete:e.isMessageContextMenuCommand()?M.MessageContextMenu:e.isUserContextMenuCommand()?M.UserContextMenu:null}};ue=new WeakSet,nt=o(async function(){let e=Qe();await e.runDeferredFunctions(),e.clearAllDeferredFunctions(),await this.handler.commandkit.plugins.execute(async(t,n)=>{await n.onAfterCommand(t,e)})},"#finalizer"),o(De,"AppCommandRunner");var me=De;var en={command:o(i=>i instanceof E.SlashCommandBuilder||i instanceof E.ContextMenuCommandBuilder||i&&typeof i=="object","command"),chatInput:o(i=>typeof i=="function","chatInput"),autocomplete:o(i=>typeof i=="function","autocomplete"),message:o(i=>typeof i=="function","message"),messageContextMenu:o(i=>typeof i=="function","messageContextMenu"),userContextMenu:o(i=>typeof i=="function","userContextMenu")},tn={beforeExecute:o(i=>typeof i=="function","beforeExecute"),afterExecute:o(i=>typeof i=="function","afterExecute")},Te=class Te{constructor(e){this.commandkit=e;this.registrar=new se(this.commandkit)}loadedCommands=new E.Collection;loadedMiddlewares=new E.Collection;commandNameToId=new Map;subcommandPathToId=new Map;registrar;onInteraction=null;onMessageCreate=null;commandRunner=new me(this);externalCommandData=new E.Collection;externalMiddlewareData=new E.Collection;printBanner(){let e=crypto.randomUUID(),t=this.getCommandsArray().reduce((c,d)=>{let m=d.command.category||e;return c[m]=c[m]||[],c[m].push(d),c},{});console.log(h.green(`Loaded ${h.magenta(this.loadedCommands.size.toString())} commands:`));let n=Object.keys(t).sort(),r={};n.forEach(c=>{if(c!==e&&c.includes(":")){let d=c.split(":"),m=null;for(let f=d.length-1;f>0;f--){let x=d.slice(0,f).join(":");if(n.includes(x)){m=x;break}}m&&(r[m]=r[m]||[],r[m].push(c))}});let a=new Set,s=o((c,d="",m=!1,f="")=>{if(a.has(c))return;a.add(c);let x=t[c],O=r[c]&&r[c].length>0,K=m?"\u2514\u2500":"\u251C\u2500",S=f+(m?" ":"\u2502 ");if(c!==e){let I=c.includes(":")?c.split(":").pop():c;console.log(h.cyan(`${d}${K} ${h.bold(I)}`))}if(x.forEach((I,L)=>{let de=L===x.length-1&&!O?"\u2514\u2500":"\u251C\u2500",rt=c!==e?S:d,ot=I.data.command.name,it=I.command.middlewares.length>0?h.magenta(" (\u03BB)"):"";console.log(`${h.green(`${rt}${de}`)} ${h.yellow(ot)}${it}`)}),O){let I=r[c].sort();I.forEach((L,Ae)=>{let de=Ae===I.length-1;s(L,S,de,S)})}},"printCategory"),u=n.filter(c=>{if(c===e)return!0;if(c.includes(":")){let d=c.split(":");for(let m=1;m<d.length;m++){let f=d.slice(0,m).join(":");if(n.includes(f))return!1}return!0}return!0}).sort();u.forEach((c,d)=>{let m=d===u.length-1;s(c,"",m)})}getCommandsArray(){return Array.from(this.loadedCommands.values())}registerCommandHandler(){this.onInteraction??=async e=>{if(await this.commandkit.plugins.execute(async(a,s)=>s.onBeforeInteraction(a,e))||!(e.isCommand()||e.isAutocomplete()||e.isUserContextMenuCommand()||e.isMessageContextMenuCommand()))return;let r=await this.prepareCommandRun(e);if(r)return this.commandRunner.runCommand(r,e)},this.onMessageCreate??=async e=>{if(await this.commandkit.plugins.execute(async(r,a)=>a.onBeforeMessageCommand(r,e))||e.author.bot)return;let n=await this.prepareCommandRun(e);if(n)return this.commandRunner.runCommand(n,e)},this.commandkit.client.on(E.Events.InteractionCreate,this.onInteraction),this.commandkit.client.on(E.Events.MessageCreate,this.onMessageCreate)}async prepareCommandRun(e,t){var u;let n;if(!t)if(e instanceof E.Message){if(e.author.bot)return null;let c=await this.commandkit.config.getMessageCommandPrefix(e);n=new Z(e,Array.isArray(c)?c:[c],d=>{var O,K;let m=this.commandNameToId.get(d);if(!m)return null;let f=this.loadedCommands.get(m);return!f||e.guildId&&((O=f.guilds)!=null&&O.length)&&!f.guilds.includes(e.guildId)?null:((K=("toJSON"in f.data.command?f.data.command.toJSON():f.data.command).options)==null?void 0:K.reduce((S,I)=>(S[I.name]=I.type,S),{}))??{}});try{t=n.getFullCommand().split(" ")[0]}catch(d){return A(d,y.InvalidCommandPrefix)||b.error(d),null}}else{if(!(e.isChatInputCommand()||e.isAutocomplete()||e.isContextMenuCommand()))return null;t=e.commandName}let r=this.commandNameToId.get(t);if(!r)return null;let a=this.loadedCommands.get(r);if(!a||(e instanceof E.CommandInteraction||e instanceof E.AutocompleteInteraction)&&e.guildId&&((u=a.guilds)!=null&&u.length)&&!a.guilds.includes(e.guildId))return null;let s=[];for(let c of a.command.middlewares){let d=this.loadedMiddlewares.get(c);d&&s.push(d)}return{command:a,middlewares:s,messageCommandParser:n}}async reloadCommands(){this.loadedCommands.clear(),this.loadedMiddlewares.clear(),this.commandNameToId.clear(),this.subcommandPathToId.clear(),this.externalCommandData.clear(),this.externalMiddlewareData.clear(),await this.loadCommands()}async addExternalMiddleware(e){for(let t of e)t.id&&this.externalMiddlewareData.set(t.id,t)}async addExternalCommands(e){for(let t of e)t.id&&this.externalCommandData.set(t.id,t)}async registerExternalLoadedMiddleware(e){for(let t of e)this.loadedMiddlewares.set(t.middleware.id,t)}async registerExternalLoadedCommands(e){for(let t of e)this.loadedCommands.set(t.command.id,t),this.commandNameToId.set(t.command.name,t.command.id)}async loadCommands(){await this.commandkit.plugins.execute((s,u)=>u.onBeforeCommandsLoad(s));let e=this.commandkit.commandsRouter;if(!e)throw new Error("Commands router has not yet initialized");let{commands:t,middlewares:n}=e.getData(),r=this.externalCommandData.size?t.concat(this.externalCommandData):t,a=this.externalMiddlewareData.size?n.concat(this.externalMiddlewareData):n;for(let[s,u]of a)await this.loadMiddleware(s,u);for(let[s,u]of r)await this.loadCommand(s,u);G&&await ze(`type CommandTypeData = ${Array.from(this.loadedCommands.mapValues(s=>JSON.stringify(s.command.name)).values()).join(" | ")}`),await this.commandkit.plugins.execute((s,u)=>u.onAfterCommandsLoad(s))}async loadMiddleware(e,t){try{let n=await import(`${X(t.path)}?t=${Date.now()}`),r=0;for(let[a,s]of Object.entries(tn)){if(n[a]&&!await s(n[a]))throw new Error(`Invalid export for middleware ${e}: ${a} does not match expected value`);n[a]&&r++}if(r===0)throw new Error(`Invalid export for middleware ${e}: at least one handler function must be provided`);this.loadedMiddlewares.set(e,{middleware:t,data:n})}catch(n){b.error(`Failed to load middleware ${e}`,n)}}async loadCommand(e,t){try{if(t.path===null){this.loadedCommands.set(e,{command:t,data:{command:{name:t.name,description:`${t.name} commands`,type:1}}});return}let n=await import(`${X(t.path)}?t=${Date.now()}`);if(!n.command)throw new Error(`Invalid export for command ${t.name}: no command definition found`);let r=0;for(let[s,u]of Object.entries(en))if(s!=="command"&&n[s]&&r++,n[s]&&!await u(n[s]))throw new Error(`Invalid export for command ${t.name}: ${s} does not match expected value`);if(r===0)throw new Error(`Invalid export for command ${t.name}: at least one handler function must be provided`);let a=n.command;await this.commandkit.plugins.execute(async(s,u)=>{let c=await u.prepareCommand(s,a);c&&(a=c)}),this.loadedCommands.set(e,{command:t,guilds:n.guilds,data:{...n,command:"toJSON"in a?a.toJSON():a}}),this.commandNameToId.set(t.name,e)}catch(n){b.error(`Failed to load command ${t.name} (${e})`,n)}}};o(Te,"AppCommandHandler");var re=Te;0&&(module.exports={AppCommandHandler});
|
|
8
|
-
|
|
1
|
+
require('../../colors-Cd4Oz-r-.js');
|
|
2
|
+
require('../../ActionRow-CmTHbo2t.js');
|
|
3
|
+
require('../../error-codes-C_UO39jz.js');
|
|
4
|
+
const require_CommandKit = require('../../CommandKit-DDrQtQns.js');
|
|
5
|
+
require('../../common-CcfjYnPG.js');
|
|
6
|
+
require('../../common-CeO-vn8Y.js');
|
|
7
|
+
require('../../container-CpuiLsZM.js');
|
|
8
|
+
require('../../file-DE69SSOP.js');
|
|
9
|
+
require('../../media-gallery-nUEHqKVF.js');
|
|
10
|
+
require('../../section-D6t7tyEZ.js');
|
|
11
|
+
require('../../separator-DYAFK-Jj.js');
|
|
12
|
+
require('../../text-display-Dy6JHB5X.js');
|
|
13
|
+
require('../../v2-DofkPKHs.js');
|
|
14
|
+
require('../../warn-unstable-V20WCBDd.js');
|
|
15
|
+
require('../../element-hdSqnIpC.js');
|
|
16
|
+
require('../../types-B5VPP9ig.js');
|
|
17
|
+
require('../../EventInterceptor-DtRINyTP.js');
|
|
18
|
+
require('../../constants-DOPSzXI0.js');
|
|
19
|
+
require('../../PluginCommon-DPqnQngK.js');
|
|
20
|
+
require('../../CompilerPlugin-XzuGixkC.js');
|
|
21
|
+
require('../../RuntimePlugin-CKsd83M3.js');
|
|
22
|
+
require('../../types-Bq0EWaM3.js');
|
|
23
|
+
require('../../CompilerPluginRuntime-zFCCw1kM.js');
|
|
24
|
+
require('../../types-Cdh4uaFR.js');
|
|
25
|
+
require('../../runtime-ByJtSXs_.js');
|
|
26
|
+
require('../../EventWorkerContext-XZGSHn5F.js');
|
|
27
|
+
require('../../resolve-file-url-pO9_rLft.js');
|
|
28
|
+
require('../../MessageCommandParser-B13Pkwo9.js');
|
|
29
|
+
require('../../signals-Bp0bzjE6.js');
|
|
30
|
+
require('../../types-package-DRhFn59I.js');
|
|
31
|
+
require('../../CommandsRouter-BHaPno8o.js');
|
|
32
|
+
require('../../EventsRouter-CqnrlbjN.js');
|
|
33
|
+
require('../../router-Dn35v30f.js');
|
|
34
|
+
require('../../common-DirpDCa6.js');
|
|
35
|
+
require('../../CommandKitEventsChannel-B6LKgxmv.js');
|
|
36
|
+
require('../../store-Ci6ib2C9.js');
|
|
37
|
+
|
|
38
|
+
exports.AppCommandHandler = require_CommandKit.AppCommandHandler;
|
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
1
|
+
import { AppEventsHandler, AppEventsHandlerLoadedData, EventListener, LoadedEvent } from "../../CommandKit-CDlCsGCx.js";
|
|
2
|
+
import "../../EventInterceptor-D_oEWSnF.js";
|
|
3
|
+
import "../../ButtonKit-BSI7lCI0.js";
|
|
4
|
+
import "../../ModalKit-CKtQ8eXW.js";
|
|
5
|
+
import "../../element-D_nyVwgB.js";
|
|
6
|
+
import "../../ActionRow-D0wafJhZ.js";
|
|
7
|
+
import "../../types-CJ-XvOFN.js";
|
|
8
|
+
import "../../Button-Bl5nbwTS.js";
|
|
9
|
+
import "../../Modal-Cxm6cs5c.js";
|
|
10
|
+
import "../../common-pvPJVTfe.js";
|
|
11
|
+
import "../../StringSelectMenuKit-B9FHTe48.js";
|
|
12
|
+
import "../../ChannelSelectMenuKit-L15A2jpT.js";
|
|
13
|
+
import "../../MentionableSelectMenuKit-BiUSKUtZ.js";
|
|
14
|
+
import "../../UserSelectMenuKit-DiP0imyo.js";
|
|
15
|
+
import "../../RoleSelectMenuKit-BSMKkru2.js";
|
|
16
|
+
import "../../SelectMenu-b7jgrkjO.js";
|
|
17
|
+
import "../../container-CwEATQy2.js";
|
|
18
|
+
import "../../file-BdyYwkaI.js";
|
|
19
|
+
import "../../media-gallery-DCu02VXc.js";
|
|
20
|
+
import "../../section-fktaECHL.js";
|
|
21
|
+
import "../../separator-CuesaLrC.js";
|
|
22
|
+
import "../../text-display-DNMwmGHJ.js";
|
|
23
|
+
import "../../index-Dw5cCt-A.js";
|
|
24
|
+
import "../../index-E7Wvm5uX.js";
|
|
25
|
+
import "../../MessageCommandParser-tzroBwij.js";
|
|
26
|
+
import "../../signals-DUoWkeZ7.js";
|
|
27
|
+
import "../../helpers-DAmE106r.js";
|
|
28
|
+
import "../../CommandsRouter-C7X-eXE2.js";
|
|
29
|
+
import "../../EventsRouter-BacqK6z3.js";
|
|
30
|
+
import "../../index-CUPkUUOR.js";
|
|
31
|
+
import "../../constants-Ce6w4OFe.js";
|
|
32
|
+
import "../../types-BDwNROY2.js";
|
|
33
|
+
export { AppEventsHandler, AppEventsHandlerLoadedData, EventListener, LoadedEvent };
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
require('../../colors-Cd4Oz-r-.js');
|
|
2
|
+
require('../../ActionRow-CmTHbo2t.js');
|
|
3
|
+
require('../../error-codes-C_UO39jz.js');
|
|
4
|
+
const require_CommandKit = require('../../CommandKit-DDrQtQns.js');
|
|
5
|
+
require('../../common-CcfjYnPG.js');
|
|
6
|
+
require('../../common-CeO-vn8Y.js');
|
|
7
|
+
require('../../container-CpuiLsZM.js');
|
|
8
|
+
require('../../file-DE69SSOP.js');
|
|
9
|
+
require('../../media-gallery-nUEHqKVF.js');
|
|
10
|
+
require('../../section-D6t7tyEZ.js');
|
|
11
|
+
require('../../separator-DYAFK-Jj.js');
|
|
12
|
+
require('../../text-display-Dy6JHB5X.js');
|
|
13
|
+
require('../../v2-DofkPKHs.js');
|
|
14
|
+
require('../../warn-unstable-V20WCBDd.js');
|
|
15
|
+
require('../../element-hdSqnIpC.js');
|
|
16
|
+
require('../../types-B5VPP9ig.js');
|
|
17
|
+
require('../../EventInterceptor-DtRINyTP.js');
|
|
18
|
+
require('../../constants-DOPSzXI0.js');
|
|
19
|
+
require('../../PluginCommon-DPqnQngK.js');
|
|
20
|
+
require('../../CompilerPlugin-XzuGixkC.js');
|
|
21
|
+
require('../../RuntimePlugin-CKsd83M3.js');
|
|
22
|
+
require('../../types-Bq0EWaM3.js');
|
|
23
|
+
require('../../CompilerPluginRuntime-zFCCw1kM.js');
|
|
24
|
+
require('../../types-Cdh4uaFR.js');
|
|
25
|
+
require('../../runtime-ByJtSXs_.js');
|
|
26
|
+
require('../../EventWorkerContext-XZGSHn5F.js');
|
|
27
|
+
require('../../resolve-file-url-pO9_rLft.js');
|
|
28
|
+
require('../../MessageCommandParser-B13Pkwo9.js');
|
|
29
|
+
require('../../signals-Bp0bzjE6.js');
|
|
30
|
+
require('../../types-package-DRhFn59I.js');
|
|
31
|
+
require('../../CommandsRouter-BHaPno8o.js');
|
|
32
|
+
require('../../EventsRouter-CqnrlbjN.js');
|
|
33
|
+
require('../../router-Dn35v30f.js');
|
|
34
|
+
require('../../common-DirpDCa6.js');
|
|
35
|
+
require('../../CommandKitEventsChannel-B6LKgxmv.js');
|
|
36
|
+
require('../../store-Ci6ib2C9.js');
|
|
37
|
+
|
|
38
|
+
exports.AppEventsHandler = require_CommandKit.AppEventsHandler;
|
package/dist/app/index.d.ts
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
1
|
+
import { AnyCommandExecute, AppCommandHandler, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContextOptions, CommandExecutionMode, CommandRegistrar, CommandTypeData, Context, ContextParameters, InteractionCommandContext, InteractionCommandMiddlewareContext, LoadedCommand, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, RunCommand, SlashCommandMiddlewareContext, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext } from "../CommandKit-CDlCsGCx.js";
|
|
2
|
+
import "../EventInterceptor-D_oEWSnF.js";
|
|
3
|
+
import "../ButtonKit-BSI7lCI0.js";
|
|
4
|
+
import "../ModalKit-CKtQ8eXW.js";
|
|
5
|
+
import "../element-D_nyVwgB.js";
|
|
6
|
+
import "../ActionRow-D0wafJhZ.js";
|
|
7
|
+
import "../types-CJ-XvOFN.js";
|
|
8
|
+
import "../Button-Bl5nbwTS.js";
|
|
9
|
+
import "../Modal-Cxm6cs5c.js";
|
|
10
|
+
import "../common-pvPJVTfe.js";
|
|
11
|
+
import "../StringSelectMenuKit-B9FHTe48.js";
|
|
12
|
+
import "../ChannelSelectMenuKit-L15A2jpT.js";
|
|
13
|
+
import "../MentionableSelectMenuKit-BiUSKUtZ.js";
|
|
14
|
+
import "../UserSelectMenuKit-DiP0imyo.js";
|
|
15
|
+
import "../RoleSelectMenuKit-BSMKkru2.js";
|
|
16
|
+
import "../SelectMenu-b7jgrkjO.js";
|
|
17
|
+
import "../container-CwEATQy2.js";
|
|
18
|
+
import "../file-BdyYwkaI.js";
|
|
19
|
+
import "../media-gallery-DCu02VXc.js";
|
|
20
|
+
import "../section-fktaECHL.js";
|
|
21
|
+
import "../separator-CuesaLrC.js";
|
|
22
|
+
import "../text-display-DNMwmGHJ.js";
|
|
23
|
+
import "../index-Dw5cCt-A.js";
|
|
24
|
+
import "../index-E7Wvm5uX.js";
|
|
25
|
+
import { MessageCommandOptions, MessageCommandOptionsSchema, MessageCommandParser, ParsedMessageCommand } from "../MessageCommandParser-tzroBwij.js";
|
|
26
|
+
import { exitMiddleware, redirect, rethrow } from "../signals-DUoWkeZ7.js";
|
|
27
|
+
import { CommandSource, isInteractionSource, isMessageSource } from "../helpers-DAmE106r.js";
|
|
28
|
+
import "../CommandsRouter-C7X-eXE2.js";
|
|
29
|
+
import "../EventsRouter-BacqK6z3.js";
|
|
30
|
+
import "../index-CUPkUUOR.js";
|
|
31
|
+
import "../constants-Ce6w4OFe.js";
|
|
32
|
+
import "../types-BDwNROY2.js";
|
|
33
|
+
export { AnyCommandExecute, AppCommandHandler, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContextOptions, CommandExecutionMode, CommandRegistrar, CommandSource, CommandTypeData, Context, ContextParameters, InteractionCommandContext, InteractionCommandMiddlewareContext, LoadedCommand, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageCommandOptions, MessageCommandOptionsSchema, MessageCommandParser, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, ParsedMessageCommand, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, RunCommand, SlashCommandMiddlewareContext, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, exitMiddleware, isInteractionSource, isMessageSource, redirect, rethrow };
|
package/dist/app/index.js
CHANGED
|
@@ -1,8 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
${i} ${h.dim(se.corner)}`,...t.map(s=>a(s))):this.logger.log(`${n} ${h.dim(se.corner)}`,...t.map(s=>a(s)))}debug(...e){this._log(0,...e)}error(...e){this._log(3,...e)}log(...e){this._log(4,...e)}info(...e){this._log(1,...e)}warn(...e){this._log(2,...e)}};r(Se,"DefaultLogger");var le=Se;function nn(o){let e=o;if(!(e!=null&&e.provider))throw new Error("A logger provider must be provided.");let t=["log","error","warn","info","debug"],n={configure(i){e=i}};for(let i of t)n[i]=(...a)=>{e.provider[i](...a)};return n}r(nn,"createLogger");var b=nn({provider:new le});var Re=class Re{constructor(e){this.commandkit=e;this.api.setToken(this.commandkit.client.token??process.env.DISCORD_TOKEN??process.env.TOKEN??"")}api=new T.REST;getCommandsData(){return this.commandkit.commandHandler.getCommandsArray().flatMap(n=>{let i="toJSON"in n.data.command?n.data.command.toJSON():n.data.command,a=[i];return n.data.userContextMenu&&i.type!==T.ApplicationCommandType.User&&a.push({...i,type:T.ApplicationCommandType.User,options:void 0,description_localizations:void 0,description:void 0}),n.data.messageContextMenu&&i.type!==T.ApplicationCommandType.Message&&a.push({...i,type:T.ApplicationCommandType.Message,description_localizations:void 0,description:void 0,options:void 0}),a})}async register(){let e=this.getCommandsData(),t=!1,n={preventDefault(){t=!0},commands:e};if(await this.commandkit.plugins.execute(async(s,u)=>{if(!t)return u.onBeforeRegisterCommands(s,n)}),t)return;if(!this.commandkit.client.isReady())throw new Error("Cannot register commands before the client is ready");let i=e.filter(s=>{var u;return(u=s.guilds)==null?void 0:u.filter(Boolean).length}).map(s=>{var u;return{...s,guilds:Array.from(new Set((u=s.guilds)==null?void 0:u.filter(Boolean)))}}),a=e.filter(s=>{var u;return!((u=s.guilds)!=null&&u.filter(Boolean).length)});await this.updateGlobalCommands(a),await this.updateGuildCommands(i)}async updateGlobalCommands(e){if(!e.length)return;let t=!1,n={preventDefault(){t=!0},commands:e};await this.commandkit.plugins.execute(async(i,a)=>{if(!t)return a.onBeforeRegisterGlobalCommands(i,n)});try{let i=await this.api.put(T.Routes.applicationCommands(this.commandkit.client.user.id),{body:e.map(a=>({...a,guilds:void 0}))});b.info(`\u2728 Refreshed ${i.length} global application (/) commands`)}catch(i){b.error("Failed to update global application (/) commands",i)}}async updateGuildCommands(e){if(!e.length)return;let t=!1,n={preventDefault(){t=!0},commands:e};if(await this.commandkit.plugins.execute(async(i,a)=>{if(!t)return a.onBeforePrepareGuildCommandsRegistration(i,n)}),!t)try{let i=new Map;if(e.forEach(s=>{var u;(u=s.guilds)!=null&&u.length&&s.guilds.forEach(c=>{i.has(c)||i.set(c,[]),i.get(c).push(s)})}),!i.size)return;let a=0;for(let[s,u]of i){let c=!1,d={preventDefault(){c=!0},commands:u};if(await this.commandkit.plugins.execute(async(f,x)=>{if(!c)return x.onBeforeRegisterGuildCommands(f,d)}),c)continue;let m=await this.api.put(T.Routes.applicationGuildCommands(this.commandkit.client.user.id,s),{body:u.map(f=>({...f,guilds:void 0}))});a+=m.length}b.info(`\u2728 Refreshed ${a} guild application (/) commands`)}catch(i){b.error("Failed to update guild application (/) commands",i)}}};r(Re,"CommandRegistrar");var X=Re;var ue=require("discord.js");var nt=require("crypto");var C,Pe=class Pe{constructor(e){this.commandkit=e;g(this,C,{executionError:null,type:null,variables:new Map,deferredFunctions:new Map,marker:"",markStart:0,markEnd:0,context:null})}setContext(e){p(this,C).context=e}get context(){return p(this,C).context}getExecutionError(){return p(this,C).executionError}setExecutionError(e){if(p(this,C).executionError)throw new Error("Execution error already set.");p(this,C).executionError=e}getType(){let e=p(this,C).type;if(!e)throw new Error("Environment type not set.");return e}setType(e){p(this,C).type=e}get variables(){return p(this,C).variables}registerDeferredFunction(e){let t=(0,nt.randomUUID)();return p(this,C).deferredFunctions.set(t,e),t}clearDeferredFunction(e){p(this,C).deferredFunctions.delete(e)}async runDeferredFunctions(){for(let[e,t]of p(this,C).deferredFunctions)try{await t(this)}catch(n){this.commandkit.emit("unhandledDeferredFunctionRejection",n)}finally{this.clearDeferredFunction(e)}}clearAllDeferredFunctions(){p(this,C).deferredFunctions.clear()}markStart(e){p(this,C).marker=e,p(this,C).markStart=performance.now()}markEnd(){p(this,C).markEnd||(p(this,C).markEnd=performance.now())}getMarker(){return p(this,C).marker}getExecutionTime(){return Math.abs(p(this,C).markEnd-p(this,C).markStart)}};C=new WeakMap,r(Pe,"CommandKitEnvironment");var ce=Pe;function Ke(){throw F(y.ExitMiddleware)}r(Ke,"exitMiddleware");function rn(o){if(q(o))throw o}r(rn,"rethrow");function De(){throw F(y.ForwardedCommand)}r(De,"redirect");var v={ChatInputCommand:"chatInput",MessageContextMenu:"messageContextMenu",UserContextMenu:"userContextMenu",Autocomplete:"autocomplete",Message:"message"},_,Q=class Q{constructor(e,t){this.commandkit=e;this.config=t;R(this,"interaction");R(this,"message");R(this,"guild");R(this,"guildId");R(this,"channel");R(this,"channelId");R(this,"client");R(this,"command");g(this,_);R(this,"_locale",null);this.interaction=t.interaction,this.message=t.message,this.client=e.client,w(this,_,t.store??new Map),this.command=t.command,t.interaction&&(this.guild=t.interaction.guild,this.guildId=t.interaction.guildId,this.channel=t.interaction.channel,this.channelId=t.interaction.channelId),t.message&&(this.guild=t.message.guild,this.guildId=t.message.guildId,this.channel=t.message.channel,this.channelId=t.message.channelId),this.config.environment&&this.config.environment.setContext(this)}get store(){return p(this,_)}get commandName(){return this.isInteraction()?this.interaction.commandName:this.config.messageCommandParser.getCommand()}get options(){return this.isMessage()?this.config.messageCommandParser.options:this.interaction.options}get forwarded(){return this.config.forwarded??!1}async forwardCommand(e){let t=await this.commandkit.commandHandler.prepareCommandRun(this.isInteraction()?this.interaction:this.message,e);if(!t)throw new Error(`Command ${e} not found`);let n=this.config.environment??P();if(!n)throw new Error("No commandkit environment found.");let i={chatInput:t.command.data.chatInput,autocomplete:t.command.data.autocomplete,message:t.command.data.message,messageContextMenu:t.command.data.messageContextMenu,userContextMenu:t.command.data.userContextMenu},a=n.variables.get("execHandlerKind");if(!a)throw new Error("No execution handler kind found.");let s=i[a];if(!s)throw new Error(`No handler found for ${a}`);n.variables.set("forwardedBy",this.commandName),n.variables.set("forwardedTo",e),await s(this.clone({forwarded:!0})),De()}get executionMode(){return this.config.executionMode}isInteraction(){return this.executionMode===v.ChatInputCommand||this.executionMode===v.Autocomplete||this.executionMode===v.MessageContextMenu||this.executionMode===v.UserContextMenu}isChatInputCommand(){return this.executionMode===v.ChatInputCommand}isAutocomplete(){return this.executionMode===v.Autocomplete}isMessageContextMenu(){return this.executionMode===v.MessageContextMenu}isUserContextMenu(){return this.executionMode===v.UserContextMenu}isMessage(){return this.executionMode===v.Message}getCommandIdentifier(){return this.isInteraction()?this.interaction.commandName:this.message.content.split(" ")[0].slice(1)}getGuildLocale(){var e;return this.isInteraction()?this.interaction.guildLocale:((e=this.message.guild)==null?void 0:e.preferredLocale)??null}getUserLocale(){return this.isInteraction()?this.interaction.locale:null}getLocale(e=!1){if(this._locale)return this._locale;let t=e?this.getUserLocale():this.getGuildLocale();return t||this.commandkit.config.defaultLocale}setLocale(e){this._locale=e}clone(e){return e?new Q(this.commandkit,{...this.config,...e,store:p(this,_)}):new Q(this.commandkit,this.config)}isMiddleware(){return this instanceof W}args(){return this.isMessage()?this.config.messageCommandParser.getArgs():[]}exit(){Ke()}};_=new WeakMap,r(Q,"Context");var me=Q,Z,Te=class Te extends me{constructor(){super(...arguments);g(this,Z,!1)}get cancelled(){return p(this,Z)}cancel(){w(this,Z,!0)}setCommandRunner(t){var n,i;(i=(n=this.config.customArgs)==null?void 0:n.setCommandRunner)==null||i.call(n,t)}};Z=new WeakMap,r(Te,"MiddlewareContext");var W=Te;var pe,rt,Ae=class Ae{constructor(e){this.handler=e;g(this,pe)}async runCommand(e,t){let{commandkit:n}=this.handler,i=this.getExecutionMode(t),a=null,s=new ce(n);s.setType("COMMAND_HANDLER"),s.variables.set("commandHandlerType","app"),s.variables.set("currentCommandName",e.command.command.name),s.variables.set("execHandlerKind",i);let u=new W(n,{command:e.command,environment:s,executionMode:i,interaction:t instanceof ue.Message?null:t,message:t instanceof ue.Message?t:null,forwarded:!1,customArgs:{setCommandRunner:r(d=>{a=d},"setCommandRunner")},messageCommandParser:e.messageCommandParser}),c=!1;if(e.middlewares.length&&await ae(s,async()=>{for(let d of e.middlewares)if(d.data.beforeExecute)try{await d.data.beforeExecute(u)}catch(m){if(A(m,y.ExitMiddleware)){c=!0;return}if(A(m,[y.ForwardedCommand,y.InvalidCommandPrefix]))continue;throw m}}),!u.cancelled){let m=e.command.data[i];if(m||b.warn(`Command ${e.command.command.name} has no handler for ${i}`),m)try{let f=et(s,async()=>(s.registerDeferredFunction(K=>{K.markEnd();let S=K.getExecutionError(),I=K.getMarker(),L=`${K.getExecutionTime().toFixed(2)}ms`;if(S){b.error(`[${I} - ${L}] Error executing command: ${S.stack||S}`);return}b.info(`[${I} - ${L}] Command executed successfully`)}),m(u.clone())),D(this,pe,rt).bind(this)),x=a!=null?a(f):f;s.markStart(e.command.data.command.name),await n.plugins.execute(async(K,S)=>S.executeCommand(K,s,t,e,x))||await x()}catch(f){A(f,y.ExitMiddleware)&&(c=!0),A(f,[y.ForwardedCommand,y.ExitMiddleware])||b.error(f)}}!c&&e.middlewares.length&&await ae(s,async()=>{for(let d of e.middlewares)if(d.data.afterExecute)try{await d.data.afterExecute(u)}catch(m){if(A(m,y.ExitMiddleware))return;throw m}})}getExecutionMode(e){return e instanceof ue.Message?v.Message:e.isChatInputCommand()?v.ChatInputCommand:e.isAutocomplete()?v.Autocomplete:e.isMessageContextMenuCommand()?v.MessageContextMenu:e.isUserContextMenuCommand()?v.UserContextMenu:null}};pe=new WeakSet,rt=r(async function(){let e=tt();await e.runDeferredFunctions(),e.clearAllDeferredFunctions(),await this.handler.commandkit.plugins.execute(async(t,n)=>{await n.onAfterCommand(t,e)})},"#finalizer"),r(Ae,"AppCommandRunner");var de=Ae;var on={command:r(o=>o instanceof E.SlashCommandBuilder||o instanceof E.ContextMenuCommandBuilder||o&&typeof o=="object","command"),chatInput:r(o=>typeof o=="function","chatInput"),autocomplete:r(o=>typeof o=="function","autocomplete"),message:r(o=>typeof o=="function","message"),messageContextMenu:r(o=>typeof o=="function","messageContextMenu"),userContextMenu:r(o=>typeof o=="function","userContextMenu")},an={beforeExecute:r(o=>typeof o=="function","beforeExecute"),afterExecute:r(o=>typeof o=="function","afterExecute")},ke=class ke{constructor(e){this.commandkit=e;this.registrar=new X(this.commandkit)}loadedCommands=new E.Collection;loadedMiddlewares=new E.Collection;commandNameToId=new Map;subcommandPathToId=new Map;registrar;onInteraction=null;onMessageCreate=null;commandRunner=new de(this);externalCommandData=new E.Collection;externalMiddlewareData=new E.Collection;printBanner(){let e=crypto.randomUUID(),t=this.getCommandsArray().reduce((c,d)=>{let m=d.command.category||e;return c[m]=c[m]||[],c[m].push(d),c},{});console.log(h.green(`Loaded ${h.magenta(this.loadedCommands.size.toString())} commands:`));let n=Object.keys(t).sort(),i={};n.forEach(c=>{if(c!==e&&c.includes(":")){let d=c.split(":"),m=null;for(let f=d.length-1;f>0;f--){let x=d.slice(0,f).join(":");if(n.includes(x)){m=x;break}}m&&(i[m]=i[m]||[],i[m].push(c))}});let a=new Set,s=r((c,d="",m=!1,f="")=>{if(a.has(c))return;a.add(c);let x=t[c],O=i[c]&&i[c].length>0,K=m?"\u2514\u2500":"\u251C\u2500",S=f+(m?" ":"\u2502 ");if(c!==e){let I=c.includes(":")?c.split(":").pop():c;console.log(h.cyan(`${d}${K} ${h.bold(I)}`))}if(x.forEach((I,L)=>{let fe=L===x.length-1&&!O?"\u2514\u2500":"\u251C\u2500",at=c!==e?S:d,st=I.data.command.name,lt=I.command.middlewares.length>0?h.magenta(" (\u03BB)"):"";console.log(`${h.green(`${at}${fe}`)} ${h.yellow(st)}${lt}`)}),O){let I=i[c].sort();I.forEach((L,Oe)=>{let fe=Oe===I.length-1;s(L,S,fe,S)})}},"printCategory"),u=n.filter(c=>{if(c===e)return!0;if(c.includes(":")){let d=c.split(":");for(let m=1;m<d.length;m++){let f=d.slice(0,m).join(":");if(n.includes(f))return!1}return!0}return!0}).sort();u.forEach((c,d)=>{let m=d===u.length-1;s(c,"",m)})}getCommandsArray(){return Array.from(this.loadedCommands.values())}registerCommandHandler(){this.onInteraction??=async e=>{if(await this.commandkit.plugins.execute(async(a,s)=>s.onBeforeInteraction(a,e))||!(e.isCommand()||e.isAutocomplete()||e.isUserContextMenuCommand()||e.isMessageContextMenuCommand()))return;let i=await this.prepareCommandRun(e);if(i)return this.commandRunner.runCommand(i,e)},this.onMessageCreate??=async e=>{if(await this.commandkit.plugins.execute(async(i,a)=>a.onBeforeMessageCommand(i,e))||e.author.bot)return;let n=await this.prepareCommandRun(e);if(n)return this.commandRunner.runCommand(n,e)},this.commandkit.client.on(E.Events.InteractionCreate,this.onInteraction),this.commandkit.client.on(E.Events.MessageCreate,this.onMessageCreate)}async prepareCommandRun(e,t){var u;let n;if(!t)if(e instanceof E.Message){if(e.author.bot)return null;let c=await this.commandkit.config.getMessageCommandPrefix(e);n=new z(e,Array.isArray(c)?c:[c],d=>{var O,K;let m=this.commandNameToId.get(d);if(!m)return null;let f=this.loadedCommands.get(m);return!f||e.guildId&&((O=f.guilds)!=null&&O.length)&&!f.guilds.includes(e.guildId)?null:((K=("toJSON"in f.data.command?f.data.command.toJSON():f.data.command).options)==null?void 0:K.reduce((S,I)=>(S[I.name]=I.type,S),{}))??{}});try{t=n.getFullCommand().split(" ")[0]}catch(d){return A(d,y.InvalidCommandPrefix)||b.error(d),null}}else{if(!(e.isChatInputCommand()||e.isAutocomplete()||e.isContextMenuCommand()))return null;t=e.commandName}let i=this.commandNameToId.get(t);if(!i)return null;let a=this.loadedCommands.get(i);if(!a||(e instanceof E.CommandInteraction||e instanceof E.AutocompleteInteraction)&&e.guildId&&((u=a.guilds)!=null&&u.length)&&!a.guilds.includes(e.guildId))return null;let s=[];for(let c of a.command.middlewares){let d=this.loadedMiddlewares.get(c);d&&s.push(d)}return{command:a,middlewares:s,messageCommandParser:n}}async reloadCommands(){this.loadedCommands.clear(),this.loadedMiddlewares.clear(),this.commandNameToId.clear(),this.subcommandPathToId.clear(),this.externalCommandData.clear(),this.externalMiddlewareData.clear(),await this.loadCommands()}async addExternalMiddleware(e){for(let t of e)t.id&&this.externalMiddlewareData.set(t.id,t)}async addExternalCommands(e){for(let t of e)t.id&&this.externalCommandData.set(t.id,t)}async registerExternalLoadedMiddleware(e){for(let t of e)this.loadedMiddlewares.set(t.middleware.id,t)}async registerExternalLoadedCommands(e){for(let t of e)this.loadedCommands.set(t.command.id,t),this.commandNameToId.set(t.command.name,t.command.id)}async loadCommands(){await this.commandkit.plugins.execute((s,u)=>u.onBeforeCommandsLoad(s));let e=this.commandkit.commandsRouter;if(!e)throw new Error("Commands router has not yet initialized");let{commands:t,middlewares:n}=e.getData(),i=this.externalCommandData.size?t.concat(this.externalCommandData):t,a=this.externalMiddlewareData.size?n.concat(this.externalMiddlewareData):n;for(let[s,u]of a)await this.loadMiddleware(s,u);for(let[s,u]of i)await this.loadCommand(s,u);G&&await Xe(`type CommandTypeData = ${Array.from(this.loadedCommands.mapValues(s=>JSON.stringify(s.command.name)).values()).join(" | ")}`),await this.commandkit.plugins.execute((s,u)=>u.onAfterCommandsLoad(s))}async loadMiddleware(e,t){try{let n=await import(`${ee(t.path)}?t=${Date.now()}`),i=0;for(let[a,s]of Object.entries(an)){if(n[a]&&!await s(n[a]))throw new Error(`Invalid export for middleware ${e}: ${a} does not match expected value`);n[a]&&i++}if(i===0)throw new Error(`Invalid export for middleware ${e}: at least one handler function must be provided`);this.loadedMiddlewares.set(e,{middleware:t,data:n})}catch(n){b.error(`Failed to load middleware ${e}`,n)}}async loadCommand(e,t){try{if(t.path===null){this.loadedCommands.set(e,{command:t,data:{command:{name:t.name,description:`${t.name} commands`,type:1}}});return}let n=await import(`${ee(t.path)}?t=${Date.now()}`);if(!n.command)throw new Error(`Invalid export for command ${t.name}: no command definition found`);let i=0;for(let[s,u]of Object.entries(on))if(s!=="command"&&n[s]&&i++,n[s]&&!await u(n[s]))throw new Error(`Invalid export for command ${t.name}: ${s} does not match expected value`);if(i===0)throw new Error(`Invalid export for command ${t.name}: at least one handler function must be provided`);let a=n.command;await this.commandkit.plugins.execute(async(s,u)=>{let c=await u.prepareCommand(s,a);c&&(a=c)}),this.loadedCommands.set(e,{command:t,guilds:n.guilds,data:{...n,command:"toJSON"in a?a.toJSON():a}}),this.commandNameToId.set(t.name,e)}catch(n){b.error(`Failed to load command ${t.name} (${e})`,n)}}};r(ke,"AppCommandHandler");var ie=ke;var ot=require("discord.js");function Be(o){return o instanceof ot.Message}r(Be,"isMessageSource");function it(o){return!Be(o)}r(it,"isInteractionSource");0&&(module.exports={AppCommandHandler,CommandExecutionMode,CommandRegistrar,Context,MessageCommandOptions,MessageCommandParser,MiddlewareContext,exitMiddleware,isInteractionSource,isMessageSource,redirect,rethrow});
|
|
8
|
-
|
|
1
|
+
require('../colors-Cd4Oz-r-.js');
|
|
2
|
+
require('../ActionRow-CmTHbo2t.js');
|
|
3
|
+
require('../error-codes-C_UO39jz.js');
|
|
4
|
+
const require_CommandKit = require('../CommandKit-DDrQtQns.js');
|
|
5
|
+
require('../common-CcfjYnPG.js');
|
|
6
|
+
require('../common-CeO-vn8Y.js');
|
|
7
|
+
require('../container-CpuiLsZM.js');
|
|
8
|
+
require('../file-DE69SSOP.js');
|
|
9
|
+
require('../media-gallery-nUEHqKVF.js');
|
|
10
|
+
require('../section-D6t7tyEZ.js');
|
|
11
|
+
require('../separator-DYAFK-Jj.js');
|
|
12
|
+
require('../text-display-Dy6JHB5X.js');
|
|
13
|
+
require('../v2-DofkPKHs.js');
|
|
14
|
+
require('../warn-unstable-V20WCBDd.js');
|
|
15
|
+
require('../element-hdSqnIpC.js');
|
|
16
|
+
require('../types-B5VPP9ig.js');
|
|
17
|
+
require('../EventInterceptor-DtRINyTP.js');
|
|
18
|
+
require('../constants-DOPSzXI0.js');
|
|
19
|
+
require('../PluginCommon-DPqnQngK.js');
|
|
20
|
+
require('../CompilerPlugin-XzuGixkC.js');
|
|
21
|
+
require('../RuntimePlugin-CKsd83M3.js');
|
|
22
|
+
require('../types-Bq0EWaM3.js');
|
|
23
|
+
require('../CompilerPluginRuntime-zFCCw1kM.js');
|
|
24
|
+
require('../types-Cdh4uaFR.js');
|
|
25
|
+
require('../runtime-ByJtSXs_.js');
|
|
26
|
+
require('../EventWorkerContext-XZGSHn5F.js');
|
|
27
|
+
require('../resolve-file-url-pO9_rLft.js');
|
|
28
|
+
const require_MessageCommandParser = require('../MessageCommandParser-B13Pkwo9.js');
|
|
29
|
+
const require_signals = require('../signals-Bp0bzjE6.js');
|
|
30
|
+
require('../types-package-DRhFn59I.js');
|
|
31
|
+
require('../CommandsRouter-BHaPno8o.js');
|
|
32
|
+
require('../EventsRouter-CqnrlbjN.js');
|
|
33
|
+
require('../router-Dn35v30f.js');
|
|
34
|
+
require('../common-DirpDCa6.js');
|
|
35
|
+
require('../CommandKitEventsChannel-B6LKgxmv.js');
|
|
36
|
+
require('../store-Ci6ib2C9.js');
|
|
37
|
+
const require_helpers = require('../helpers-CswC9gKF.js');
|
|
38
|
+
require('../app-CXCbKsPz.js');
|
|
39
|
+
|
|
40
|
+
exports.AppCommandHandler = require_CommandKit.AppCommandHandler;
|
|
41
|
+
exports.CommandExecutionMode = require_CommandKit.CommandExecutionMode;
|
|
42
|
+
exports.CommandRegistrar = require_CommandKit.CommandRegistrar;
|
|
43
|
+
exports.Context = require_CommandKit.Context;
|
|
44
|
+
exports.MessageCommandOptions = require_MessageCommandParser.MessageCommandOptions;
|
|
45
|
+
exports.MessageCommandParser = require_MessageCommandParser.MessageCommandParser;
|
|
46
|
+
exports.MiddlewareContext = require_CommandKit.MiddlewareContext;
|
|
47
|
+
exports.exitMiddleware = require_signals.exitMiddleware;
|
|
48
|
+
exports.isInteractionSource = require_helpers.isInteractionSource;
|
|
49
|
+
exports.isMessageSource = require_helpers.isMessageSource;
|
|
50
|
+
exports.redirect = require_signals.redirect;
|
|
51
|
+
exports.rethrow = require_signals.rethrow;
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* If this is called inside pre-stage middleware, the next run will be the actual command, skipping all other pre-stage middlewares.
|
|
4
|
-
* If this is called inside a command itself, it will skip all post-stage middlewares.
|
|
5
|
-
* If this is called inside post-stage middleware, it will skip all other post-stage middlewares.
|
|
6
|
-
*/
|
|
7
|
-
declare function exitMiddleware(): never;
|
|
8
|
-
/**
|
|
9
|
-
* Rethrow the error if it is a CommandKit error.
|
|
10
|
-
* @param error The error to rethrow.
|
|
11
|
-
*/
|
|
12
|
-
declare function rethrow(error: unknown): void;
|
|
13
|
-
/**
|
|
14
|
-
* Stops current command assuming it has been redirected to another command.
|
|
15
|
-
*/
|
|
16
|
-
declare function redirect(): never;
|
|
17
|
-
|
|
18
|
-
export { exitMiddleware, redirect, rethrow };
|
|
1
|
+
import { exitMiddleware, redirect, rethrow } from "../../signals-DUoWkeZ7.js";
|
|
2
|
+
export { exitMiddleware, redirect, rethrow };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
require('../../error-codes-C_UO39jz.js');
|
|
2
|
+
const require_signals = require('../../signals-Bp0bzjE6.js');
|
|
3
|
+
|
|
4
|
+
exports.exitMiddleware = require_signals.exitMiddleware;
|
|
5
|
+
exports.redirect = require_signals.redirect;
|
|
6
|
+
exports.rethrow = require_signals.rethrow;
|
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
1
|
+
import { CommandRegistrar, PreRegisterCommandsEvent } from "../../CommandKit-CDlCsGCx.js";
|
|
2
|
+
import "../../EventInterceptor-D_oEWSnF.js";
|
|
3
|
+
import "../../ButtonKit-BSI7lCI0.js";
|
|
4
|
+
import "../../ModalKit-CKtQ8eXW.js";
|
|
5
|
+
import "../../element-D_nyVwgB.js";
|
|
6
|
+
import "../../ActionRow-D0wafJhZ.js";
|
|
7
|
+
import "../../types-CJ-XvOFN.js";
|
|
8
|
+
import "../../Button-Bl5nbwTS.js";
|
|
9
|
+
import "../../Modal-Cxm6cs5c.js";
|
|
10
|
+
import "../../common-pvPJVTfe.js";
|
|
11
|
+
import "../../StringSelectMenuKit-B9FHTe48.js";
|
|
12
|
+
import "../../ChannelSelectMenuKit-L15A2jpT.js";
|
|
13
|
+
import "../../MentionableSelectMenuKit-BiUSKUtZ.js";
|
|
14
|
+
import "../../UserSelectMenuKit-DiP0imyo.js";
|
|
15
|
+
import "../../RoleSelectMenuKit-BSMKkru2.js";
|
|
16
|
+
import "../../SelectMenu-b7jgrkjO.js";
|
|
17
|
+
import "../../container-CwEATQy2.js";
|
|
18
|
+
import "../../file-BdyYwkaI.js";
|
|
19
|
+
import "../../media-gallery-DCu02VXc.js";
|
|
20
|
+
import "../../section-fktaECHL.js";
|
|
21
|
+
import "../../separator-CuesaLrC.js";
|
|
22
|
+
import "../../text-display-DNMwmGHJ.js";
|
|
23
|
+
import "../../index-Dw5cCt-A.js";
|
|
24
|
+
import "../../index-E7Wvm5uX.js";
|
|
25
|
+
import "../../MessageCommandParser-tzroBwij.js";
|
|
26
|
+
import "../../signals-DUoWkeZ7.js";
|
|
27
|
+
import "../../helpers-DAmE106r.js";
|
|
28
|
+
import "../../CommandsRouter-C7X-eXE2.js";
|
|
29
|
+
import "../../EventsRouter-BacqK6z3.js";
|
|
30
|
+
import "../../index-CUPkUUOR.js";
|
|
31
|
+
import "../../constants-Ce6w4OFe.js";
|
|
32
|
+
import "../../types-BDwNROY2.js";
|
|
33
|
+
export { CommandRegistrar, PreRegisterCommandsEvent };
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
require('../../colors-Cd4Oz-r-.js');
|
|
2
|
+
require('../../ActionRow-CmTHbo2t.js');
|
|
3
|
+
require('../../error-codes-C_UO39jz.js');
|
|
4
|
+
const require_CommandKit = require('../../CommandKit-DDrQtQns.js');
|
|
5
|
+
require('../../common-CcfjYnPG.js');
|
|
6
|
+
require('../../common-CeO-vn8Y.js');
|
|
7
|
+
require('../../container-CpuiLsZM.js');
|
|
8
|
+
require('../../file-DE69SSOP.js');
|
|
9
|
+
require('../../media-gallery-nUEHqKVF.js');
|
|
10
|
+
require('../../section-D6t7tyEZ.js');
|
|
11
|
+
require('../../separator-DYAFK-Jj.js');
|
|
12
|
+
require('../../text-display-Dy6JHB5X.js');
|
|
13
|
+
require('../../v2-DofkPKHs.js');
|
|
14
|
+
require('../../warn-unstable-V20WCBDd.js');
|
|
15
|
+
require('../../element-hdSqnIpC.js');
|
|
16
|
+
require('../../types-B5VPP9ig.js');
|
|
17
|
+
require('../../EventInterceptor-DtRINyTP.js');
|
|
18
|
+
require('../../constants-DOPSzXI0.js');
|
|
19
|
+
require('../../PluginCommon-DPqnQngK.js');
|
|
20
|
+
require('../../CompilerPlugin-XzuGixkC.js');
|
|
21
|
+
require('../../RuntimePlugin-CKsd83M3.js');
|
|
22
|
+
require('../../types-Bq0EWaM3.js');
|
|
23
|
+
require('../../CompilerPluginRuntime-zFCCw1kM.js');
|
|
24
|
+
require('../../types-Cdh4uaFR.js');
|
|
25
|
+
require('../../runtime-ByJtSXs_.js');
|
|
26
|
+
require('../../EventWorkerContext-XZGSHn5F.js');
|
|
27
|
+
require('../../resolve-file-url-pO9_rLft.js');
|
|
28
|
+
require('../../MessageCommandParser-B13Pkwo9.js');
|
|
29
|
+
require('../../signals-Bp0bzjE6.js');
|
|
30
|
+
require('../../types-package-DRhFn59I.js');
|
|
31
|
+
require('../../CommandsRouter-BHaPno8o.js');
|
|
32
|
+
require('../../EventsRouter-CqnrlbjN.js');
|
|
33
|
+
require('../../router-Dn35v30f.js');
|
|
34
|
+
require('../../common-DirpDCa6.js');
|
|
35
|
+
require('../../CommandKitEventsChannel-B6LKgxmv.js');
|
|
36
|
+
require('../../store-Ci6ib2C9.js');
|
|
37
|
+
|
|
38
|
+
exports.CommandRegistrar = require_CommandKit.CommandRegistrar;
|