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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Awaitable, Client, ClientEvents } from "discord.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/common/EventInterceptor.d.ts
|
|
4
|
+
interface EventInterceptorContextData<E extends keyof ClientEvents> {
|
|
5
|
+
/**
|
|
6
|
+
* The filter to use for the collector.
|
|
7
|
+
*/
|
|
8
|
+
filter?: (...args: ClientEvents[E]) => Awaitable<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* The duration (in ms) that the collector should run for.
|
|
11
|
+
*/
|
|
12
|
+
time?: number;
|
|
13
|
+
/**
|
|
14
|
+
* If the collector should automatically reset the timer when a button is clicked.
|
|
15
|
+
*/
|
|
16
|
+
autoReset?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the collector should run only once.
|
|
19
|
+
*/
|
|
20
|
+
once?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The handler to run when the collector ends.
|
|
23
|
+
*/
|
|
24
|
+
onEnd?: (reason: string) => Awaitable<void>;
|
|
25
|
+
/**
|
|
26
|
+
* The handler to run upon an error.
|
|
27
|
+
*/
|
|
28
|
+
onError?: EventInterceptorErrorHandler;
|
|
29
|
+
}
|
|
30
|
+
type EventInterceptorErrorHandler = (error: Error) => Awaitable<void>;
|
|
31
|
+
declare class EventInterceptor {
|
|
32
|
+
#private;
|
|
33
|
+
readonly client: Client;
|
|
34
|
+
private subscribers;
|
|
35
|
+
private globalHandlers;
|
|
36
|
+
private cleanupTimer;
|
|
37
|
+
/**
|
|
38
|
+
* Creates the event interceptor.
|
|
39
|
+
*/
|
|
40
|
+
constructor(client: Client);
|
|
41
|
+
/**
|
|
42
|
+
* Destroys the event interceptor.
|
|
43
|
+
*/
|
|
44
|
+
destroy(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the event has subscribers.
|
|
47
|
+
* @param event The event to check.
|
|
48
|
+
*/
|
|
49
|
+
hasSubscribers(event: keyof ClientEvents): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the number of subscribers for the event.
|
|
52
|
+
* @param event The event to check.
|
|
53
|
+
*/
|
|
54
|
+
getSubscriberCount(event: keyof ClientEvents): number;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the event has global handlers.
|
|
57
|
+
*/
|
|
58
|
+
hasGlobalHandlers(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the number of global handlers.
|
|
61
|
+
*/
|
|
62
|
+
getGlobalHandlersCount(): number;
|
|
63
|
+
/**
|
|
64
|
+
* Subscribes to an event.
|
|
65
|
+
* @param event The event to subscribe to.
|
|
66
|
+
* @param listener The listener to call when the event is emitted.
|
|
67
|
+
* @returns A function to unsubscribe from the event.
|
|
68
|
+
*/
|
|
69
|
+
subscribe<Event extends keyof ClientEvents>(event: Event, listener: (...args: ClientEvents[Event]) => void, options?: EventInterceptorContextData<Event>): () => void;
|
|
70
|
+
/**
|
|
71
|
+
* Unsubscribes from an event.
|
|
72
|
+
* @param event The event to unsubscribe from.
|
|
73
|
+
*/
|
|
74
|
+
unsubscribe<Event extends keyof ClientEvents>(event: Event, listener: (...args: ClientEvents[Event]) => void, reason?: string): void;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a global handler for the event.
|
|
77
|
+
* @param event The event to create a global handler for.
|
|
78
|
+
* @returns The global handler.
|
|
79
|
+
*/
|
|
80
|
+
private createGlobalHandler;
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { EventInterceptor, EventInterceptorContextData, EventInterceptorErrorHandler };
|
|
84
|
+
//# sourceMappingURL=EventInterceptor-D_oEWSnF.d.ts.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/components/common/EventInterceptor.ts
|
|
3
|
+
var EventInterceptor = class {
|
|
4
|
+
subscribers = new Map();
|
|
5
|
+
globalHandlers = new Map();
|
|
6
|
+
cleanupTimer = null;
|
|
7
|
+
/**
|
|
8
|
+
* Creates the event interceptor.
|
|
9
|
+
*/
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
this.#cleanupLoop();
|
|
13
|
+
}
|
|
14
|
+
#cleanupLoop() {
|
|
15
|
+
if (this.cleanupTimer) clearInterval(this.cleanupTimer);
|
|
16
|
+
this.cleanupTimer = setInterval(() => {
|
|
17
|
+
for (const [event, handlers] of this.subscribers) for (const handler of handlers) {
|
|
18
|
+
const options = Reflect.get(handler, "options");
|
|
19
|
+
const isExpired = options.time && Date.now() - options.registeredAt > options.time;
|
|
20
|
+
if (isExpired) this.unsubscribe(event, handler, "time");
|
|
21
|
+
}
|
|
22
|
+
}, 6e4).unref();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Destroys the event interceptor.
|
|
26
|
+
*/
|
|
27
|
+
destroy() {
|
|
28
|
+
if (this.cleanupTimer) {
|
|
29
|
+
clearInterval(this.cleanupTimer);
|
|
30
|
+
this.cleanupTimer = null;
|
|
31
|
+
}
|
|
32
|
+
for (const [event, handlers] of this.subscribers) for (const handler of handlers) this.unsubscribe(event, handler, "destroy");
|
|
33
|
+
this.subscribers.clear();
|
|
34
|
+
this.globalHandlers.clear();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether the event has subscribers.
|
|
38
|
+
* @param event The event to check.
|
|
39
|
+
*/
|
|
40
|
+
hasSubscribers(event) {
|
|
41
|
+
return this.subscribers.has(event);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns the number of subscribers for the event.
|
|
45
|
+
* @param event The event to check.
|
|
46
|
+
*/
|
|
47
|
+
getSubscriberCount(event) {
|
|
48
|
+
const handlers = this.subscribers.get(event);
|
|
49
|
+
return (handlers === null || handlers === void 0 ? void 0 : handlers.size) ?? 0;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Whether the event has global handlers.
|
|
53
|
+
*/
|
|
54
|
+
hasGlobalHandlers() {
|
|
55
|
+
return this.globalHandlers.size > 0;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns the number of global handlers.
|
|
59
|
+
*/
|
|
60
|
+
getGlobalHandlersCount() {
|
|
61
|
+
return this.subscribers.size;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Subscribes to an event.
|
|
65
|
+
* @param event The event to subscribe to.
|
|
66
|
+
* @param listener The listener to call when the event is emitted.
|
|
67
|
+
* @returns A function to unsubscribe from the event.
|
|
68
|
+
*/
|
|
69
|
+
subscribe(event, listener, options) {
|
|
70
|
+
if (!this.subscribers.has(event)) {
|
|
71
|
+
this.subscribers.set(event, new Set());
|
|
72
|
+
this.client.on(event, this.createGlobalHandler(event));
|
|
73
|
+
this.client.setMaxListeners(this.client.getMaxListeners() + 1);
|
|
74
|
+
}
|
|
75
|
+
options ??= {};
|
|
76
|
+
options.registeredAt = Date.now();
|
|
77
|
+
Reflect.set(listener, "options", options);
|
|
78
|
+
this.subscribers.get(event).add(listener);
|
|
79
|
+
return () => {
|
|
80
|
+
this.unsubscribe(event, listener);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Unsubscribes from an event.
|
|
85
|
+
* @param event The event to unsubscribe from.
|
|
86
|
+
*/
|
|
87
|
+
unsubscribe(event, listener, reason) {
|
|
88
|
+
var _Reflect$get$onEnd, _Reflect$get;
|
|
89
|
+
const handlers = this.subscribers.get(event);
|
|
90
|
+
if (!handlers) return;
|
|
91
|
+
handlers.delete(listener);
|
|
92
|
+
if (handlers.size < 1) {
|
|
93
|
+
this.subscribers.delete(event);
|
|
94
|
+
this.client.removeListener(event, this.globalHandlers.get(event));
|
|
95
|
+
this.globalHandlers.delete(event);
|
|
96
|
+
this.client.setMaxListeners(Math.max(this.client.getMaxListeners() - 1, 0));
|
|
97
|
+
}
|
|
98
|
+
(_Reflect$get$onEnd = (_Reflect$get = Reflect.get(listener, "options")).onEnd) === null || _Reflect$get$onEnd === void 0 || _Reflect$get$onEnd.call(_Reflect$get, reason ?? "unsubscribe");
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Creates a global handler for the event.
|
|
102
|
+
* @param event The event to create a global handler for.
|
|
103
|
+
* @returns The global handler.
|
|
104
|
+
*/
|
|
105
|
+
createGlobalHandler(event) {
|
|
106
|
+
if (this.globalHandlers.has(event)) return this.globalHandlers.get(event);
|
|
107
|
+
const handler = async (...args) => {
|
|
108
|
+
const subscribers = this.subscribers.get(event);
|
|
109
|
+
if (subscribers && subscribers.size > 0) for (const subscriber of subscribers) {
|
|
110
|
+
const options = Reflect.get(subscriber, "options");
|
|
111
|
+
const isExpired = options.time && Date.now() - options.registeredAt > options.time;
|
|
112
|
+
if (isExpired) {
|
|
113
|
+
this.unsubscribe(event, subscriber, "time");
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (options.autoReset) options.registeredAt = Date.now();
|
|
117
|
+
if (options.filter && !await options.filter(...args)) continue;
|
|
118
|
+
try {
|
|
119
|
+
await subscriber(...args);
|
|
120
|
+
} catch (e) {
|
|
121
|
+
if (options.onError) await options.onError(e);
|
|
122
|
+
else throw e;
|
|
123
|
+
} finally {
|
|
124
|
+
if (options.once) this.unsubscribe(event, subscriber, "once");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
this.globalHandlers.set(event, handler);
|
|
129
|
+
return handler;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
Object.defineProperty(exports, 'EventInterceptor', {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function () {
|
|
137
|
+
return EventInterceptor;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
//# sourceMappingURL=EventInterceptor-DtRINyTP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventInterceptor-DtRINyTP.js","names":[],"sources":["../src/components/common/EventInterceptor.ts"],"sourcesContent":["import { Awaitable, Client, ClientEvents, Events } from 'discord.js';\n\nexport interface EventInterceptorContextData<E extends keyof ClientEvents> {\n /**\n * The filter to use for the collector.\n */\n filter?: (...args: ClientEvents[E]) => Awaitable<boolean>;\n /**\n * The duration (in ms) that the collector should run for.\n */\n time?: number;\n /**\n * If the collector should automatically reset the timer when a button is clicked.\n */\n autoReset?: boolean;\n /**\n * Whether the collector should run only once.\n */\n once?: boolean;\n /**\n * The handler to run when the collector ends.\n */\n onEnd?: (reason: string) => Awaitable<void>;\n /**\n * The handler to run upon an error.\n */\n onError?: EventInterceptorErrorHandler;\n}\n\nexport type EventInterceptorErrorHandler = (error: Error) => Awaitable<void>;\n\nexport class EventInterceptor {\n private subscribers = new Map<\n keyof ClientEvents,\n Set<(...args: any[]) => void>\n >();\n private globalHandlers = new Map<\n keyof ClientEvents,\n (...args: any[]) => void\n >();\n private cleanupTimer: NodeJS.Timeout | null = null;\n\n /**\n * Creates the event interceptor.\n */\n public constructor(public readonly client: Client) {\n this.#cleanupLoop();\n }\n\n #cleanupLoop() {\n if (this.cleanupTimer) clearInterval(this.cleanupTimer);\n\n this.cleanupTimer = setInterval(() => {\n for (const [event, handlers] of this.subscribers) {\n for (const handler of handlers) {\n const options = Reflect.get(\n handler,\n 'options',\n ) as EventInterceptorContextData<keyof ClientEvents> & {\n registeredAt: number;\n };\n\n const isExpired =\n options.time && Date.now() - options.registeredAt > options.time;\n\n if (isExpired) {\n this.unsubscribe(event, handler, 'time');\n }\n }\n }\n }, 60_000).unref();\n }\n\n /**\n * Destroys the event interceptor.\n */\n public destroy(): void {\n if (this.cleanupTimer) {\n clearInterval(this.cleanupTimer);\n this.cleanupTimer = null;\n }\n\n for (const [event, handlers] of this.subscribers) {\n for (const handler of handlers) {\n this.unsubscribe(event, handler, 'destroy');\n }\n }\n\n this.subscribers.clear();\n this.globalHandlers.clear();\n }\n\n /**\n * Whether the event has subscribers.\n * @param event The event to check.\n */\n public hasSubscribers(event: keyof ClientEvents): boolean {\n return this.subscribers.has(event);\n }\n\n /**\n * Returns the number of subscribers for the event.\n * @param event The event to check.\n */\n public getSubscriberCount(event: keyof ClientEvents): number {\n const handlers = this.subscribers.get(event);\n return handlers?.size ?? 0;\n }\n\n /**\n * Whether the event has global handlers.\n */\n public hasGlobalHandlers(): boolean {\n return this.globalHandlers.size > 0;\n }\n\n /**\n * Returns the number of global handlers.\n */\n public getGlobalHandlersCount(): number {\n return this.subscribers.size;\n }\n\n /**\n * Subscribes to an event.\n * @param event The event to subscribe to.\n * @param listener The listener to call when the event is emitted.\n * @returns A function to unsubscribe from the event.\n */\n public subscribe<Event extends keyof ClientEvents>(\n event: Event,\n listener: (...args: ClientEvents[Event]) => void,\n options?: EventInterceptorContextData<Event>,\n ): () => void {\n if (!this.subscribers.has(event)) {\n this.subscribers.set(event, new Set());\n this.client.on(event, this.createGlobalHandler(event));\n this.client.setMaxListeners(this.client.getMaxListeners() + 1);\n }\n\n options ??= {};\n\n // @ts-ignore\n options.registeredAt = Date.now();\n\n Reflect.set(listener, 'options', options);\n\n this.subscribers.get(event)!.add(listener);\n\n return () => {\n this.unsubscribe(event, listener);\n };\n }\n\n /**\n * Unsubscribes from an event.\n * @param event The event to unsubscribe from.\n */\n public unsubscribe<Event extends keyof ClientEvents>(\n event: Event,\n listener: (...args: ClientEvents[Event]) => void,\n reason?: string,\n ): void {\n const handlers = this.subscribers.get(event);\n if (!handlers) return;\n\n handlers.delete(listener);\n\n if (handlers.size < 1) {\n this.subscribers.delete(event);\n this.client.removeListener(event, this.globalHandlers.get(event)!);\n this.globalHandlers.delete(event);\n this.client.setMaxListeners(\n Math.max(this.client.getMaxListeners() - 1, 0),\n );\n }\n\n Reflect.get(listener, 'options').onEnd?.(reason ?? 'unsubscribe');\n }\n\n /**\n * Creates a global handler for the event.\n * @param event The event to create a global handler for.\n * @returns The global handler.\n */\n private createGlobalHandler<Event extends keyof ClientEvents>(\n event: Event,\n ): (...args: ClientEvents[Event]) => void {\n if (this.globalHandlers.has(event)) {\n return this.globalHandlers.get(event)!;\n }\n\n const handler = async (...args: ClientEvents[Event]) => {\n const subscribers = this.subscribers.get(event);\n if (subscribers && subscribers.size > 0) {\n for (const subscriber of subscribers) {\n const options = Reflect.get(\n subscriber,\n 'options',\n ) as EventInterceptorContextData<Event> & { registeredAt: number };\n\n const isExpired =\n options.time && Date.now() - options.registeredAt > options.time;\n\n if (isExpired) {\n this.unsubscribe(event, subscriber, 'time');\n continue;\n }\n\n if (options.autoReset) {\n options.registeredAt = Date.now();\n }\n\n if (options.filter && !(await options.filter(...args))) {\n continue;\n }\n\n try {\n await subscriber(...args);\n } catch (e) {\n if (options.onError) {\n await options.onError(<Error>e);\n } else {\n throw e;\n }\n } finally {\n if (options.once) {\n this.unsubscribe(event, subscriber, 'once');\n }\n }\n }\n }\n };\n\n this.globalHandlers.set(event, handler);\n\n return handler;\n }\n}\n"],"mappings":";;AA+BA,IAAa,mBAAb,MAA8B;CAC5B,AAAQ,cAAc,IAAI;CAI1B,AAAQ,iBAAiB,IAAI;CAI7B,AAAQ,eAAsC;;;;CAK9C,AAAO,YAA4B,QAAgB;EAAhB;AACjC,OAAK,cAAc;CACrB;CAEA,eAAe;AACb,MAAI,KAAK,aAAc,eAAc,KAAK,aAAa;AAEvD,OAAK,eAAe,YAAY,MAAM;AACpC,QAAK,MAAM,CAAC,OAAO,SAAS,IAAI,KAAK,YACnC,MAAK,MAAM,WAAW,UAAU;IAC9B,MAAM,UAAU,QAAQ,IACtB,SACA,UACD;IAID,MAAM,YACN,QAAQ,QAAQ,KAAK,KAAK,GAAG,QAAQ,eAAe,QAAQ;AAE5D,QAAI,UACF,MAAK,YAAY,OAAO,SAAS,OAAO;GAE5C;EAEH,GAAE,IAAO,CAAC,OAAO;CACpB;;;;CAKA,AAAO,UAAgB;AACrB,MAAI,KAAK,cAAc;AACrB,iBAAc,KAAK,aAAa;AAChC,QAAK,eAAe;EACtB;AAEA,OAAK,MAAM,CAAC,OAAO,SAAS,IAAI,KAAK,YACnC,MAAK,MAAM,WAAW,SACpB,MAAK,YAAY,OAAO,SAAS,UAAU;AAI/C,OAAK,YAAY,OAAO;AACxB,OAAK,eAAe,OAAO;CAC7B;;;;;CAMA,AAAO,eAAe,OAAoC;AACxD,SAAO,KAAK,YAAY,IAAI,MAAM;CACpC;;;;;CAMA,AAAO,mBAAmB,OAAmC;EAC3D,MAAM,WAAW,KAAK,YAAY,IAAI,MAAM;AAC5C,8DAAO,SAAU,SAAQ;CAC3B;;;;CAKA,AAAO,oBAA6B;AAClC,SAAO,KAAK,eAAe,OAAO;CACpC;;;;CAKA,AAAO,yBAAiC;AACtC,SAAO,KAAK,YAAY;CAC1B;;;;;;;CAQA,AAAO,UACP,OACA,UACA,SACa;AACX,OAAK,KAAK,YAAY,IAAI,MAAM,EAAE;AAChC,QAAK,YAAY,IAAI,OAAO,IAAI,MAAM;AACtC,QAAK,OAAO,GAAG,OAAO,KAAK,oBAAoB,MAAM,CAAC;AACtD,QAAK,OAAO,gBAAgB,KAAK,OAAO,iBAAiB,GAAG,EAAE;EAChE;AAEA,cAAY,CAAE;AAGd,UAAQ,eAAe,KAAK,KAAK;AAEjC,UAAQ,IAAI,UAAU,WAAW,QAAQ;AAEzC,OAAK,YAAY,IAAI,MAAM,CAAE,IAAI,SAAS;AAE1C,SAAO,MAAM;AACX,QAAK,YAAY,OAAO,SAAS;EAClC;CACH;;;;;CAMA,AAAO,YACP,OACA,UACA,QACO;;EACL,MAAM,WAAW,KAAK,YAAY,IAAI,MAAM;AAC5C,OAAK,SAAU;AAEf,WAAS,OAAO,SAAS;AAEzB,MAAI,SAAS,OAAO,GAAG;AACrB,QAAK,YAAY,OAAO,MAAM;AAC9B,QAAK,OAAO,eAAe,OAAO,KAAK,eAAe,IAAI,MAAM,CAAE;AAClE,QAAK,eAAe,OAAO,MAAM;AACjC,QAAK,OAAO,gBACV,KAAK,IAAI,KAAK,OAAO,iBAAiB,GAAG,GAAG,EAAE,CAC/C;EACH;AAEA,gDAAQ,IAAI,UAAU,UAAU,EAAC,oDAAjC,sCAAyC,UAAU,cAAc;CACnE;;;;;;CAOA,AAAQ,oBACR,OACyC;AACvC,MAAI,KAAK,eAAe,IAAI,MAAM,CAChC,QAAO,KAAK,eAAe,IAAI,MAAM;EAGvC,MAAM,UAAU,OAAO,GAAG,SAA8B;GACtD,MAAM,cAAc,KAAK,YAAY,IAAI,MAAM;AAC/C,OAAI,eAAe,YAAY,OAAO,EACpC,MAAK,MAAM,cAAc,aAAa;IACpC,MAAM,UAAU,QAAQ,IACtB,YACA,UACD;IAED,MAAM,YACN,QAAQ,QAAQ,KAAK,KAAK,GAAG,QAAQ,eAAe,QAAQ;AAE5D,QAAI,WAAW;AACb,UAAK,YAAY,OAAO,YAAY,OAAO;AAC3C;IACF;AAEA,QAAI,QAAQ,UACV,SAAQ,eAAe,KAAK,KAAK;AAGnC,QAAI,QAAQ,WAAY,MAAM,QAAQ,OAAO,GAAG,KAAK,CACnD;AAGF,QAAI;AACF,WAAM,WAAW,GAAG,KAAK;IAC1B,SAAQ,GAAG;AACV,SAAI,QAAQ,QACV,OAAM,QAAQ,QAAgB,EAAC;SAE/B,OAAM;IAET,UAAS;AACR,SAAI,QAAQ,KACV,MAAK,YAAY,OAAO,YAAY,OAAO;IAE/C;GACF;EAEH;AAED,OAAK,eAAe,IAAI,OAAO,QAAQ;AAEvC,SAAO;CACT;AACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CommandKit } from "./CommandKit-CDlCsGCx.js";
|
|
2
|
+
import { ParsedEvent } from "./EventsRouter-BacqK6z3.js";
|
|
3
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
+
|
|
5
|
+
//#region src/app/events/EventWorkerContext.d.ts
|
|
6
|
+
interface EventWorkerContext {
|
|
7
|
+
event: string;
|
|
8
|
+
namespace: string | null;
|
|
9
|
+
data: ParsedEvent;
|
|
10
|
+
commandkit: CommandKit;
|
|
11
|
+
arguments: any[];
|
|
12
|
+
}
|
|
13
|
+
declare const eventWorkerContext: AsyncLocalStorage<EventWorkerContext>;
|
|
14
|
+
declare function runInEventWorkerContext<T>(context: EventWorkerContext, callback: () => T): T;
|
|
15
|
+
declare function getEventWorkerContext(): EventWorkerContext;
|
|
16
|
+
declare function isEventWorkerContext(worker: any): worker is EventWorkerContext;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { EventWorkerContext, eventWorkerContext, getEventWorkerContext, isEventWorkerContext, runInEventWorkerContext };
|
|
19
|
+
//# sourceMappingURL=EventWorkerContext-C0e23GNY.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
const node_async_hooks = require_chunk.__toESM(require("node:async_hooks"));
|
|
3
|
+
|
|
4
|
+
//#region src/app/events/EventWorkerContext.ts
|
|
5
|
+
const kEventWorker = Symbol("commandkitEventWorker");
|
|
6
|
+
const eventWorkerContext = new node_async_hooks.AsyncLocalStorage();
|
|
7
|
+
function runInEventWorkerContext(context, callback) {
|
|
8
|
+
Reflect.set(context, kEventWorker, true);
|
|
9
|
+
return eventWorkerContext.run(context, callback);
|
|
10
|
+
}
|
|
11
|
+
function getEventWorkerContext() {
|
|
12
|
+
const context = eventWorkerContext.getStore();
|
|
13
|
+
if (!context) throw new Error("Event worker context not found");
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
function isEventWorkerContext(worker) {
|
|
17
|
+
return worker && Reflect.get(worker, kEventWorker) === true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
Object.defineProperty(exports, 'eventWorkerContext', {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return eventWorkerContext;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, 'getEventWorkerContext', {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return getEventWorkerContext;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, 'isEventWorkerContext', {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return isEventWorkerContext;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, 'runInEventWorkerContext', {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return runInEventWorkerContext;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=EventWorkerContext-XZGSHn5F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventWorkerContext-XZGSHn5F.js","names":[],"sources":["../src/app/events/EventWorkerContext.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport { ParsedEvent } from '../router';\nimport { CommandKit } from '../../CommandKit';\n\nexport interface EventWorkerContext {\n event: string;\n namespace: string | null;\n data: ParsedEvent;\n commandkit: CommandKit;\n arguments: any[];\n}\n\nconst kEventWorker = Symbol('commandkitEventWorker');\n\nexport const eventWorkerContext = new AsyncLocalStorage<EventWorkerContext>();\n\nexport function runInEventWorkerContext<T>(\n context: EventWorkerContext,\n callback: () => T,\n): T {\n Reflect.set(context, kEventWorker, true);\n\n return eventWorkerContext.run(context, callback);\n}\n\nexport function getEventWorkerContext(): EventWorkerContext {\n const context = eventWorkerContext.getStore();\n\n if (!context) {\n throw new Error('Event worker context not found');\n }\n\n return context;\n}\n\nexport function isEventWorkerContext(\n worker: any,\n): worker is EventWorkerContext {\n return worker && Reflect.get(worker, kEventWorker) === true;\n}\n"],"mappings":";;;;AAYA,MAAM,eAAe,OAAO,wBAAwB;AAEpD,MAAa,qBAAqB,IAAI;AAEtC,SAAgB,wBAChB,SACA,UACI;AACF,SAAQ,IAAI,SAAS,cAAc,KAAK;AAExC,QAAO,mBAAmB,IAAI,SAAS,SAAS;AAClD;AAEA,SAAgB,wBAA4C;CAC1D,MAAM,UAAU,mBAAmB,UAAU;AAE7C,MAAK,QACH,OAAM,IAAI,MAAM;AAGlB,QAAO;AACT;AAEA,SAAgB,qBAChB,QAC+B;AAC7B,QAAO,UAAU,QAAQ,IAAI,QAAQ,aAAa,KAAK;AACzD"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//#region src/app/router/EventsRouter.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for the EventsRouter
|
|
4
|
+
* @interface EventsRouterOptions
|
|
5
|
+
*/
|
|
6
|
+
interface EventsRouterOptions {
|
|
7
|
+
/** Root directory path where event handlers are located */
|
|
8
|
+
entrypoints: string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Represents a parsed event with its handlers
|
|
12
|
+
* @interface ParsedEvent
|
|
13
|
+
*/
|
|
14
|
+
interface ParsedEvent {
|
|
15
|
+
/** Name of the event derived from directory name */
|
|
16
|
+
event: string;
|
|
17
|
+
/** Absolute path to the event directory */
|
|
18
|
+
path: string;
|
|
19
|
+
/** Array of file paths to event listener handlers */
|
|
20
|
+
listeners: string[];
|
|
21
|
+
/** Namespace of the event */
|
|
22
|
+
namespace: string | null;
|
|
23
|
+
}
|
|
24
|
+
/** Collection of event names to their parsed metadata */
|
|
25
|
+
type EventsTree = Record<string, ParsedEvent>;
|
|
26
|
+
/**
|
|
27
|
+
* Router for discovering and managing event handler files in a directory structure.
|
|
28
|
+
* Events are represented by directories, and handlers are files within those directories.
|
|
29
|
+
*/
|
|
30
|
+
declare class EventsRouter {
|
|
31
|
+
private options;
|
|
32
|
+
/** Internal storage of parsed events */
|
|
33
|
+
private events;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new EventsRouter instance
|
|
36
|
+
* @param options - Configuration options for the router
|
|
37
|
+
* @throws Error if entrypoint is not provided
|
|
38
|
+
*/
|
|
39
|
+
constructor(options: EventsRouterOptions);
|
|
40
|
+
/**
|
|
41
|
+
* Adds new entrypoints to the router
|
|
42
|
+
* @param entrypoints - Array of new entrypoint paths
|
|
43
|
+
*/
|
|
44
|
+
addEntrypoints(entrypoints: string[]): void;
|
|
45
|
+
/**
|
|
46
|
+
* Find a parsed event by its name
|
|
47
|
+
* @param event - Name of the event to find
|
|
48
|
+
* @returns Parsed event metadata or null if not found
|
|
49
|
+
*/
|
|
50
|
+
match(event: string): ParsedEvent | null;
|
|
51
|
+
/**
|
|
52
|
+
* Get the entrypoint directory path
|
|
53
|
+
* @returns Entrypoint directory path
|
|
54
|
+
*/
|
|
55
|
+
get entrypoints(): string[];
|
|
56
|
+
/**
|
|
57
|
+
* Checks if the entrypoint path is valid
|
|
58
|
+
*/
|
|
59
|
+
isValidPath(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Clear all parsed events
|
|
62
|
+
*/
|
|
63
|
+
clear(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Reload and re-scan the entrypoint directory for events
|
|
66
|
+
* @returns Promise resolving to the updated events tree
|
|
67
|
+
*/
|
|
68
|
+
reload(): Promise<EventsTree>;
|
|
69
|
+
/**
|
|
70
|
+
* Scan the entrypoint directory for events and their handlers
|
|
71
|
+
* @returns Promise resolving to the events tree
|
|
72
|
+
*/
|
|
73
|
+
scan(): Promise<EventsTree>;
|
|
74
|
+
/**
|
|
75
|
+
* Convert the internal events Collection to a plain object
|
|
76
|
+
* @returns Events tree as a plain object
|
|
77
|
+
*/
|
|
78
|
+
toJSON(): EventsTree;
|
|
79
|
+
/**
|
|
80
|
+
* Recursively scan a directory for event handlers
|
|
81
|
+
* @param event - Name of the event
|
|
82
|
+
* @param path - Path to the event directory
|
|
83
|
+
* @param listeners - Array to collect listener file paths
|
|
84
|
+
* @returns Promise resolving to the parsed event metadata
|
|
85
|
+
*/
|
|
86
|
+
private scanEvent;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { EventsRouter, EventsRouterOptions, EventsTree, ParsedEvent };
|
|
90
|
+
//# sourceMappingURL=EventsRouter-BacqK6z3.d.ts.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
const discord_js = require_chunk.__toESM(require("discord.js"));
|
|
3
|
+
const node_fs = require_chunk.__toESM(require("node:fs"));
|
|
4
|
+
const node_path = require_chunk.__toESM(require("node:path"));
|
|
5
|
+
const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
|
|
6
|
+
|
|
7
|
+
//#region src/app/router/EventsRouter.ts
|
|
8
|
+
/**
|
|
9
|
+
* Router for discovering and managing event handler files in a directory structure.
|
|
10
|
+
* Events are represented by directories, and handlers are files within those directories.
|
|
11
|
+
*/
|
|
12
|
+
var EventsRouter = class {
|
|
13
|
+
/** Internal storage of parsed events */
|
|
14
|
+
events = new discord_js.Collection();
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new EventsRouter instance
|
|
17
|
+
* @param options - Configuration options for the router
|
|
18
|
+
* @throws Error if entrypoint is not provided
|
|
19
|
+
*/
|
|
20
|
+
constructor(options) {
|
|
21
|
+
var _options$entrypoints;
|
|
22
|
+
this.options = options;
|
|
23
|
+
if (options.entrypoints) options.entrypoints = Array.from(new Set(options.entrypoints));
|
|
24
|
+
if (!((_options$entrypoints = options.entrypoints) === null || _options$entrypoints === void 0 ? void 0 : _options$entrypoints.length)) throw new Error("Entrypoint directory must be provided");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Adds new entrypoints to the router
|
|
28
|
+
* @param entrypoints - Array of new entrypoint paths
|
|
29
|
+
*/
|
|
30
|
+
addEntrypoints(entrypoints) {
|
|
31
|
+
this.options.entrypoints = Array.from(new Set([...this.options.entrypoints, ...entrypoints]));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Find a parsed event by its name
|
|
35
|
+
* @param event - Name of the event to find
|
|
36
|
+
* @returns Parsed event metadata or null if not found
|
|
37
|
+
*/
|
|
38
|
+
match(event) {
|
|
39
|
+
return this.events.get(event) ?? null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the entrypoint directory path
|
|
43
|
+
* @returns Entrypoint directory path
|
|
44
|
+
*/
|
|
45
|
+
get entrypoints() {
|
|
46
|
+
return this.options.entrypoints;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Checks if the entrypoint path is valid
|
|
50
|
+
*/
|
|
51
|
+
isValidPath() {
|
|
52
|
+
return this.entrypoints.every((entrypoint) => (0, node_fs.existsSync)(entrypoint));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Clear all parsed events
|
|
56
|
+
*/
|
|
57
|
+
clear() {
|
|
58
|
+
this.events.clear();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Reload and re-scan the entrypoint directory for events
|
|
62
|
+
* @returns Promise resolving to the updated events tree
|
|
63
|
+
*/
|
|
64
|
+
async reload() {
|
|
65
|
+
this.clear();
|
|
66
|
+
return this.scan();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Scan the entrypoint directory for events and their handlers
|
|
70
|
+
* @returns Promise resolving to the events tree
|
|
71
|
+
*/
|
|
72
|
+
async scan() {
|
|
73
|
+
for (const entrypoint of this.entrypoints) {
|
|
74
|
+
const dirs = await (0, node_fs_promises.readdir)(entrypoint, { withFileTypes: true });
|
|
75
|
+
for (const dir of dirs) if (dir.isDirectory()) {
|
|
76
|
+
const path = (0, node_path.join)(entrypoint, dir.name);
|
|
77
|
+
await this.scanEvent(dir.name, path, null, [], true);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return Object.fromEntries(this.events);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Convert the internal events Collection to a plain object
|
|
84
|
+
* @returns Events tree as a plain object
|
|
85
|
+
*/
|
|
86
|
+
toJSON() {
|
|
87
|
+
return Object.fromEntries(this.events);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Recursively scan a directory for event handlers
|
|
91
|
+
* @param event - Name of the event
|
|
92
|
+
* @param path - Path to the event directory
|
|
93
|
+
* @param listeners - Array to collect listener file paths
|
|
94
|
+
* @returns Promise resolving to the parsed event metadata
|
|
95
|
+
*/
|
|
96
|
+
async scanEvent(event, path, _namespace = null, listeners = [], isRoot = false) {
|
|
97
|
+
const files = await (0, node_fs_promises.readdir)(path, { withFileTypes: true });
|
|
98
|
+
const isNamespace = isRoot && /^\(.+\)$/.test(event);
|
|
99
|
+
const namespace = isNamespace ? event.slice(1, -1) : _namespace ?? null;
|
|
100
|
+
files.sort((a, b) => a.name.localeCompare(b.name));
|
|
101
|
+
for (const file of files) {
|
|
102
|
+
if (file.name.startsWith("_")) continue;
|
|
103
|
+
if (file.isDirectory()) {
|
|
104
|
+
const nextPath = (0, node_path.join)(path, file.name);
|
|
105
|
+
await this.scanEvent(file.name, nextPath, namespace, listeners);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (file.isFile() && /\.(m|c)?(j|t)sx?$/.test(file.name)) listeners.push((0, node_path.join)(file.parentPath, file.name));
|
|
109
|
+
}
|
|
110
|
+
if (!isNamespace) {
|
|
111
|
+
const existing = this.events.get(event);
|
|
112
|
+
if (existing) {
|
|
113
|
+
existing.listeners = Array.from(new Set([...existing.listeners, ...listeners]));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
this.events.set(event, {
|
|
117
|
+
event,
|
|
118
|
+
path,
|
|
119
|
+
listeners,
|
|
120
|
+
namespace
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
Object.defineProperty(exports, 'EventsRouter', {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
get: function () {
|
|
130
|
+
return EventsRouter;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
//# sourceMappingURL=EventsRouter-CqnrlbjN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventsRouter-CqnrlbjN.js","names":[],"sources":["../src/app/router/EventsRouter.ts"],"sourcesContent":["import { Collection } from 'discord.js';\nimport { existsSync } from 'node:fs';\nimport { readdir } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Configuration options for the EventsRouter\n * @interface EventsRouterOptions\n */\nexport interface EventsRouterOptions {\n /** Root directory path where event handlers are located */\n entrypoints: string[];\n}\n\n/**\n * Represents a parsed event with its handlers\n * @interface ParsedEvent\n */\nexport interface ParsedEvent {\n /** Name of the event derived from directory name */\n event: string;\n /** Absolute path to the event directory */\n path: string;\n /** Array of file paths to event listener handlers */\n listeners: string[];\n /** Namespace of the event */\n namespace: string | null;\n}\n\n/** Collection of event names to their parsed metadata */\nexport type EventsTree = Record<string, ParsedEvent>;\n\n/**\n * Router for discovering and managing event handler files in a directory structure.\n * Events are represented by directories, and handlers are files within those directories.\n */\nexport class EventsRouter {\n /** Internal storage of parsed events */\n private events = new Collection<string, ParsedEvent>();\n\n /**\n * Creates a new EventsRouter instance\n * @param options - Configuration options for the router\n * @throws Error if entrypoint is not provided\n */\n public constructor(private options: EventsRouterOptions) {\n if (options.entrypoints) {\n options.entrypoints = Array.from(new Set(options.entrypoints));\n }\n\n if (!options.entrypoints?.length) {\n throw new Error('Entrypoint directory must be provided');\n }\n }\n\n /**\n * Adds new entrypoints to the router\n * @param entrypoints - Array of new entrypoint paths\n */\n public addEntrypoints(entrypoints: string[]) {\n this.options.entrypoints = Array.from(\n new Set([...this.options.entrypoints, ...entrypoints]),\n );\n }\n\n /**\n * Find a parsed event by its name\n * @param event - Name of the event to find\n * @returns Parsed event metadata or null if not found\n */\n public match(event: string): ParsedEvent | null {\n return this.events.get(event) ?? null;\n }\n\n /**\n * Get the entrypoint directory path\n * @returns Entrypoint directory path\n */\n public get entrypoints(): string[] {\n return this.options.entrypoints;\n }\n\n /**\n * Checks if the entrypoint path is valid\n */\n public isValidPath() {\n return this.entrypoints.every((entrypoint) => existsSync(entrypoint));\n }\n\n /**\n * Clear all parsed events\n */\n public clear() {\n this.events.clear();\n }\n\n /**\n * Reload and re-scan the entrypoint directory for events\n * @returns Promise resolving to the updated events tree\n */\n public async reload() {\n this.clear();\n return this.scan();\n }\n\n /**\n * Scan the entrypoint directory for events and their handlers\n * @returns Promise resolving to the events tree\n */\n public async scan(): Promise<EventsTree> {\n for (const entrypoint of this.entrypoints) {\n const dirs = await readdir(entrypoint, { withFileTypes: true });\n\n for (const dir of dirs) {\n if (dir.isDirectory()) {\n const path = join(entrypoint, dir.name);\n await this.scanEvent(dir.name, path, null, [], true);\n }\n }\n }\n\n return Object.fromEntries(this.events);\n }\n\n /**\n * Convert the internal events Collection to a plain object\n * @returns Events tree as a plain object\n */\n public toJSON(): EventsTree {\n return Object.fromEntries(this.events);\n }\n\n /**\n * Recursively scan a directory for event handlers\n * @param event - Name of the event\n * @param path - Path to the event directory\n * @param listeners - Array to collect listener file paths\n * @returns Promise resolving to the parsed event metadata\n */\n private async scanEvent(\n event: string,\n path: string,\n _namespace: string | null = null,\n listeners: string[] = [],\n isRoot = false,\n ): Promise<void> {\n const files = await readdir(path, { withFileTypes: true });\n const isNamespace = isRoot && /^\\(.+\\)$/.test(event);\n\n // if event = (something) pattern then namespace is something\n const namespace = isNamespace ? event.slice(1, -1) : (_namespace ?? null);\n\n files.sort((a, b) => a.name.localeCompare(b.name));\n\n for (const file of files) {\n if (file.name.startsWith('_')) continue;\n\n if (file.isDirectory()) {\n const nextPath = join(path, file.name);\n await this.scanEvent(file.name, nextPath, namespace, listeners);\n continue;\n }\n\n if (file.isFile() && /\\.(m|c)?(j|t)sx?$/.test(file.name)) {\n listeners.push(join(file.parentPath, file.name));\n }\n }\n\n if (!isNamespace) {\n const existing = this.events.get(event);\n\n if (existing) {\n existing.listeners = Array.from(\n new Set([...existing.listeners, ...listeners]),\n );\n\n return;\n }\n\n this.events.set(event, { event, path, listeners, namespace });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAoCA,IAAa,eAAb,MAA0B;;CAExB,AAAQ,SAAS,IAAI;;;;;;CAOrB,AAAO,YAAoB,SAA8B;;EAA9B;AACzB,MAAI,QAAQ,YACV,SAAQ,cAAc,MAAM,KAAK,IAAI,IAAI,QAAQ,aAAa;AAGhE,gCAAK,QAAQ,yFAAa,QACxB,OAAM,IAAI,MAAM;CAEpB;;;;;CAMA,AAAO,eAAe,aAAuB;AAC3C,OAAK,QAAQ,cAAc,MAAM,KAC/B,IAAI,IAAI,CAAC,GAAG,KAAK,QAAQ,aAAa,GAAG,WAAY,GACtD;CACH;;;;;;CAOA,AAAO,MAAM,OAAmC;AAC9C,SAAO,KAAK,OAAO,IAAI,MAAM,IAAI;CACnC;;;;;CAMA,IAAW,cAAwB;AACjC,SAAO,KAAK,QAAQ;CACtB;;;;CAKA,AAAO,cAAc;AACnB,SAAO,KAAK,YAAY,MAAM,CAAC,eAAe,wBAAW,WAAW,CAAC;CACvE;;;;CAKA,AAAO,QAAQ;AACb,OAAK,OAAO,OAAO;CACrB;;;;;CAMA,MAAa,SAAS;AACpB,OAAK,OAAO;AACZ,SAAO,KAAK,MAAM;CACpB;;;;;CAMA,MAAa,OAA4B;AACvC,OAAK,MAAM,cAAc,KAAK,aAAa;GACzC,MAAM,OAAO,MAAM,8BAAQ,YAAY,EAAE,eAAe,KAAM,EAAC;AAE/D,QAAK,MAAM,OAAO,KAChB,KAAI,IAAI,aAAa,EAAE;IACrB,MAAM,OAAO,oBAAK,YAAY,IAAI,KAAK;AACvC,UAAM,KAAK,UAAU,IAAI,MAAM,MAAM,MAAM,CAAE,GAAE,KAAK;GACtD;EAEJ;AAEA,SAAO,OAAO,YAAY,KAAK,OAAO;CACxC;;;;;CAMA,AAAO,SAAqB;AAC1B,SAAO,OAAO,YAAY,KAAK,OAAO;CACxC;;;;;;;;CASA,MAAc,UACd,OACA,MACA,aAA4B,MAC5B,YAAsB,CAAE,GACxB,SAAS,OACO;EACd,MAAM,QAAQ,MAAM,8BAAQ,MAAM,EAAE,eAAe,KAAM,EAAC;EAC1D,MAAM,cAAc,UAAU,WAAW,KAAK,MAAM;EAGpD,MAAM,YAAY,cAAc,MAAM,MAAM,GAAG,GAAG,GAAG,cAAc;AAEnE,QAAM,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;AAElD,OAAK,MAAM,QAAQ,OAAO;AACxB,OAAI,KAAK,KAAK,WAAW,IAAI,CAAE;AAE/B,OAAI,KAAK,aAAa,EAAE;IACtB,MAAM,WAAW,oBAAK,MAAM,KAAK,KAAK;AACtC,UAAM,KAAK,UAAU,KAAK,MAAM,UAAU,WAAW,UAAU;AAC/D;GACF;AAEA,OAAI,KAAK,QAAQ,IAAI,oBAAoB,KAAK,KAAK,KAAK,CACtD,WAAU,KAAK,oBAAK,KAAK,YAAY,KAAK,KAAK,CAAC;EAEpD;AAEA,OAAK,aAAa;GAChB,MAAM,WAAW,KAAK,OAAO,IAAI,MAAM;AAEvC,OAAI,UAAU;AACZ,aAAS,YAAY,MAAM,KACzB,IAAI,IAAI,CAAC,GAAG,SAAS,WAAW,GAAG,SAAU,GAC9C;AAED;GACF;AAEA,QAAK,OAAO,IAAI,OAAO;IAAE;IAAO;IAAM;IAAW;GAAW,EAAC;EAC/D;CACF;AACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/logger/ILogger.d.ts
|
|
2
|
+
interface ILogger {
|
|
3
|
+
log(...args: any[]): void;
|
|
4
|
+
error(...args: any[]): void;
|
|
5
|
+
warn(...args: any[]): void;
|
|
6
|
+
info(...args: any[]): void;
|
|
7
|
+
debug(...args: any[]): void;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ILogger };
|
|
11
|
+
//# sourceMappingURL=ILogger-BTMQuall.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ILogger } from "./ILogger-BTMQuall.js";
|
|
2
|
+
|
|
3
|
+
//#region src/logger/Logger.d.ts
|
|
4
|
+
interface CommandKitLoggerOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The logger provider to use.
|
|
7
|
+
*/
|
|
8
|
+
provider: ILogger;
|
|
9
|
+
}
|
|
10
|
+
interface LoggerImpl extends ILogger {
|
|
11
|
+
configure(options: CommandKitLoggerOptions): void;
|
|
12
|
+
}
|
|
13
|
+
declare function createLogger(options: CommandKitLoggerOptions): LoggerImpl;
|
|
14
|
+
declare const Logger: LoggerImpl;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { CommandKitLoggerOptions, Logger, LoggerImpl, createLogger };
|
|
17
|
+
//# sourceMappingURL=Logger-A3wjB7L1.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { EventInterceptorErrorHandler } from "./EventInterceptor-D_oEWSnF.js";
|
|
2
|
+
import { CommandKitSelectMenuBuilderInteractionCollectorDispatch, CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, CommandKitSelectMenuBuilderOnEnd, OnSelectMenuKitSubmit, SelectMenuKitPredicate } from "./common-pvPJVTfe.js";
|
|
3
|
+
import { MentionableSelectMenuBuilder, MentionableSelectMenuInteraction } from "discord.js";
|
|
4
|
+
|
|
5
|
+
//#region src/components/v1/select-menu/MentionableSelectMenuKit.d.ts
|
|
6
|
+
type OnMentionableSelectMenuKitSubmit = OnSelectMenuKitSubmit<MentionableSelectMenuInteraction, MentionableSelectMenuKit>;
|
|
7
|
+
type MentionableSelectMenuKitPredicate = SelectMenuKitPredicate<MentionableSelectMenuInteraction>;
|
|
8
|
+
declare class MentionableSelectMenuKit extends MentionableSelectMenuBuilder {
|
|
9
|
+
#private;
|
|
10
|
+
/**
|
|
11
|
+
* Sets the handler to run when the modal is submitted.
|
|
12
|
+
* @param handler - The handler to run when the modal is submitted.
|
|
13
|
+
* @param data - The context data for the interaction collector.
|
|
14
|
+
* @returns This instance of the modal builder.
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const modal = new MentionableSelectMenuKit()
|
|
18
|
+
* .setTitle('My Modal')
|
|
19
|
+
* .setCustomId('my-modal')
|
|
20
|
+
* .filter((interaction) => interaction.Mentionable.id === '1234567890')
|
|
21
|
+
* .onSelect(async (interaction) => {
|
|
22
|
+
* await interaction.reply('You submitted the modal!');
|
|
23
|
+
* })
|
|
24
|
+
* .addComponents(actionRow1, actionRow2);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
onSelect(handler: CommandKitSelectMenuBuilderInteractionCollectorDispatch<MentionableSelectMenuInteraction, MentionableSelectMenuKit>, data?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData): this;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the handler to run when the interaction collector ends.
|
|
30
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
31
|
+
* @returns This instance of the modal builder.
|
|
32
|
+
*/
|
|
33
|
+
onEnd(handler: CommandKitSelectMenuBuilderOnEnd): this;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the handler to run when the interaction collector ends.
|
|
36
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
37
|
+
* @returns This instance of the modal builder.
|
|
38
|
+
*/
|
|
39
|
+
onError(handler: EventInterceptorErrorHandler): this;
|
|
40
|
+
/**
|
|
41
|
+
* Sets a filter for the interaction collector.
|
|
42
|
+
* @param predicate - The filter to use for the interaction collector.
|
|
43
|
+
* @returns This instance of the modal builder.
|
|
44
|
+
*/
|
|
45
|
+
filter(predicate: SelectMenuKitPredicate<MentionableSelectMenuInteraction>): this;
|
|
46
|
+
private get customId();
|
|
47
|
+
dispose(): this;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { MentionableSelectMenuKit, MentionableSelectMenuKitPredicate, OnMentionableSelectMenuKitSubmit };
|
|
51
|
+
//# sourceMappingURL=MentionableSelectMenuKit-BiUSKUtZ.d.ts.map
|