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,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const require_CommandKitEventsChannel = require('../CommandKitEventsChannel-B6LKgxmv.js');
|
|
2
|
+
|
|
3
|
+
exports.CommandKitEventsChannel = require_CommandKitEventsChannel.CommandKitEventsChannel;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const require_CommandKit = require('./CommandKit-DDrQtQns.js');
|
|
2
|
+
const require_EventWorkerContext = require('./EventWorkerContext-XZGSHn5F.js');
|
|
3
|
+
|
|
4
|
+
//#region src/flags/feature-flags.ts
|
|
5
|
+
var FeatureFlag = class {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.options = options;
|
|
8
|
+
const FlagStore = require_CommandKit.getCommandKit(true).flags;
|
|
9
|
+
if (FlagStore.has(options.key)) throw new Error(`Feature flag with key "${options.key}" already exists.`);
|
|
10
|
+
FlagStore.set(options.key, this);
|
|
11
|
+
}
|
|
12
|
+
getContext() {
|
|
13
|
+
const env = require_CommandKit.getContext();
|
|
14
|
+
if (env === null || env === void 0 ? void 0 : env.context) {
|
|
15
|
+
const { client, commandkit, interaction, message, guild, channel, command } = env.context;
|
|
16
|
+
return {
|
|
17
|
+
client,
|
|
18
|
+
commandkit,
|
|
19
|
+
command: {
|
|
20
|
+
interaction,
|
|
21
|
+
message,
|
|
22
|
+
guild,
|
|
23
|
+
channel,
|
|
24
|
+
command
|
|
25
|
+
},
|
|
26
|
+
event: null
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const eventCtx = require_EventWorkerContext.eventWorkerContext.getStore();
|
|
30
|
+
if (eventCtx) {
|
|
31
|
+
const { commandkit, data, event, namespace } = eventCtx;
|
|
32
|
+
return {
|
|
33
|
+
client: commandkit.client,
|
|
34
|
+
commandkit,
|
|
35
|
+
event: {
|
|
36
|
+
data,
|
|
37
|
+
event,
|
|
38
|
+
namespace,
|
|
39
|
+
arguments: eventCtx.arguments,
|
|
40
|
+
argumentsAs: (eventName) => {
|
|
41
|
+
const args = eventCtx.arguments;
|
|
42
|
+
return args;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
command: null
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
throw new Error("Could not determine the execution context. Feature flags may only be used inside a command or event.");
|
|
49
|
+
}
|
|
50
|
+
async execute(res) {
|
|
51
|
+
const { decide, identify } = this.options;
|
|
52
|
+
const entities = res ?? await (async () => {
|
|
53
|
+
const ctx = this.getContext();
|
|
54
|
+
return await (identify === null || identify === void 0 ? void 0 : identify(ctx)) ?? {};
|
|
55
|
+
})();
|
|
56
|
+
const decisionResult = await decide({ entities });
|
|
57
|
+
return decisionResult;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
function flag(options) {
|
|
61
|
+
const flag$1 = new FeatureFlag(options);
|
|
62
|
+
const runner = flag$1.execute.bind(flag$1, void 0);
|
|
63
|
+
runner.run = async function(ctx) {
|
|
64
|
+
if (!(ctx === null || ctx === void 0 ? void 0 : ctx.identify)) throw new Error("Custom evaluation context must have an identify function or object.");
|
|
65
|
+
const context = typeof ctx === "function" ? await ctx() : ctx;
|
|
66
|
+
const decisionResult = await flag$1.execute(context);
|
|
67
|
+
return decisionResult;
|
|
68
|
+
};
|
|
69
|
+
return runner;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
Object.defineProperty(exports, 'FeatureFlag', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return FeatureFlag;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, 'flag', {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return flag;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=feature-flags-BJp6kYmi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-flags-BJp6kYmi.js","names":[],"sources":["../src/flags/feature-flags.ts"],"sourcesContent":["import { getCommandKit, getContext } from '../context/async-context';\nimport { eventWorkerContext } from '../app/events/EventWorkerContext';\nimport { ParsedEvent } from '../app/router';\nimport { CommandKit } from '../CommandKit';\nimport {\n AutocompleteInteraction,\n ChatInputCommandInteraction,\n Client,\n ClientEvents,\n ContextMenuCommandInteraction,\n Guild,\n Message,\n TextBasedChannel,\n} from 'discord.js';\nimport { LoadedCommand } from '../app';\n\nexport type MaybePromise<T> = T | Promise<T>;\n\nexport type IdentifyFunction<R> = (\n context: EvaluationContext,\n) => MaybePromise<R>;\n\nexport type DecideFunction<E, R> = (data: { entities: E }) => MaybePromise<R>;\n\nexport interface FeatureFlagDefinition<R, Entity> {\n key: string;\n description?: string;\n identify?: IdentifyFunction<Entity>;\n decide: DecideFunction<Entity, R>;\n}\n\nexport interface CommandFlagContext {\n client: Client<true>;\n commandkit: CommandKit;\n command: {\n interaction?:\n | ChatInputCommandInteraction\n | AutocompleteInteraction\n | ContextMenuCommandInteraction;\n message?: Message;\n guild: Guild | null;\n channel: TextBasedChannel | null;\n command: LoadedCommand;\n };\n event: null;\n}\n\nexport interface EventFlagContext {\n client: Client<true>;\n commandkit: CommandKit;\n event: {\n data: ParsedEvent;\n event: string;\n namespace: string | null;\n arguments: any[];\n argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E];\n };\n command: null;\n}\n\nexport type EvaluationContext = CommandFlagContext | EventFlagContext;\n\nexport type CustomEvaluationFunction<E> = () => MaybePromise<E>;\n\nexport type CustomEvaluationContext<E> = {\n identify: E | CustomEvaluationFunction<E>;\n};\n\nexport interface FlagRunner<E, R> {\n (): Promise<R>;\n run(context: CustomEvaluationContext<E>): Promise<R>;\n}\n\nexport class FeatureFlag<R, T> {\n public constructor(public readonly options: FeatureFlagDefinition<R, T>) {\n const FlagStore = getCommandKit(true).flags;\n\n if (FlagStore.has(options.key)) {\n throw new Error(`Feature flag with key \"${options.key}\" already exists.`);\n }\n\n FlagStore.set(options.key, this);\n }\n\n private getContext(): EvaluationContext {\n const env = getContext();\n\n if (env?.context) {\n const {\n client,\n commandkit,\n interaction,\n message,\n guild,\n channel,\n command,\n } = env.context;\n\n return {\n client: client as Client<true>,\n commandkit,\n command: {\n interaction,\n message,\n guild,\n channel,\n command,\n },\n event: null,\n };\n }\n\n const eventCtx = eventWorkerContext.getStore();\n\n if (eventCtx) {\n const { commandkit, data, event, namespace } = eventCtx;\n\n return {\n client: commandkit.client as Client<true>,\n commandkit,\n event: {\n data,\n event,\n namespace,\n arguments: eventCtx.arguments,\n argumentsAs: (eventName) => {\n const args = eventCtx.arguments as ClientEvents[typeof eventName];\n return args;\n },\n },\n command: null,\n };\n }\n\n throw new Error(\n 'Could not determine the execution context. Feature flags may only be used inside a command or event.',\n );\n }\n\n public async execute(res?: T): Promise<R> {\n const { decide, identify } = this.options;\n\n const entities =\n res ??\n (await (async () => {\n const ctx = this.getContext();\n return (await identify?.(ctx)) ?? ({} as T);\n })());\n\n const decisionResult = await decide({\n entities,\n });\n\n return decisionResult as R;\n }\n}\n\nexport function flag<Returns = boolean, Entity = Record<any, any>>(\n options: FeatureFlagDefinition<Returns, Entity>,\n): FlagRunner<Entity, Returns> {\n const flag = new FeatureFlag<Returns, Entity>(options);\n const runner = flag.execute.bind(flag, undefined) as FlagRunner<\n Entity,\n Returns\n >;\n\n runner.run = async function (ctx) {\n if (!ctx?.identify) {\n throw new Error(\n 'Custom evaluation context must have an identify function or object.',\n );\n }\n\n const context = (\n typeof ctx === 'function'\n ? await (ctx as CustomEvaluationFunction<Entity>)()\n : ctx\n ) as Entity;\n\n const decisionResult = await flag.execute(context);\n\n return decisionResult;\n };\n\n return runner;\n}\n"],"mappings":";;;;AAyEA,IAAa,cAAb,MAA+B;CAC7B,AAAO,YAA4B,SAAsC;EAAtC;EACjC,MAAM,YAAY,iCAAc,KAAK,CAAC;AAEtC,MAAI,UAAU,IAAI,QAAQ,IAAI,CAC5B,OAAM,IAAI,OAAO,yBAAyB,QAAQ,IAAI;AAGxD,YAAU,IAAI,QAAQ,KAAK,KAAK;CAClC;CAEA,AAAQ,aAAgC;EACtC,MAAM,MAAM,+BAAY;AAExB,gDAAI,IAAK,SAAS;GAChB,MAAM,EACJ,QACA,YACA,aACA,SACA,OACA,SACA,SACD,GAAG,IAAI;AAER,UAAO;IACG;IACR;IACA,SAAS;KACP;KACA;KACA;KACA;KACA;IACD;IACD,OAAO;GACR;EACH;EAEA,MAAM,WAAW,8CAAmB,UAAU;AAE9C,MAAI,UAAU;GACZ,MAAM,EAAE,YAAY,MAAM,OAAO,WAAW,GAAG;AAE/C,UAAO;IACL,QAAQ,WAAW;IACnB;IACA,OAAO;KACL;KACA;KACA;KACA,WAAW,SAAS;KACpB,aAAa,CAAC,cAAc;MAC1B,MAAM,OAAO,SAAS;AACtB,aAAO;KACR;IACF;IACD,SAAS;GACV;EACH;AAEA,QAAM,IAAI,MACR;CAEJ;CAEA,MAAa,QAAQ,KAAqB;EACxC,MAAM,EAAE,QAAQ,UAAU,GAAG,KAAK;EAElC,MAAM,WACN,OACA,MAAM,CAAC,YAAY;GACjB,MAAM,MAAM,KAAK,YAAY;AAC7B,UAAQ,2DAAM,SAAW,IAAI,KAAK,CAAE;EACrC,IAAG;EAEJ,MAAM,iBAAiB,MAAM,OAAO,EAClC,SACD,EAAC;AAEF,SAAO;CACT;AACF;AAEA,SAAgB,KAChB,SAC8B;CAC5B,MAAM,SAAO,IAAI,YAA6B;CAC9C,MAAM,SAAS,OAAK,QAAQ,KAAK,eAAgB;AAKjD,QAAO,MAAM,eAAgB,KAAK;AAChC,kDAAK,IAAK,UACR,OAAM,IAAI,MACR;EAIJ,MAAM,iBACC,QAAQ,aACf,MAAM,AAAC,KAA0C,GACjD;EAGA,MAAM,iBAAiB,MAAM,OAAK,QAAQ,QAAQ;AAElD,SAAO;CACR;AAED,QAAO;AACT"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FileBuilder, FileComponentData } from "discord.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/v2/file.d.ts
|
|
4
|
+
interface FileProps extends Omit<FileComponentData, 'type' | 'file'> {
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
declare function File(props: FileProps): FileBuilder;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { File, FileProps };
|
|
10
|
+
//# sourceMappingURL=file-BdyYwkaI.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
const discord_js = require_chunk.__toESM(require("discord.js"));
|
|
3
|
+
|
|
4
|
+
//#region src/components/v2/file.ts
|
|
5
|
+
function File(props) {
|
|
6
|
+
const file = new discord_js.FileBuilder(props);
|
|
7
|
+
if (props.url != null) file.setURL(props.url);
|
|
8
|
+
return file;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
Object.defineProperty(exports, 'File', {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return File;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=file-DE69SSOP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-DE69SSOP.js","names":[],"sources":["../src/components/v2/file.ts"],"sourcesContent":["import { FileBuilder, FileComponentData } from 'discord.js';\n\nexport interface FileProps extends Omit<FileComponentData, 'type' | 'file'> {\n url: string;\n}\n\nexport function File(props: FileProps) {\n const file = new FileBuilder(props);\n\n if (props.url != null) {\n file.setURL(props.url);\n }\n\n return file;\n}\n"],"mappings":";;;;AAMA,SAAgB,KAAK,OAAkB;CACrC,MAAM,OAAO,IAAI,uBAAY;AAE7B,KAAI,MAAM,OAAO,KACf,MAAK,OAAO,MAAM,IAAI;AAGxB,QAAO;AACT"}
|
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
1
|
+
import { CommandFlagContext, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, EvaluationContext, EventFlagContext, FeatureFlag, FeatureFlagDefinition, FlagRunner, IdentifyFunction, MaybePromise, flag } 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 { CommandFlagContext, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, EvaluationContext, EventFlagContext, FeatureFlag, FeatureFlagDefinition, FlagRunner, IdentifyFunction, MaybePromise, flag };
|
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
${r} ${h.dim(fe.corner)}`,...t.map(a=>s(a))):this.logger.log(`${n} ${h.dim(fe.corner)}`,...t.map(a=>s(a)))}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)}};i(ze,"DefaultLogger");var he=ze;function qn(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(r){e=r}};for(let r of t)n[r]=(...s)=>{e.provider[r](...s)};return n}i(qn,"createLogger");var C=qn({provider:new he});var Je=class Je{constructor(e){this.commandkit=e}plugins=new Gt.Collection;getPlugins(){return this.plugins}getPlugin(e){return this.plugins.get(e)??null}async softRegisterPlugin(e){let t=e.name;if(!this.plugins.has(t))try{await e.activate(this),this.plugins.set(t,e)}catch(n){throw new Error(`Failed to activate plugin "${t}": ${(n==null?void 0:n.stack)||n}`)}}async registerPlugin(e){let t=e.name;if(this.plugins.has(t))throw new Error(`Plugin with name "${t}" already exists.`);try{await e.activate(this),this.plugins.set(t,e)}catch(n){throw new Error(`Failed to activate plugin "${t}": ${(n==null?void 0:n.stack)||n}`)}}async unregisterPlugin(e){let t=e.name;if(!this.plugins.has(t))throw new Error(`Plugin with name "${t}" does not exist.`);this.plugins.delete(t);try{await e.deactivate(this)}catch(n){throw new Error(`Failed to deactivate plugin "${t}": ${(n==null?void 0:n.stack)||n}`)}}async unregisterAllPlugins(){for(let e of this.plugins.values())await this.unregisterPlugin(e)}capture(){throw _(v.PluginCaptureHandle)}async execute(e){let t;for(let n of this.plugins.values())try{t=await e(this,n)}catch(r){if(F(r,v.PluginCaptureHandle))return!0;C.error(`Plugin "${n.name}" failed`,(r==null?void 0:r.stack)||r)}return t}};i(Je,"CommandKitPluginRuntime");var Ce=Je;var zn=require("fs/promises");var Ye=class Ye extends Y{name="MacroPlugin";macroTransformer;async activate(){let e=await import("use-macro");this.macroTransformer=new e.MacroTransformer}async deactivate(){this.macroTransformer=null}async transform(e){if(!this.options.enabled)return null;let{contents:t,loader:n}=await this.macroTransformer.transform(e.contents.toString(),e.path);return{contents:t,loader:n}}};i(Ye,"MacroPlugin");var ge=Ye;var jt={plugins:[new ge({enabled:!0})],esbuildPlugins:[],compilerOptions:{macro:{development:!1}},static:!0,typescript:{ignoreBuildErrors:!1},distDir:"dist",env:{},sourceMap:{development:!0,production:!0},typedCommands:!0};var Jn=jt;function xe(){return Jn}i(xe,"getConfig");var Wt=require("async_hooks");var Yn=Symbol("commandkitEventWorker"),ye=new Wt.AsyncLocalStorage;function Xe(o,e){return Reflect.set(o,Yn,!0),ye.run(o,e)}i(Xe,"runInEventWorkerContext");var Qe=null;function _t(){if(Qe)return Qe;let o=(0,et.join)(process.cwd(),O?".commandkit":xe().distDir);(0,Ze.existsSync)(o)||(o=process.cwd());let e=["app"].map(t=>(0,et.join)(o,t));for(let t of e)if((0,Ze.existsSync)(t))return Qe=t,t;return null}i(_t,"findAppDirectory");var tt=class tt extends Error{constructor(){super("Event propagation stopped"),this.name="StopEventPropagationError"}};i(tt,"StopEventPropagationError");var re=tt;var wt=require("path");var M=require("discord.js");var Vt=j(require("path"));function oe(o,e=!1){return`${"file://"+Vt.default.resolve(o).replace(/\\\\|\\/g,"/")}${e?`?ts=${Date.now()}`:""}`}i(oe,"toFileURL");var K=require("discord.js");var V,X,ie,rt=class rt{constructor(e,t,n){this.message=e;this.prefix=t;this.schema=n;E(this,V,null);E(this,X,null);E(this,ie,[])}getArgs(){return this.parse(),p(this,ie)}get options(){return p(this,X)||P(this,X,new nt(this)),p(this,X)}getOption(e){var t;return(t=this.parse().options.find(n=>n.name===e))==null?void 0:t.value}getCommand(){return this.parse().command}getSubcommand(){return this.parse().subcommand}getSubcommandGroup(){return this.parse().subcommandGroup}getPrefix(){for(let e of this.prefix)if(this.message.content.startsWith(e))return e}getFullCommand(){return[this.getCommand(),this.getSubcommandGroup(),this.getSubcommand()].filter(e=>e).join(" ")}parse(){if(p(this,V))return p(this,V);let e=this.message.content,t=this.getPrefix();if(!t)throw _(v.InvalidCommandPrefix);let n=e.slice(t.length).trim().split(" "),r=n.shift();P(this,ie,n);let s,a;if(r!=null&&r.includes(":")){let[,c,d]=r.split(":");!d&&c?a=c:d&&c&&(s=c,a=d)}let m=this.schema([r,s,a].filter(Boolean).join(" ").trim()),l=n.map(c=>{try{let[d,f]=c.split(":");if(!(d in m))return null;switch(m[d]){case K.ApplicationCommandOptionType.Boolean:return{name:d,value:f==="true"};case K.ApplicationCommandOptionType.Integer:return{name:d,value:parseInt(f,10)};case K.ApplicationCommandOptionType.Number:return{name:d,value:parseFloat(f)};case K.ApplicationCommandOptionType.String:return{name:d,value:f};case K.ApplicationCommandOptionType.User:return{name:d,value:this.message.mentions.users.find(g=>g.id===f.replace(/[<@!>]/g,""))};case K.ApplicationCommandOptionType.Channel:return{name:d,value:this.message.mentions.channels.find(g=>g.id===f.replace(/[<#>]/g,""))};case K.ApplicationCommandOptionType.Role:return{name:d,value:this.message.mentions.roles.find(g=>g.id===f.replace(/[<@&>]/g,""))};case K.ApplicationCommandOptionType.Attachment:return{name:d,value:this.message.attachments.find(g=>g.name===f)};default:return null}}catch{return null}}).filter(c=>c!==null);return P(this,V,{command:r,options:l,subcommand:a,subcommandGroup:s}),p(this,V)}};V=new WeakMap,X=new WeakMap,ie=new WeakMap,i(rt,"MessageCommandParser");var Ee=rt,ot=class ot{constructor(e){this.parser=e}assertOption(e,t=!1){let n=this.parser.getOption(e);if(t&&n===void 0)throw new Error(`Option "${e}" is required.`);return n??null}getMember(e,t=!1){var s;let n=this.assertOption(e,t),r=(s=this.parser.message.guild)==null?void 0:s.members.cache.get(n==null?void 0:n.id);if(t&&!r)throw new Error(`Member "${e}" is required.`);return r??null}getAttachment(e,t=!1){return this.assertOption(e,t)}getBoolean(e,t=!1){return this.assertOption(e,t)}getNumber(e,t=!1){return this.assertOption(e,t)}getString(e,t=!1){return this.assertOption(e,t)}getInteger(e,t=!1){return this.assertOption(e,t)}getUser(e,t=!1){return this.assertOption(e,t)}getChannel(e,t=!1){return this.assertOption(e,t)}getRole(e,t=!1){return this.assertOption(e,t)}getMentionable(e,t=!1){let n=this.assertOption(e,t);if(n instanceof K.GuildMember||n instanceof K.User||n instanceof K.Role)return n;if(t)throw new Error(`Mentionable "${e}" is required.`);return null}getSubcommand(e=!1){let t=this.parser.getSubcommand();if(e&&t===void 0)throw new Error("Subcommand is required.");return t??null}getSubcommandGroup(e=!1){let t=this.parser.getSubcommandGroup();if(e&&t===void 0)throw new Error("Subcommand group is required.");return t??null}};i(ot,"MessageCommandOptions");var nt=ot;var $=require("discord.js");var it=class it{constructor(e){this.commandkit=e;this.api.setToken(this.commandkit.client.token??process.env.DISCORD_TOKEN??process.env.TOKEN??"")}api=new $.REST;getCommandsData(){return this.commandkit.commandHandler.getCommandsArray().flatMap(n=>{let r="toJSON"in n.data.command?n.data.command.toJSON():n.data.command,s=[r];return n.data.userContextMenu&&r.type!==$.ApplicationCommandType.User&&s.push({...r,type:$.ApplicationCommandType.User,options:void 0,description_localizations:void 0,description:void 0}),n.data.messageContextMenu&&r.type!==$.ApplicationCommandType.Message&&s.push({...r,type:$.ApplicationCommandType.Message,description_localizations:void 0,description:void 0,options:void 0}),s})}async register(){let e=this.getCommandsData(),t=!1,n={preventDefault(){t=!0},commands:e};if(await this.commandkit.plugins.execute(async(a,m)=>{if(!t)return m.onBeforeRegisterCommands(a,n)}),t)return;if(!this.commandkit.client.isReady())throw new Error("Cannot register commands before the client is ready");let r=e.filter(a=>{var m;return(m=a.guilds)==null?void 0:m.filter(Boolean).length}).map(a=>{var m;return{...a,guilds:Array.from(new Set((m=a.guilds)==null?void 0:m.filter(Boolean)))}}),s=e.filter(a=>{var m;return!((m=a.guilds)!=null&&m.filter(Boolean).length)});await this.updateGlobalCommands(s),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,s)=>{if(!t)return s.onBeforeRegisterGlobalCommands(r,n)});try{let r=await this.api.put($.Routes.applicationCommands(this.commandkit.client.user.id),{body:e.map(s=>({...s,guilds:void 0}))});C.info(`\u2728 Refreshed ${r.length} global application (/) commands`)}catch(r){C.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,s)=>{if(!t)return s.onBeforePrepareGuildCommandsRegistration(r,n)}),!t)try{let r=new Map;if(e.forEach(a=>{var m;(m=a.guilds)!=null&&m.length&&a.guilds.forEach(l=>{r.has(l)||r.set(l,[]),r.get(l).push(a)})}),!r.size)return;let s=0;for(let[a,m]of r){let l=!1,c={preventDefault(){l=!0},commands:m};if(await this.commandkit.plugins.execute(async(f,g)=>{if(!l)return g.onBeforeRegisterGuildCommands(f,c)}),l)continue;let d=await this.api.put($.Routes.applicationGuildCommands(this.commandkit.client.user.id,a),{body:m.map(f=>({...f,guilds:void 0}))});s+=d.length}C.info(`\u2728 Refreshed ${s} guild application (/) commands`)}catch(r){C.error("Failed to update guild application (/) commands",r)}}};i(it,"CommandRegistrar");var be=it;var we=require("discord.js");var qt=require("crypto");var b,at=class at{constructor(e){this.commandkit=e;E(this,b,{executionError:null,type:null,variables:new Map,deferredFunctions:new Map,marker:"",markStart:0,markEnd:0,context:null})}setContext(e){p(this,b).context=e}get context(){return p(this,b).context}getExecutionError(){return p(this,b).executionError}setExecutionError(e){if(p(this,b).executionError)throw new Error("Execution error already set.");p(this,b).executionError=e}getType(){let e=p(this,b).type;if(!e)throw new Error("Environment type not set.");return e}setType(e){p(this,b).type=e}get variables(){return p(this,b).variables}registerDeferredFunction(e){let t=(0,qt.randomUUID)();return p(this,b).deferredFunctions.set(t,e),t}clearDeferredFunction(e){p(this,b).deferredFunctions.delete(e)}async runDeferredFunctions(){for(let[e,t]of p(this,b).deferredFunctions)try{await t(this)}catch(n){this.commandkit.emit("unhandledDeferredFunctionRejection",n)}finally{this.clearDeferredFunction(e)}}clearAllDeferredFunctions(){p(this,b).deferredFunctions.clear()}markStart(e){p(this,b).marker=e,p(this,b).markStart=performance.now()}markEnd(){p(this,b).markEnd||(p(this,b).markEnd=performance.now())}getMarker(){return p(this,b).marker}getExecutionTime(){return Math.abs(p(this,b).markEnd-p(this,b).markStart)}};b=new WeakMap,i(at,"CommandKitEnvironment");var ve=at;function zt(){throw _(v.ExitMiddleware)}i(zt,"exitMiddleware");function Jt(){throw _(v.ForwardedCommand)}i(Jt,"redirect");var D={ChatInputCommand:"chatInput",MessageContextMenu:"messageContextMenu",UserContextMenu:"userContextMenu",Autocomplete:"autocomplete",Message:"message"},Q,ae=class ae{constructor(e,t){this.commandkit=e;this.config=t;x(this,"interaction");x(this,"message");x(this,"guild");x(this,"guildId");x(this,"channel");x(this,"channelId");x(this,"client");x(this,"command");E(this,Q);x(this,"_locale",null);this.interaction=t.interaction,this.message=t.message,this.client=e.client,P(this,Q,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,Q)}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??T();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},s=n.variables.get("execHandlerKind");if(!s)throw new Error("No execution handler kind found.");let a=r[s];if(!a)throw new Error(`No handler found for ${s}`);n.variables.set("forwardedBy",this.commandName),n.variables.set("forwardedTo",e),await a(this.clone({forwarded:!0})),Jt()}get executionMode(){return this.config.executionMode}isInteraction(){return this.executionMode===D.ChatInputCommand||this.executionMode===D.Autocomplete||this.executionMode===D.MessageContextMenu||this.executionMode===D.UserContextMenu}isChatInputCommand(){return this.executionMode===D.ChatInputCommand}isAutocomplete(){return this.executionMode===D.Autocomplete}isMessageContextMenu(){return this.executionMode===D.MessageContextMenu}isUserContextMenu(){return this.executionMode===D.UserContextMenu}isMessage(){return this.executionMode===D.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 ae(this.commandkit,{...this.config,...e,store:p(this,Q)}):new ae(this.commandkit,this.config)}isMiddleware(){return this instanceof se}args(){return this.isMessage()?this.config.messageCommandParser.getArgs():[]}exit(){zt()}};Q=new WeakMap,i(ae,"Context");var st=ae,le,lt=class lt extends st{constructor(){super(...arguments);E(this,le,!1)}get cancelled(){return p(this,le)}cancel(){P(this,le,!0)}setCommandRunner(t){var n,r;(r=(n=this.config.customArgs)==null?void 0:n.setCommandRunner)==null||r.call(n,t)}};le=new WeakMap,i(lt,"MiddlewareContext");var se=lt;var Ie,Yt,ct=class ct{constructor(e){this.handler=e;E(this,Ie)}async runCommand(e,t){let{commandkit:n}=this.handler,r=this.getExecutionMode(t),s=null,a=new ve(n);a.setType("COMMAND_HANDLER"),a.variables.set("commandHandlerType","app"),a.variables.set("currentCommandName",e.command.command.name),a.variables.set("execHandlerKind",r);let m=new se(n,{command:e.command,environment:a,executionMode:r,interaction:t instanceof we.Message?null:t,message:t instanceof we.Message?t:null,forwarded:!1,customArgs:{setCommandRunner:i(c=>{s=c},"setCommandRunner")},messageCommandParser:e.messageCommandParser}),l=!1;if(e.middlewares.length&&await Se(a,async()=>{for(let c of e.middlewares)if(c.data.beforeExecute)try{await c.data.beforeExecute(m)}catch(d){if(F(d,v.ExitMiddleware)){l=!0;return}if(F(d,[v.ForwardedCommand,v.InvalidCommandPrefix]))continue;throw d}}),!m.cancelled){let d=e.command.data[r];if(d||C.warn(`Command ${e.command.command.name} has no handler for ${r}`),d)try{let f=Xt(a,async()=>(a.registerDeferredFunction(I=>{I.markEnd();let w=I.getExecutionError(),y=I.getMarker(),R=`${I.getExecutionTime().toFixed(2)}ms`;if(w){C.error(`[${y} - ${R}] Error executing command: ${w.stack||w}`);return}C.info(`[${y} - ${R}] Command executed successfully`)}),d(m.clone())),S(this,Ie,Yt).bind(this)),g=s!=null?s(f):f;a.markStart(e.command.data.command.name),await n.plugins.execute(async(I,w)=>w.executeCommand(I,a,t,e,g))||await g()}catch(f){F(f,v.ExitMiddleware)&&(l=!0),F(f,[v.ForwardedCommand,v.ExitMiddleware])||C.error(f)}}!l&&e.middlewares.length&&await Se(a,async()=>{for(let c of e.middlewares)if(c.data.afterExecute)try{await c.data.afterExecute(m)}catch(d){if(F(d,v.ExitMiddleware))return;throw d}})}getExecutionMode(e){return e instanceof we.Message?D.Message:e.isChatInputCommand()?D.ChatInputCommand:e.isAutocomplete()?D.Autocomplete:e.isMessageContextMenuCommand()?D.MessageContextMenu:e.isUserContextMenuCommand()?D.UserContextMenu:null}};Ie=new WeakSet,Yt=i(async function(){let e=Qt();await e.runDeferredFunctions(),e.clearAllDeferredFunctions(),await this.handler.commandkit.plugins.execute(async(t,n)=>{await n.onAfterCommand(t,e)})},"#finalizer"),i(ct,"AppCommandRunner");var Me=ct;var G=require("fs/promises"),H=require("path");var Zt=require("fs");async function Re(o=!1){let e=(0,H.join)(process.cwd(),"node_modules","commandkit-types");if(!O&&!o)return e;let t=(0,H.join)(e,"package.json"),n=(0,H.join)(e,"index.js"),r=(0,H.join)(e,"index.d.ts"),s=(0,H.join)(e,"command.d.ts"),a={name:"commandkit-types",version:"1.0.0",description:"CommandKit types package",type:"commonjs",main:"index.js",types:"index.d.ts"},m="module.exports = {};",l=`// Main types index file - imports all type declarations
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`,t=(0,H.join)(process.cwd(),"node_modules","commandkit-types");if(!(0,Zt.existsSync)(t))return;let n=(0,H.join)(t,"command.d.ts");await(0,G.writeFile)(n,e,{encoding:"utf-8"})}i(en,"rewriteCommandDeclaration");var Xn={command:i(o=>o instanceof M.SlashCommandBuilder||o instanceof M.ContextMenuCommandBuilder||o&&typeof o=="object","command"),chatInput:i(o=>typeof o=="function","chatInput"),autocomplete:i(o=>typeof o=="function","autocomplete"),message:i(o=>typeof o=="function","message"),messageContextMenu:i(o=>typeof o=="function","messageContextMenu"),userContextMenu:i(o=>typeof o=="function","userContextMenu")},Qn={beforeExecute:i(o=>typeof o=="function","beforeExecute"),afterExecute:i(o=>typeof o=="function","afterExecute")},mt=class mt{constructor(e){this.commandkit=e;this.registrar=new be(this.commandkit)}loadedCommands=new M.Collection;loadedMiddlewares=new M.Collection;commandNameToId=new Map;subcommandPathToId=new Map;registrar;onInteraction=null;onMessageCreate=null;commandRunner=new Me(this);externalCommandData=new M.Collection;externalMiddlewareData=new M.Collection;printBanner(){let e=crypto.randomUUID(),t=this.getCommandsArray().reduce((l,c)=>{let d=c.command.category||e;return l[d]=l[d]||[],l[d].push(c),l},{});console.log(h.green(`Loaded ${h.magenta(this.loadedCommands.size.toString())} commands:`));let n=Object.keys(t).sort(),r={};n.forEach(l=>{if(l!==e&&l.includes(":")){let c=l.split(":"),d=null;for(let f=c.length-1;f>0;f--){let g=c.slice(0,f).join(":");if(n.includes(g)){d=g;break}}d&&(r[d]=r[d]||[],r[d].push(l))}});let s=new Set,a=i((l,c="",d=!1,f="")=>{if(s.has(l))return;s.add(l);let g=t[l],k=r[l]&&r[l].length>0,I=d?"\u2514\u2500":"\u251C\u2500",w=f+(d?" ":"\u2502 ");if(l!==e){let y=l.includes(":")?l.split(":").pop():l;console.log(h.cyan(`${c}${I} ${h.bold(y)}`))}if(g.forEach((y,R)=>{let Ne=R===g.length-1&&!k?"\u2514\u2500":"\u251C\u2500",In=l!==e?w:c,Sn=y.data.command.name,Rn=y.command.middlewares.length>0?h.magenta(" (\u03BB)"):"";console.log(`${h.green(`${In}${Ne}`)} ${h.yellow(Sn)}${Rn}`)}),k){let y=r[l].sort();y.forEach((R,ne)=>{let Ne=ne===y.length-1;a(R,w,Ne,w)})}},"printCategory"),m=n.filter(l=>{if(l===e)return!0;if(l.includes(":")){let c=l.split(":");for(let d=1;d<c.length;d++){let f=c.slice(0,d).join(":");if(n.includes(f))return!1}return!0}return!0}).sort();m.forEach((l,c)=>{let d=c===m.length-1;a(l,"",d)})}getCommandsArray(){return Array.from(this.loadedCommands.values())}registerCommandHandler(){this.onInteraction??=async e=>{if(await this.commandkit.plugins.execute(async(s,a)=>a.onBeforeInteraction(s,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,s)=>s.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(M.Events.InteractionCreate,this.onInteraction),this.commandkit.client.on(M.Events.MessageCreate,this.onMessageCreate)}async prepareCommandRun(e,t){var m;let n;if(!t)if(e instanceof M.Message){if(e.author.bot)return null;let l=await this.commandkit.config.getMessageCommandPrefix(e);n=new Ee(e,Array.isArray(l)?l:[l],c=>{var k,I;let d=this.commandNameToId.get(c);if(!d)return null;let f=this.loadedCommands.get(d);return!f||e.guildId&&((k=f.guilds)!=null&&k.length)&&!f.guilds.includes(e.guildId)?null:((I=("toJSON"in f.data.command?f.data.command.toJSON():f.data.command).options)==null?void 0:I.reduce((w,y)=>(w[y.name]=y.type,w),{}))??{}});try{t=n.getFullCommand().split(" ")[0]}catch(c){return F(c,v.InvalidCommandPrefix)||C.error(c),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 s=this.loadedCommands.get(r);if(!s||(e instanceof M.CommandInteraction||e instanceof M.AutocompleteInteraction)&&e.guildId&&((m=s.guilds)!=null&&m.length)&&!s.guilds.includes(e.guildId))return null;let a=[];for(let l of s.command.middlewares){let c=this.loadedMiddlewares.get(l);c&&a.push(c)}return{command:s,middlewares:a,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((a,m)=>m.onBeforeCommandsLoad(a));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,s=this.externalMiddlewareData.size?n.concat(this.externalMiddlewareData):n;for(let[a,m]of s)await this.loadMiddleware(a,m);for(let[a,m]of r)await this.loadCommand(a,m);O&&await en(`type CommandTypeData = ${Array.from(this.loadedCommands.mapValues(a=>JSON.stringify(a.command.name)).values()).join(" | ")}`),await this.commandkit.plugins.execute((a,m)=>m.onAfterCommandsLoad(a))}async loadMiddleware(e,t){try{let n=await import(`${oe(t.path)}?t=${Date.now()}`),r=0;for(let[s,a]of Object.entries(Qn)){if(n[s]&&!await a(n[s]))throw new Error(`Invalid export for middleware ${e}: ${s} does not match expected value`);n[s]&&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){C.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(`${oe(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[a,m]of Object.entries(Xn))if(a!=="command"&&n[a]&&r++,n[a]&&!await m(n[a]))throw new Error(`Invalid export for command ${t.name}: ${a} 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 s=n.command;await this.commandkit.plugins.execute(async(a,m)=>{let l=await m.prepareCommand(a,s);l&&(s=l)}),this.loadedCommands.set(e,{command:t,guilds:n.guilds,data:{...n,command:"toJSON"in s?s.toJSON():s}}),this.commandNameToId.set(t.name,e)}catch(n){C.error(`Failed to load command ${t.name} (${e})`,n)}}};i(mt,"AppCommandHandler");var Pe=mt;var ut=require("discord.js"),rn=require("fs"),dt=require("fs/promises"),A=require("path");var Zn=/^\+middleware\.(m|c)?(j|t)sx?$/,tn=/^\+([^+().][^().]*)\.middleware\.(m|c)?(j|t)sx?$/,nn=/^\+global-middleware\.(m|c)?(j|t)sx?$/,er=/^([^+().][^().]*)\.(m|c)?(j|t)sx?$/,tr=/^\(.+\)$/,pt=class pt{constructor(e){this.options=e}commands=new ut.Collection;middlewares=new ut.Collection;populate(e){for(let[t,n]of Object.entries(e.commands))this.commands.set(t,n);for(let[t,n]of Object.entries(e.middlewares))this.middlewares.set(t,n)}isValidPath(){return(0,rn.existsSync)(this.options.entrypoint)}isCommand(e){return er.test(e)}isMiddleware(e){return Zn.test(e)||nn.test(e)||tn.test(e)}isCategory(e){return tr.test(e)}clear(){this.commands.clear(),this.middlewares.clear()}async scan(){let e=await(0,dt.readdir)(this.options.entrypoint,{withFileTypes:!0});for(let t of e){if(t.name.startsWith("_"))continue;let n=(0,A.join)(this.options.entrypoint,t.name);if(t.isDirectory()){let r=this.isCategory(t.name)?t.name.slice(1,-1):null;await this.traverse(n,r)}else await this.handle(t)}return await this.applyMiddlewares(),this.toJSON()}getData(){return{commands:this.commands,middlewares:this.middlewares}}toJSON(){return{commands:Object.fromEntries(this.commands.entries()),middlewares:Object.fromEntries(this.middlewares.entries())}}async traverse(e,t){let n=await(0,dt.readdir)(e,{withFileTypes:!0});for(let r of n)if(!r.name.startsWith("_")){if(r.isFile())(this.isCommand(r.name)||this.isMiddleware(r.name))&&await this.handle(r,t);else if(r.isDirectory()&&this.isCategory(r.name)&&t){let s=this.isCategory(r.name)?`${t}:${r.name.slice(1,-1)}`:null;await this.traverse((0,A.join)(e,r.name),s)}}}async handle(e,t=null){let n=e.name,r=(0,A.join)(e.parentPath,e.name);if(this.isCommand(n)){let s={id:crypto.randomUUID(),name:(0,A.basename)(r,(0,A.extname)(r)),path:r,category:t,parentPath:e.parentPath,relativePath:this.replaceEntrypoint(r),middlewares:[]};this.commands.set(s.id,s)}else if(this.isMiddleware(n)){let s={id:crypto.randomUUID(),name:(0,A.basename)(r,(0,A.extname)(r)),path:r,relativePath:this.replaceEntrypoint(r),parentPath:e.parentPath,global:nn.test(n),command:tn.test(n)&&n.split(".")[0]||null};this.middlewares.set(s.id,s)}}applyMiddlewares(){this.commands.forEach(e=>{let t=e.parentPath,n=Array.from(this.middlewares.values()).filter(r=>r.global?!0:r.command?r.command===e.name:r.parentPath===t).map(r=>r.id);e.middlewares=Array.from(new Set([...e.middlewares,...n]))})}replaceEntrypoint(e){return(0,A.normalize)(e).replace(this.options.entrypoint,"")}};i(pt,"CommandsRouter");var Ke=pt;var on=require("discord.js"),an=require("fs"),ft=require("fs/promises"),De=require("path");var ht=class ht{constructor(e){this.options=e;var t;if(e.entrypoints&&(e.entrypoints=Array.from(new Set(e.entrypoints))),!((t=e.entrypoints)!=null&&t.length))throw new Error("Entrypoint directory must be provided")}events=new on.Collection;addEntrypoints(e){this.options.entrypoints=Array.from(new Set([...this.options.entrypoints,...e]))}match(e){return this.events.get(e)??null}get entrypoints(){return this.options.entrypoints}isValidPath(){return this.entrypoints.every(e=>(0,an.existsSync)(e))}clear(){this.events.clear()}async reload(){return this.clear(),this.scan()}async scan(){for(let e of this.entrypoints){let t=await(0,ft.readdir)(e,{withFileTypes:!0});for(let n of t)if(n.isDirectory()){let r=(0,De.join)(e,n.name);await this.scanEvent(n.name,r,null,[],!0)}}return Object.fromEntries(this.events)}toJSON(){return Object.fromEntries(this.events)}async scanEvent(e,t,n=null,r=[],s=!1){let a=await(0,ft.readdir)(t,{withFileTypes:!0}),m=s&&/^\(.+\)$/.test(e),l=m?e.slice(1,-1):n??null;a.sort((c,d)=>c.name.localeCompare(d.name));for(let c of a)if(!c.name.startsWith("_")){if(c.isDirectory()){let d=(0,De.join)(t,c.name);await this.scanEvent(c.name,d,l,r);continue}c.isFile()&&/\.(m|c)?(j|t)sx?$/.test(c.name)&&r.push((0,De.join)(c.parentPath,c.name))}if(!m){let c=this.events.get(e);if(c){c.listeners=Array.from(new Set([...c.listeners,...r]));return}this.events.set(e,{event:e,path:t,listeners:r,namespace:l})}}};i(ht,"EventsRouter");var Te=ht;var sn=require("discord.js");var Ct=class Ct{constructor(e){this.commandkit=e}loadedEvents=new sn.Collection;getEvents(){return this.loadedEvents.size===0?[]:this.loadedEvents.toJSON().map(t=>({name:t.name,namespace:t.namespace,onceListeners:t.listeners.filter(n=>n.once).length,regularListeners:t.listeners.filter(n=>!n.once).length,metadata:t.event}))}async reloadEvents(){this.unregisterAll(),await this.loadEvents()}async loadEvents(){await this.commandkit.plugins.execute((n,r)=>r.onBeforeEventsLoad(n));let t=await this.commandkit.eventsRouter.scan();for(let n of Object.values(t)){let r=[];for(let m of n.listeners){let l=await import(oe(m,!0));(!l.default||typeof l.default!="function")&&C.error(`Event handler for ${n.event}${n.namespace?` of namespace ${n.namespace}`:""} does not have a default export or is not a function`),r.push({handler:l.default,once:!!l.once})}let s=r.length;s||C.warn(`Event ${n.event}${n.namespace?` of namespace ${n.namespace}`:""} does not have any listeners`);let a=`${n.namespace?`${n.namespace}:`:""}${n.event}`;this.loadedEvents.set(a,{name:n.event,namespace:n.namespace,event:n,listeners:r}),C.info(`\u2728 Loaded event ${n.event}${n.namespace?` of namespace ${n.namespace}`:""} with ${s} listener${s===1?"":"s"}`)}this.registerAllClientEvents(),await this.commandkit.plugins.execute((n,r)=>r.onAfterEventsLoad(n))}unregisterAll(){this.unregisterAllClientListeners(),this.loadedEvents.clear()}registerAllClientEvents(){let e=this.commandkit.client;for(let[t,n]of this.loadedEvents.entries()){let{name:r,listeners:s,namespace:a}=n,m=s.filter(g=>g.once),l=s.filter(g=>!g.once),c=new Set,d=i(async(...g)=>{let k=!1,I={name:r,args:g,namespace:a??null,once:!1,metadata:n.event,accept(){k||(k=!0)}};await this.commandkit.plugins.execute(async(w,y)=>{var R;if(!k)return(R=y.willEmitEvent)==null?void 0:R.call(y,w,I)}).catch(Object),await Xe({event:r,namespace:a??null,data:n.event,commandkit:this.commandkit,arguments:g},async()=>{for(let w of l)try{await w.handler(...g)}catch(y){if(y instanceof re){C.debug(`Event propagation stopped for ${r}${a?` of namespace ${a}`:""}`);break}C.error(`Error handling event ${r}${a?` of namespace ${a}`:""}`,y)}})},"mainHandler"),f=i(async(...g)=>{let k=!1,I=!1,w={name:r,args:g,namespace:a??null,once:!0,metadata:n.event,accept(){I||(I=!0)}};await this.commandkit.plugins.execute(async(y,R)=>{var ne;if(!I)return(ne=R.willEmitEvent)==null?void 0:ne.call(R,y,w)}).catch(Object);for(let y of m){if(k)break;await Xe({event:r,namespace:a??null,data:n.event,commandkit:this.commandkit,arguments:g},async()=>{try{if(c.has(y.handler))return;await y.handler(...g),c.add(y.handler)}catch(R){R instanceof re&&(C.debug(`Event propagation stopped for ${r}${a?` of namespace ${a}`:""}`),k=!0),C.error(`Error handling event ${r}${a?` of namespace ${a}`:""}`,R)}})}c.size===m.length&&l.length===0&&(this.loadedEvents.delete(t),C.info(`\u{1F9F9} Cleaned up completed once-only event ${r}${a?` of namespace ${a}`:""}`))},"onceHandler");this.loadedEvents.set(t,{...n,mainListener:l.length>0?{handler:d,once:!1}:void 0,executedOnceListeners:c}),a?(l.length>0&&this.commandkit.events.on(a,r,d),m.length>0&&this.commandkit.events.once(a,r,f)):(l.length>0&&e.on(r,d),m.length>0&&e.once(r,f)),C.info(`\u{1F50C} Registered event ${r}${a?` of namespace ${a}`:""} (${l.length} regular, ${m.length} once-only)`)}}unregisterAllClientListeners(){let e=this.commandkit.client;for(let[t,{name:n,mainListener:r,namespace:s}]of this.loadedEvents.entries())r?s?this.commandkit.events.off(s,n,r.handler):e.off(n,r.handler):s?this.commandkit.events.removeAllListeners(s,n):e.removeAllListeners(n),this.loadedEvents.delete(t),C.info(`\u{1F5D1}\uFE0F Unregistered event ${n}${s?` of namespace ${s}`:""}`)}};i(Ct,"AppEventsHandler");var ke=Ct;var un=require("fs"),dn=require("path");var nr=require("rimraf"),gt=require("path"),ee=j(require("fs"));var cn=require("child_process");var L;function rr(o){process.stdout.write(o),process.stdout.write(`
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
require('../colors-Cd4Oz-r-.js');
|
|
2
|
+
require('../ActionRow-CmTHbo2t.js');
|
|
3
|
+
require('../error-codes-C_UO39jz.js');
|
|
4
|
+
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
|
+
const require_feature_flags = require('../feature-flags-BJp6kYmi.js');
|
|
38
|
+
|
|
39
|
+
exports.FeatureFlag = require_feature_flags.FeatureFlag;
|
|
40
|
+
exports.flag = require_feature_flags.flag;
|
package/dist/flags/store.d.ts
CHANGED
|
@@ -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 { FlagStore } 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 { FlagStore };
|
package/dist/flags/store.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const require_store = require('../store-Ci6ib2C9.js');
|
|
2
|
+
|
|
3
|
+
exports.FlagStore = require_store.FlagStore;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
const discord_js = require_chunk.__toESM(require("discord.js"));
|
|
3
|
+
|
|
4
|
+
//#region src/app/commands/helpers.ts
|
|
5
|
+
function isMessageSource(source) {
|
|
6
|
+
return source instanceof discord_js.Message;
|
|
7
|
+
}
|
|
8
|
+
function isInteractionSource(source) {
|
|
9
|
+
return !isMessageSource(source);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
Object.defineProperty(exports, 'isInteractionSource', {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return isInteractionSource;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, 'isMessageSource', {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return isMessageSource;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=helpers-CswC9gKF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers-CswC9gKF.js","names":[],"sources":["../src/app/commands/helpers.ts"],"sourcesContent":["import { Interaction, Message } from 'discord.js';\n\nexport type CommandSource = Interaction | Message;\n\nexport function isMessageSource(source: CommandSource): source is Message {\n return source instanceof Message;\n}\n\nexport function isInteractionSource(\n source: CommandSource,\n): source is Interaction {\n return !isMessageSource(source);\n}\n"],"mappings":";;;;AAIA,SAAgB,gBAAgB,QAA0C;AACxE,QAAO,kBAAkB;AAC3B;AAEA,SAAgB,oBAChB,QACwB;AACtB,SAAQ,gBAAgB,OAAO;AACjC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Interaction, Message } from "discord.js";
|
|
2
|
+
|
|
3
|
+
//#region src/app/commands/helpers.d.ts
|
|
4
|
+
type CommandSource = Interaction | Message;
|
|
5
|
+
declare function isMessageSource(source: CommandSource): source is Message;
|
|
6
|
+
declare function isInteractionSource(source: CommandSource): source is Interaction;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { CommandSource, isInteractionSource, isMessageSource };
|
|
9
|
+
//# sourceMappingURL=helpers-DAmE106r.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|