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,200 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
const require_error_codes = require('./error-codes-C_UO39jz.js');
|
|
3
|
+
const discord_js = require_chunk.__toESM(require("discord.js"));
|
|
4
|
+
|
|
5
|
+
//#region src/app/commands/MessageCommandParser.ts
|
|
6
|
+
var MessageCommandParser = class {
|
|
7
|
+
#parsed = null;
|
|
8
|
+
#options = null;
|
|
9
|
+
#args = [];
|
|
10
|
+
constructor(message, prefix, schema) {
|
|
11
|
+
this.message = message;
|
|
12
|
+
this.prefix = prefix;
|
|
13
|
+
this.schema = schema;
|
|
14
|
+
}
|
|
15
|
+
getArgs() {
|
|
16
|
+
this.parse();
|
|
17
|
+
return this.#args;
|
|
18
|
+
}
|
|
19
|
+
get options() {
|
|
20
|
+
if (!this.#options) this.#options = new MessageCommandOptions(this);
|
|
21
|
+
return this.#options;
|
|
22
|
+
}
|
|
23
|
+
getOption(name) {
|
|
24
|
+
var _this$parse$options$f;
|
|
25
|
+
return (_this$parse$options$f = this.parse().options.find((o) => o.name === name)) === null || _this$parse$options$f === void 0 ? void 0 : _this$parse$options$f.value;
|
|
26
|
+
}
|
|
27
|
+
getCommand() {
|
|
28
|
+
return this.parse().command;
|
|
29
|
+
}
|
|
30
|
+
getSubcommand() {
|
|
31
|
+
return this.parse().subcommand;
|
|
32
|
+
}
|
|
33
|
+
getSubcommandGroup() {
|
|
34
|
+
return this.parse().subcommandGroup;
|
|
35
|
+
}
|
|
36
|
+
getPrefix() {
|
|
37
|
+
for (const p of this.prefix) if (this.message.content.startsWith(p)) return p;
|
|
38
|
+
}
|
|
39
|
+
getFullCommand() {
|
|
40
|
+
return [
|
|
41
|
+
this.getCommand(),
|
|
42
|
+
this.getSubcommandGroup(),
|
|
43
|
+
this.getSubcommand()
|
|
44
|
+
].filter((v) => v).join(" ");
|
|
45
|
+
}
|
|
46
|
+
parse() {
|
|
47
|
+
if (this.#parsed) return this.#parsed;
|
|
48
|
+
const content = this.message.content;
|
|
49
|
+
const prefix = this.getPrefix();
|
|
50
|
+
if (!prefix) throw require_error_codes.createCommandKitError(require_error_codes.CommandKitErrorCodes.InvalidCommandPrefix);
|
|
51
|
+
const parts = content.slice(prefix.length).trim().split(" ");
|
|
52
|
+
const command = parts.shift();
|
|
53
|
+
this.#args = parts;
|
|
54
|
+
let subcommandGroup;
|
|
55
|
+
let subcommand;
|
|
56
|
+
if (command === null || command === void 0 ? void 0 : command.includes(":")) {
|
|
57
|
+
const [, group, cmd] = command.split(":");
|
|
58
|
+
if (!cmd && group) subcommand = group;
|
|
59
|
+
else if (cmd && group) {
|
|
60
|
+
subcommandGroup = group;
|
|
61
|
+
subcommand = cmd;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const schema = this.schema([
|
|
65
|
+
command,
|
|
66
|
+
subcommandGroup,
|
|
67
|
+
subcommand
|
|
68
|
+
].filter(Boolean).join(" ").trim());
|
|
69
|
+
const options = parts.map((part) => {
|
|
70
|
+
try {
|
|
71
|
+
const [name, value] = part.split(":");
|
|
72
|
+
if (!(name in schema)) return null;
|
|
73
|
+
switch (schema[name]) {
|
|
74
|
+
case discord_js.ApplicationCommandOptionType.Boolean: return {
|
|
75
|
+
name,
|
|
76
|
+
value: value === "true"
|
|
77
|
+
};
|
|
78
|
+
case discord_js.ApplicationCommandOptionType.Integer: return {
|
|
79
|
+
name,
|
|
80
|
+
value: parseInt(value, 10)
|
|
81
|
+
};
|
|
82
|
+
case discord_js.ApplicationCommandOptionType.Number: return {
|
|
83
|
+
name,
|
|
84
|
+
value: parseFloat(value)
|
|
85
|
+
};
|
|
86
|
+
case discord_js.ApplicationCommandOptionType.String: return {
|
|
87
|
+
name,
|
|
88
|
+
value
|
|
89
|
+
};
|
|
90
|
+
case discord_js.ApplicationCommandOptionType.User: return {
|
|
91
|
+
name,
|
|
92
|
+
value: this.message.mentions.users.find((u) => {
|
|
93
|
+
return u.id === value.replace(/[<@!>]/g, "");
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
case discord_js.ApplicationCommandOptionType.Channel: return {
|
|
97
|
+
name,
|
|
98
|
+
value: this.message.mentions.channels.find((c) => {
|
|
99
|
+
return c.id === value.replace(/[<#>]/g, "");
|
|
100
|
+
})
|
|
101
|
+
};
|
|
102
|
+
case discord_js.ApplicationCommandOptionType.Role: return {
|
|
103
|
+
name,
|
|
104
|
+
value: this.message.mentions.roles.find((r) => {
|
|
105
|
+
return r.id === value.replace(/[<@&>]/g, "");
|
|
106
|
+
})
|
|
107
|
+
};
|
|
108
|
+
case discord_js.ApplicationCommandOptionType.Attachment: return {
|
|
109
|
+
name,
|
|
110
|
+
value: this.message.attachments.find((a) => {
|
|
111
|
+
return a.name === value;
|
|
112
|
+
})
|
|
113
|
+
};
|
|
114
|
+
default: return null;
|
|
115
|
+
}
|
|
116
|
+
} catch {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}).filter((v) => v !== null);
|
|
120
|
+
this.#parsed = {
|
|
121
|
+
command,
|
|
122
|
+
options,
|
|
123
|
+
subcommand,
|
|
124
|
+
subcommandGroup
|
|
125
|
+
};
|
|
126
|
+
return this.#parsed;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var MessageCommandOptions = class {
|
|
130
|
+
constructor(parser) {
|
|
131
|
+
this.parser = parser;
|
|
132
|
+
}
|
|
133
|
+
assertOption(name, required = false) {
|
|
134
|
+
const option = this.parser.getOption(name);
|
|
135
|
+
if (required && option === void 0) throw new Error(`Option "${name}" is required.`);
|
|
136
|
+
return option ?? null;
|
|
137
|
+
}
|
|
138
|
+
getMember(name, required = false) {
|
|
139
|
+
var _this$parser$message$;
|
|
140
|
+
const user = this.assertOption(name, required);
|
|
141
|
+
const member = (_this$parser$message$ = this.parser.message.guild) === null || _this$parser$message$ === void 0 ? void 0 : _this$parser$message$.members.cache.get(user === null || user === void 0 ? void 0 : user.id);
|
|
142
|
+
if (required && !member) throw new Error(`Member "${name}" is required.`);
|
|
143
|
+
return member ?? null;
|
|
144
|
+
}
|
|
145
|
+
getAttachment(name, required = false) {
|
|
146
|
+
return this.assertOption(name, required);
|
|
147
|
+
}
|
|
148
|
+
getBoolean(name, required = false) {
|
|
149
|
+
return this.assertOption(name, required);
|
|
150
|
+
}
|
|
151
|
+
getNumber(name, required = false) {
|
|
152
|
+
return this.assertOption(name, required);
|
|
153
|
+
}
|
|
154
|
+
getString(name, required = false) {
|
|
155
|
+
return this.assertOption(name, required);
|
|
156
|
+
}
|
|
157
|
+
getInteger(name, required = false) {
|
|
158
|
+
return this.assertOption(name, required);
|
|
159
|
+
}
|
|
160
|
+
getUser(name, required = false) {
|
|
161
|
+
return this.assertOption(name, required);
|
|
162
|
+
}
|
|
163
|
+
getChannel(name, required = false) {
|
|
164
|
+
return this.assertOption(name, required);
|
|
165
|
+
}
|
|
166
|
+
getRole(name, required = false) {
|
|
167
|
+
return this.assertOption(name, required);
|
|
168
|
+
}
|
|
169
|
+
getMentionable(name, required = false) {
|
|
170
|
+
const target = this.assertOption(name, required);
|
|
171
|
+
if (target instanceof discord_js.GuildMember || target instanceof discord_js.User || target instanceof discord_js.Role) return target;
|
|
172
|
+
if (required) throw new Error(`Mentionable "${name}" is required.`);
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
getSubcommand(required = false) {
|
|
176
|
+
const sub = this.parser.getSubcommand();
|
|
177
|
+
if (required && sub === void 0) throw new Error("Subcommand is required.");
|
|
178
|
+
return sub ?? null;
|
|
179
|
+
}
|
|
180
|
+
getSubcommandGroup(required = false) {
|
|
181
|
+
const sub = this.parser.getSubcommandGroup();
|
|
182
|
+
if (required && sub === void 0) throw new Error("Subcommand group is required.");
|
|
183
|
+
return sub ?? null;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
//#endregion
|
|
188
|
+
Object.defineProperty(exports, 'MessageCommandOptions', {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
get: function () {
|
|
191
|
+
return MessageCommandOptions;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
Object.defineProperty(exports, 'MessageCommandParser', {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function () {
|
|
197
|
+
return MessageCommandParser;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
//# sourceMappingURL=MessageCommandParser-B13Pkwo9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageCommandParser-B13Pkwo9.js","names":[],"sources":["../src/app/commands/MessageCommandParser.ts"],"sourcesContent":["import { Channel } from 'diagnostics_channel';\nimport {\n Message,\n ApplicationCommandOptionType,\n GuildMember,\n Attachment,\n User,\n Role,\n CommandInteractionOption,\n} from 'discord.js';\nimport {\n CommandKitErrorCodes,\n createCommandKitError,\n} from '../../utils/error-codes';\n\nexport interface ParsedMessageCommand {\n command: string;\n options: { name: string; value: unknown }[];\n subcommand?: string;\n subcommandGroup?: string;\n}\n\nexport type MessageCommandOptionsSchema = Record<\n string,\n ApplicationCommandOptionType\n>;\n\nexport class MessageCommandParser {\n #parsed: ParsedMessageCommand | null = null;\n #options: MessageCommandOptions | null = null;\n #args: string[] = [];\n\n public constructor(\n public message: Message,\n private prefix: string[],\n private schema: (command: string) => MessageCommandOptionsSchema,\n ) {}\n\n public getArgs() {\n void this.parse();\n return this.#args;\n }\n\n public get options() {\n if (!this.#options) {\n this.#options = new MessageCommandOptions(this);\n }\n\n return this.#options;\n }\n\n public getOption<T>(name: string): T | undefined {\n return this.parse().options.find((o) => o.name === name)?.value as T;\n }\n\n public getCommand(): string {\n return this.parse().command;\n }\n\n public getSubcommand(): string | undefined {\n return this.parse().subcommand;\n }\n\n public getSubcommandGroup(): string | undefined {\n return this.parse().subcommandGroup;\n }\n\n public getPrefix() {\n for (const p of this.prefix) {\n if (this.message.content.startsWith(p)) {\n return p;\n }\n }\n }\n\n public getFullCommand() {\n return [this.getCommand(), this.getSubcommandGroup(), this.getSubcommand()]\n .filter((v) => v)\n .join(' ');\n }\n\n public parse(): ParsedMessageCommand {\n if (this.#parsed) {\n return this.#parsed;\n }\n\n const content = this.message.content;\n\n const prefix = this.getPrefix();\n\n if (!prefix) {\n throw createCommandKitError(CommandKitErrorCodes.InvalidCommandPrefix);\n }\n\n const parts = content.slice(prefix.length).trim().split(' ');\n const command = parts.shift();\n\n this.#args = parts;\n\n let subcommandGroup: string | undefined;\n let subcommand: string | undefined;\n\n if (command?.includes(':')) {\n const [, group, cmd] = command.split(':');\n\n if (!cmd && group) {\n subcommand = group;\n } else if (cmd && group) {\n subcommandGroup = group;\n subcommand = cmd;\n }\n }\n\n const schema = this.schema(\n [command, subcommandGroup, subcommand].filter(Boolean).join(' ').trim(),\n );\n\n const options = parts\n .map((part) => {\n try {\n const [name, value] = part.split(':');\n\n if (!(name in schema)) return null;\n\n switch (schema[name]) {\n case ApplicationCommandOptionType.Boolean:\n return { name, value: value === 'true' };\n case ApplicationCommandOptionType.Integer:\n return { name, value: parseInt(value, 10) };\n case ApplicationCommandOptionType.Number:\n return { name, value: parseFloat(value) };\n case ApplicationCommandOptionType.String:\n return { name, value };\n case ApplicationCommandOptionType.User:\n return {\n name,\n value: this.message.mentions.users.find((u) => {\n return u.id === value.replace(/[<@!>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Channel:\n return {\n name,\n value: this.message.mentions.channels.find((c) => {\n return c.id === value.replace(/[<#>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Role:\n return {\n name,\n value: this.message.mentions.roles.find((r) => {\n return r.id === value.replace(/[<@&>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Attachment:\n return {\n name,\n value: this.message.attachments.find((a) => {\n return a.name === value;\n }),\n };\n default:\n return null;\n }\n } catch {\n // Invalid option\n return null;\n }\n })\n .filter((v) => v !== null);\n\n this.#parsed = {\n command: command!,\n options,\n subcommand,\n subcommandGroup,\n };\n\n return this.#parsed;\n }\n}\n\nexport class MessageCommandOptions {\n public constructor(private parser: MessageCommandParser) {}\n\n private assertOption<T>(name: string, required = false) {\n const option = this.parser.getOption<T>(name);\n\n if (required && option === undefined) {\n throw new Error(`Option \"${name}\" is required.`);\n }\n\n return option ?? null;\n }\n\n getMember(name: string): GuildMember | null;\n getMember(name: string, required: true): GuildMember;\n getMember(name: string, required = false) {\n const user = this.assertOption<User>(name, required);\n const member = this.parser.message.guild?.members.cache.get(user?.id!);\n\n if (required && !member) {\n throw new Error(`Member \"${name}\" is required.`);\n }\n\n return member ?? null;\n }\n\n getAttachment(name: string): Attachment | null;\n getAttachment(name: string, required: true): Attachment;\n getAttachment(name: string, required = false) {\n return this.assertOption<Attachment>(name, required);\n }\n\n getBoolean(name: string): boolean | null;\n getBoolean(name: string, required: true): boolean;\n getBoolean(name: string, required = false) {\n return this.assertOption<boolean>(name, required);\n }\n\n getNumber(name: string): number | null;\n getNumber(name: string, required: true): number;\n getNumber(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n getString(name: string): string | null;\n getString(name: string, required: true): string;\n getString(name: string, required = false) {\n return this.assertOption<string>(name, required);\n }\n\n getInteger(name: string): number | null;\n getInteger(name: string, required: true): number;\n getInteger(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n getUser(name: string): User | null;\n getUser(name: string, required: true): User;\n getUser(name: string, required = false) {\n return this.assertOption<User>(name, required);\n }\n\n getChannel(name: string): Channel | null;\n getChannel(name: string, required: true): Channel;\n getChannel(name: string, required = false) {\n return this.assertOption<Channel>(name, required);\n }\n\n getRole(name: string): Role | null;\n getRole(name: string, required: true): Role;\n getRole(name: string, required = false) {\n return this.assertOption<Role>(name, required);\n }\n\n getMentionable(\n name: string,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;\n getMentionable(\n name: string,\n required: true,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;\n getMentionable(\n name: string,\n required = false,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null {\n const target = this.assertOption(name, required);\n\n if (\n target instanceof GuildMember ||\n target instanceof User ||\n target instanceof Role\n ) {\n return target;\n }\n\n if (required) {\n throw new Error(`Mentionable \"${name}\" is required.`);\n }\n\n return null;\n }\n\n getSubcommand(): string | null;\n getSubcommand(required: true): string;\n getSubcommand(required = false) {\n const sub = this.parser.getSubcommand();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand is required.');\n }\n\n return sub ?? null;\n }\n\n getSubcommandGroup(): string | null;\n getSubcommandGroup(required: true): string;\n getSubcommandGroup(required = false) {\n const sub = this.parser.getSubcommandGroup();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand group is required.');\n }\n\n return sub ?? null;\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ApplicationCommandOptionType, Attachment, CommandInteractionOption, GuildMember, Message, Role, User } from "discord.js";
|
|
2
|
+
import { Channel } from "diagnostics_channel";
|
|
3
|
+
|
|
4
|
+
//#region src/app/commands/MessageCommandParser.d.ts
|
|
5
|
+
interface ParsedMessageCommand {
|
|
6
|
+
command: string;
|
|
7
|
+
options: {
|
|
8
|
+
name: string;
|
|
9
|
+
value: unknown;
|
|
10
|
+
}[];
|
|
11
|
+
subcommand?: string;
|
|
12
|
+
subcommandGroup?: string;
|
|
13
|
+
}
|
|
14
|
+
type MessageCommandOptionsSchema = Record<string, ApplicationCommandOptionType>;
|
|
15
|
+
declare class MessageCommandParser {
|
|
16
|
+
#private;
|
|
17
|
+
message: Message;
|
|
18
|
+
private prefix;
|
|
19
|
+
private schema;
|
|
20
|
+
constructor(message: Message, prefix: string[], schema: (command: string) => MessageCommandOptionsSchema);
|
|
21
|
+
getArgs(): string[];
|
|
22
|
+
get options(): MessageCommandOptions;
|
|
23
|
+
getOption<T>(name: string): T | undefined;
|
|
24
|
+
getCommand(): string;
|
|
25
|
+
getSubcommand(): string | undefined;
|
|
26
|
+
getSubcommandGroup(): string | undefined;
|
|
27
|
+
getPrefix(): string | undefined;
|
|
28
|
+
getFullCommand(): string;
|
|
29
|
+
parse(): ParsedMessageCommand;
|
|
30
|
+
}
|
|
31
|
+
declare class MessageCommandOptions {
|
|
32
|
+
private parser;
|
|
33
|
+
constructor(parser: MessageCommandParser);
|
|
34
|
+
private assertOption;
|
|
35
|
+
getMember(name: string): GuildMember | null;
|
|
36
|
+
getMember(name: string, required: true): GuildMember;
|
|
37
|
+
getAttachment(name: string): Attachment | null;
|
|
38
|
+
getAttachment(name: string, required: true): Attachment;
|
|
39
|
+
getBoolean(name: string): boolean | null;
|
|
40
|
+
getBoolean(name: string, required: true): boolean;
|
|
41
|
+
getNumber(name: string): number | null;
|
|
42
|
+
getNumber(name: string, required: true): number;
|
|
43
|
+
getString(name: string): string | null;
|
|
44
|
+
getString(name: string, required: true): string;
|
|
45
|
+
getInteger(name: string): number | null;
|
|
46
|
+
getInteger(name: string, required: true): number;
|
|
47
|
+
getUser(name: string): User | null;
|
|
48
|
+
getUser(name: string, required: true): User;
|
|
49
|
+
getChannel(name: string): Channel | null;
|
|
50
|
+
getChannel(name: string, required: true): Channel;
|
|
51
|
+
getRole(name: string): Role | null;
|
|
52
|
+
getRole(name: string, required: true): Role;
|
|
53
|
+
getMentionable(name: string): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;
|
|
54
|
+
getMentionable(name: string, required: true): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;
|
|
55
|
+
getSubcommand(): string | null;
|
|
56
|
+
getSubcommand(required: true): string;
|
|
57
|
+
getSubcommandGroup(): string | null;
|
|
58
|
+
getSubcommandGroup(required: true): string;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { MessageCommandOptions, MessageCommandOptionsSchema, MessageCommandParser, ParsedMessageCommand };
|
|
62
|
+
//# sourceMappingURL=MessageCommandParser-tzroBwij.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EventInterceptorErrorHandler } from "./EventInterceptor-D_oEWSnF.js";
|
|
2
|
+
import { CommandKitModalBuilderInteractionCollectorDispatchContextData, OnModalKitEnd, OnModalKitSubmit } from "./ModalKit-CKtQ8eXW.js";
|
|
3
|
+
import { CommandKitElement } from "./element-D_nyVwgB.js";
|
|
4
|
+
import { MaybeArray } from "./types-CJ-XvOFN.js";
|
|
5
|
+
import { ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js";
|
|
6
|
+
|
|
7
|
+
//#region src/components/v1/modal/Modal.d.ts
|
|
8
|
+
interface ModalProps {
|
|
9
|
+
customId?: string;
|
|
10
|
+
title: string;
|
|
11
|
+
children?: MaybeArray<TextInputBuilder | ActionRowBuilder>;
|
|
12
|
+
onSubmit?: OnModalKitSubmit;
|
|
13
|
+
onEnd?: OnModalKitEnd;
|
|
14
|
+
onError?: EventInterceptorErrorHandler;
|
|
15
|
+
options?: CommandKitModalBuilderInteractionCollectorDispatchContextData;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The modal component.
|
|
19
|
+
* @param props The modal properties.
|
|
20
|
+
* @returns The commandkit element.
|
|
21
|
+
* @example <Modal title="My Modal" onSubmit={onSubmit}>...</Modal>
|
|
22
|
+
*/
|
|
23
|
+
declare function Modal(props: ModalProps): CommandKitElement<'modal'>;
|
|
24
|
+
interface TextInputProps {
|
|
25
|
+
customId: string;
|
|
26
|
+
label: string;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
maxLength?: number;
|
|
29
|
+
minLength?: number;
|
|
30
|
+
value?: string;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The text input component.
|
|
35
|
+
* @param props The text input properties.
|
|
36
|
+
* @returns The commandkit element.
|
|
37
|
+
* @example <TextInput customId="input" label="Input" style={TextInputStyle.Short} />
|
|
38
|
+
*/
|
|
39
|
+
declare function TextInput(props: TextInputProps & {
|
|
40
|
+
style: TextInputStyle;
|
|
41
|
+
}): CommandKitElement<'text-input'>;
|
|
42
|
+
/**
|
|
43
|
+
* The short text input component.
|
|
44
|
+
* @param props The text input properties.
|
|
45
|
+
* @returns The commandkit element.
|
|
46
|
+
* @example <ShortInput customId="input" label="Input" />
|
|
47
|
+
*/
|
|
48
|
+
declare function ShortInput(props: TextInputProps): CommandKitElement<'text-input'>;
|
|
49
|
+
/**
|
|
50
|
+
* The paragraph text input component.
|
|
51
|
+
* @param props The text input properties.
|
|
52
|
+
* @returns The commandkit element.
|
|
53
|
+
* @example <ParagraphInput customId="input" label="Input" />
|
|
54
|
+
*/
|
|
55
|
+
declare function ParagraphInput(props: TextInputProps): CommandKitElement<'text-input'>;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Modal, ModalProps, ParagraphInput, ShortInput, TextInput, TextInputProps };
|
|
58
|
+
//# sourceMappingURL=Modal-Cxm6cs5c.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { EventInterceptorContextData, EventInterceptorErrorHandler } from "./EventInterceptor-D_oEWSnF.js";
|
|
2
|
+
import { Awaitable, Events, ModalBuilder, ModalSubmitInteraction } from "discord.js";
|
|
3
|
+
|
|
4
|
+
//#region src/components/v1/modal/ModalKit.d.ts
|
|
5
|
+
type ModalKitPredicate = (interaction: ModalSubmitInteraction) => Awaitable<boolean>;
|
|
6
|
+
/**
|
|
7
|
+
* The handler to run when a modal is submitted. This handler is called with the interaction as the first argument.
|
|
8
|
+
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
9
|
+
*/
|
|
10
|
+
type OnModalKitSubmit = CommandKitModalBuilderInteractionCollectorDispatch;
|
|
11
|
+
/**
|
|
12
|
+
* The handler to run when the interaction collector ends. This handler is called with the reason as the first argument.
|
|
13
|
+
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
14
|
+
*/
|
|
15
|
+
type OnModalKitEnd = CommandKitModalBuilderOnEnd;
|
|
16
|
+
/**
|
|
17
|
+
* The handler to run when a modal is submitted. This handler is called with the interaction as the first argument.
|
|
18
|
+
* If the first argument is null, it means that the interaction collector has been destroyed.
|
|
19
|
+
*/
|
|
20
|
+
type CommandKitModalBuilderInteractionCollectorDispatch = (interaction: ModalSubmitInteraction, context: ModalKit) => Awaitable<void>;
|
|
21
|
+
type CommandKitModalBuilderOnEnd = (reason: string) => Awaitable<void>;
|
|
22
|
+
type CommandKitModalBuilderInteractionCollectorDispatchContextData = EventInterceptorContextData<Events.InteractionCreate>;
|
|
23
|
+
declare class ModalKit extends ModalBuilder {
|
|
24
|
+
#private;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the handler to run when the modal is submitted.
|
|
27
|
+
* @param handler - The handler to run when the modal is submitted.
|
|
28
|
+
* @param data - The context data for the interaction collector.
|
|
29
|
+
* @returns This instance of the modal builder.
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const modal = new ModalKit()
|
|
33
|
+
* .setTitle('My Modal')
|
|
34
|
+
* .setCustomId('my-modal')
|
|
35
|
+
* .filter((interaction) => interaction.user.id === '1234567890')
|
|
36
|
+
* .onSubmit(async (interaction) => {
|
|
37
|
+
* await interaction.reply('You submitted the modal!');
|
|
38
|
+
* })
|
|
39
|
+
* .addComponents(actionRow1, actionRow2);
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
onSubmit(handler: CommandKitModalBuilderInteractionCollectorDispatch, data?: CommandKitModalBuilderInteractionCollectorDispatchContextData): this;
|
|
43
|
+
/**
|
|
44
|
+
* Sets the handler to run when the interaction collector ends.
|
|
45
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
46
|
+
* @returns This instance of the modal builder.
|
|
47
|
+
*/
|
|
48
|
+
onEnd(handler: CommandKitModalBuilderOnEnd): this;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the handler to run when the interaction collector ends.
|
|
51
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
52
|
+
* @returns This instance of the modal builder.
|
|
53
|
+
*/
|
|
54
|
+
onError(handler: EventInterceptorErrorHandler): this;
|
|
55
|
+
/**
|
|
56
|
+
* Sets a filter for the interaction collector.
|
|
57
|
+
* @param predicate - The filter to use for the interaction collector.
|
|
58
|
+
* @returns This instance of the modal builder.
|
|
59
|
+
*/
|
|
60
|
+
filter(predicate: ModalKitPredicate): this;
|
|
61
|
+
private get customId();
|
|
62
|
+
dispose(): this;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { CommandKitModalBuilderInteractionCollectorDispatch, CommandKitModalBuilderInteractionCollectorDispatchContextData, CommandKitModalBuilderOnEnd, ModalKit, ModalKitPredicate, OnModalKitEnd, OnModalKitSubmit };
|
|
66
|
+
//# sourceMappingURL=ModalKit-CKtQ8eXW.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
const node_crypto = require_chunk.__toESM(require("node:crypto"));
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/PluginCommon.ts
|
|
5
|
+
let PluginType = /* @__PURE__ */ function(PluginType$1) {
|
|
6
|
+
PluginType$1["Compiler"] = "compiler";
|
|
7
|
+
PluginType$1["Runtime"] = "runtime";
|
|
8
|
+
return PluginType$1;
|
|
9
|
+
}({});
|
|
10
|
+
var PluginCommon = class {
|
|
11
|
+
id = (0, node_crypto.randomUUID)();
|
|
12
|
+
loadedAt = Date.now();
|
|
13
|
+
constructor(options) {
|
|
14
|
+
this.options = options;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Called when this plugin is activated
|
|
18
|
+
*/
|
|
19
|
+
async activate(ctx) {}
|
|
20
|
+
/**
|
|
21
|
+
* Called when this plugin is deactivated
|
|
22
|
+
*/
|
|
23
|
+
async deactivate(ctx) {}
|
|
24
|
+
};
|
|
25
|
+
function isPlugin(plugin) {
|
|
26
|
+
return plugin instanceof PluginCommon;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
Object.defineProperty(exports, 'PluginCommon', {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return PluginCommon;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, 'PluginType', {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return PluginType;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, 'isPlugin', {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return isPlugin;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=PluginCommon-DPqnQngK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginCommon-DPqnQngK.js","names":[],"sources":["../src/plugins/PluginCommon.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { CommonPluginRuntime } from './plugin-runtime/runtime';\n\nexport type PluginOptions = Record<string, any>;\n\nexport enum PluginType {\n Compiler = 'compiler',\n Runtime = 'runtime',\n}\n\nexport abstract class PluginCommon<\n T extends PluginOptions = PluginOptions,\n C extends CommonPluginRuntime = CommonPluginRuntime,\n> {\n public abstract readonly type: PluginType;\n public readonly id = randomUUID();\n public readonly loadedAt = Date.now();\n public abstract readonly name: string;\n public constructor(protected readonly options: T) {}\n\n /**\n * Called when this plugin is activated\n */\n public async activate(ctx: C): Promise<void> {}\n\n /**\n * Called when this plugin is deactivated\n */\n public async deactivate(ctx: C): Promise<void> {}\n}\n\nexport function isPlugin(\n plugin: unknown,\n): plugin is PluginCommon<PluginOptions> {\n return plugin instanceof PluginCommon;\n}\n"],"mappings":";;;;AAKA,IAAY,oDAAL;AACL;AACA;;AACF;AAEA,IAAsB,eAAtB,MAGA;CAEE,AAAgB,KAAK,6BAAY;CACjC,AAAgB,WAAW,KAAK,KAAK;CAErC,AAAO,YAA+B,SAAY;EAAZ;CAAa;;;;CAKnD,MAAa,SAAS,KAAuB,CAAC;;;;CAK9C,MAAa,WAAW,KAAuB,CAAC;AAClD;AAEA,SAAgB,SAChB,QACwC;AACtC,QAAO,kBAAkB;AAC3B"}
|
|
@@ -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 { RoleSelectMenuBuilder, RoleSelectMenuInteraction } from "discord.js";
|
|
4
|
+
|
|
5
|
+
//#region src/components/v1/select-menu/RoleSelectMenuKit.d.ts
|
|
6
|
+
type OnRoleSelectMenuKitSubmit = OnSelectMenuKitSubmit<RoleSelectMenuInteraction, RoleSelectMenuKit>;
|
|
7
|
+
type RoleSelectMenuKitPredicate = SelectMenuKitPredicate<RoleSelectMenuInteraction>;
|
|
8
|
+
declare class RoleSelectMenuKit extends RoleSelectMenuBuilder {
|
|
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 RoleSelectMenuKit()
|
|
18
|
+
* .setTitle('My Modal')
|
|
19
|
+
* .setCustomId('my-modal')
|
|
20
|
+
* .filter((interaction) => interaction.Role.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<RoleSelectMenuInteraction, RoleSelectMenuKit>, 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<RoleSelectMenuInteraction>): this;
|
|
46
|
+
private get customId();
|
|
47
|
+
dispose(): this;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { OnRoleSelectMenuKitSubmit, RoleSelectMenuKit, RoleSelectMenuKitPredicate };
|
|
51
|
+
//# sourceMappingURL=RoleSelectMenuKit-BSMKkru2.d.ts.map
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const require_PluginCommon = require('./PluginCommon-DPqnQngK.js');
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/RuntimePlugin.ts
|
|
4
|
+
var RuntimePlugin = class extends require_PluginCommon.PluginCommon {
|
|
5
|
+
type = require_PluginCommon.PluginType.Runtime;
|
|
6
|
+
/**
|
|
7
|
+
* Called before commands are loaded
|
|
8
|
+
*/
|
|
9
|
+
async onBeforeCommandsLoad(ctx) {}
|
|
10
|
+
/**
|
|
11
|
+
* Called after commands are loaded
|
|
12
|
+
*/
|
|
13
|
+
async onAfterCommandsLoad(ctx) {}
|
|
14
|
+
/**
|
|
15
|
+
* Called before events are loaded
|
|
16
|
+
*/
|
|
17
|
+
async onBeforeEventsLoad(ctx) {}
|
|
18
|
+
/**
|
|
19
|
+
* Called after events are loaded
|
|
20
|
+
*/
|
|
21
|
+
async onAfterEventsLoad(ctx) {}
|
|
22
|
+
/**
|
|
23
|
+
* Called before the client logs in
|
|
24
|
+
*/
|
|
25
|
+
async onBeforeClientLogin(ctx) {}
|
|
26
|
+
/**
|
|
27
|
+
* Called after the client logs in
|
|
28
|
+
*/
|
|
29
|
+
async onAfterClientLogin(ctx) {}
|
|
30
|
+
/**
|
|
31
|
+
* Called before interaction is handled
|
|
32
|
+
* @param interaction The interaction
|
|
33
|
+
*/
|
|
34
|
+
async onBeforeInteraction(ctx, interaction) {}
|
|
35
|
+
/**
|
|
36
|
+
* Called before message command is processed
|
|
37
|
+
* @param message The message
|
|
38
|
+
*/
|
|
39
|
+
async onBeforeMessageCommand(ctx, message) {}
|
|
40
|
+
/**
|
|
41
|
+
* Called before command is executed. This method can execute the command itself.
|
|
42
|
+
* @param source The source that triggered the command
|
|
43
|
+
* @param command The command
|
|
44
|
+
* @param execute The function that executes the command
|
|
45
|
+
*/
|
|
46
|
+
async executeCommand(ctx, env, source, command, execute) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Called after events router is initialized
|
|
51
|
+
* @param ctx The context
|
|
52
|
+
*/
|
|
53
|
+
async onEventsRouterInit(ctx) {}
|
|
54
|
+
/**
|
|
55
|
+
* Called after commands router is initialized
|
|
56
|
+
* @param ctx The context
|
|
57
|
+
*/
|
|
58
|
+
async onCommandsRouterInit(ctx) {}
|
|
59
|
+
/**
|
|
60
|
+
* Called when HMR event is received
|
|
61
|
+
* @param ctx The context
|
|
62
|
+
* @param event The event
|
|
63
|
+
*/
|
|
64
|
+
async performHMR(ctx, event) {}
|
|
65
|
+
/**
|
|
66
|
+
* Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.
|
|
67
|
+
* @param ctx The context
|
|
68
|
+
* @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command
|
|
69
|
+
*/
|
|
70
|
+
async prepareCommand(ctx, commands) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.
|
|
75
|
+
* @param ctx The context
|
|
76
|
+
* @param data The command registration data
|
|
77
|
+
*/
|
|
78
|
+
async onBeforeRegisterCommands(ctx, event) {}
|
|
79
|
+
/**
|
|
80
|
+
* Called before global commands registration. This method can cancel the registration of the command and handle it manually.
|
|
81
|
+
* This method is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
82
|
+
* @param ctx The context
|
|
83
|
+
* @param event The command registration data
|
|
84
|
+
*/
|
|
85
|
+
async onBeforeRegisterGlobalCommands(ctx, event) {}
|
|
86
|
+
/**
|
|
87
|
+
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
88
|
+
* This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.
|
|
89
|
+
* @param ctx The context
|
|
90
|
+
* @param event The command registration data
|
|
91
|
+
*/
|
|
92
|
+
async onBeforePrepareGuildCommandsRegistration(ctx, event) {}
|
|
93
|
+
/**
|
|
94
|
+
* Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
|
|
95
|
+
* This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.
|
|
96
|
+
* @param ctx The context
|
|
97
|
+
* @param event The command registration data
|
|
98
|
+
*/
|
|
99
|
+
async onBeforeRegisterGuildCommands(ctx, event) {}
|
|
100
|
+
/**
|
|
101
|
+
* Called after command and all of its deferred functions are executed.
|
|
102
|
+
* @param ctx The context
|
|
103
|
+
* @param env The environment of the command. This environment contains the command execution data such as command context and more.
|
|
104
|
+
*/
|
|
105
|
+
async onAfterCommand(ctx, env) {}
|
|
106
|
+
/**
|
|
107
|
+
* Called before emitting an event
|
|
108
|
+
* @param ctx The context
|
|
109
|
+
* @param event The event that is being emitted
|
|
110
|
+
*/
|
|
111
|
+
async willEmitEvent(ctx, event) {}
|
|
112
|
+
};
|
|
113
|
+
function isRuntimePlugin(plugin) {
|
|
114
|
+
return require_PluginCommon.isPlugin(plugin) && plugin.type === require_PluginCommon.PluginType.Runtime;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
Object.defineProperty(exports, 'RuntimePlugin', {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
get: function () {
|
|
121
|
+
return RuntimePlugin;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
Object.defineProperty(exports, 'isRuntimePlugin', {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function () {
|
|
127
|
+
return isRuntimePlugin;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
//# sourceMappingURL=RuntimePlugin-CKsd83M3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuntimePlugin-CKsd83M3.js","names":[],"sources":["../src/plugins/RuntimePlugin.ts"],"sourcesContent":["import { Interaction, Message } from 'discord.js';\nimport {\n isPlugin,\n PluginCommon,\n PluginOptions,\n PluginType,\n} from './PluginCommon';\nimport type { CommandKitPluginRuntime } from './plugin-runtime/CommandKitPluginRuntime';\nimport { CommandBuilderLike, PreparedAppCommandExecution } from '../app';\nimport { CommandKitEnvironment } from '../context/environment';\nimport { CommandKitHMREvent } from '../utils/dev-hooks';\nimport { PreRegisterCommandsEvent } from '../app/register/CommandRegistrar';\nimport { CommandKitEventDispatch } from './types';\n\nexport abstract class RuntimePlugin<\n T extends PluginOptions = PluginOptions,\n> extends PluginCommon<T, CommandKitPluginRuntime> {\n public readonly type = PluginType.Runtime;\n /**\n * Called before commands are loaded\n */\n public async onBeforeCommandsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after commands are loaded\n */\n public async onAfterCommandsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called before events are loaded\n */\n public async onBeforeEventsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after events are loaded\n */\n public async onAfterEventsLoad(ctx: CommandKitPluginRuntime): Promise<void> {}\n\n /**\n * Called before the client logs in\n */\n public async onBeforeClientLogin(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after the client logs in\n */\n public async onAfterClientLogin(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called before interaction is handled\n * @param interaction The interaction\n */\n public async onBeforeInteraction(\n ctx: CommandKitPluginRuntime,\n interaction: Interaction,\n ): Promise<void> {}\n\n /**\n * Called before message command is processed\n * @param message The message\n */\n public async onBeforeMessageCommand(\n ctx: CommandKitPluginRuntime,\n message: Message,\n ): Promise<void> {}\n\n /**\n * Called before command is executed. This method can execute the command itself.\n * @param source The source that triggered the command\n * @param command The command\n * @param execute The function that executes the command\n */\n public async executeCommand(\n ctx: CommandKitPluginRuntime,\n env: CommandKitEnvironment,\n source: Interaction | Message,\n command: PreparedAppCommandExecution,\n execute: () => Promise<any>,\n ): Promise<boolean> {\n return false;\n }\n\n /**\n * Called after events router is initialized\n * @param ctx The context\n */\n public async onEventsRouterInit(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after commands router is initialized\n * @param ctx The context\n */\n public async onCommandsRouterInit(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called when HMR event is received\n * @param ctx The context\n * @param event The event\n */\n public async performHMR(\n ctx: CommandKitPluginRuntime,\n event: CommandKitHMREvent,\n ): Promise<void> {}\n\n /**\n * Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.\n * @param ctx The context\n * @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command\n */\n async prepareCommand(\n ctx: CommandKitPluginRuntime,\n commands: CommandBuilderLike,\n ): Promise<CommandBuilderLike | null> {\n return null;\n }\n\n /**\n * Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.\n * @param ctx The context\n * @param data The command registration data\n */\n async onBeforeRegisterCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before global commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called after `onBeforeRegisterCommands` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforeRegisterGlobalCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforePrepareGuildCommandsRegistration(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforeRegisterGuildCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called after command and all of its deferred functions are executed.\n * @param ctx The context\n * @param env The environment of the command. This environment contains the command execution data such as command context and more.\n */\n async onAfterCommand(\n ctx: CommandKitPluginRuntime,\n env: CommandKitEnvironment,\n ) {}\n\n /**\n * Called before emitting an event\n * @param ctx The context\n * @param event The event that is being emitted\n */\n public async willEmitEvent(\n ctx: CommandKitPluginRuntime,\n event: CommandKitEventDispatch,\n ) {}\n}\n\nexport function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin {\n return isPlugin(plugin) && plugin.type === PluginType.Runtime;\n}\n"],"mappings":";;;AAcA,IAAsB,gBAAtB,cAEA,kCAAyC;CACvC,AAAgB,OAAO,gCAAW;;;;CAIlC,MAAa,qBACb,KACgB,CAAE;;;;CAKlB,MAAa,oBACb,KACgB,CAAE;;;;CAKlB,MAAa,mBACb,KACgB,CAAE;;;;CAKlB,MAAa,kBAAkB,KAA6C,CAAC;;;;CAK7E,MAAa,oBACb,KACgB,CAAE;;;;CAKlB,MAAa,mBACb,KACgB,CAAE;;;;;CAMlB,MAAa,oBACb,KACA,aACgB,CAAE;;;;;CAMlB,MAAa,uBACb,KACA,SACgB,CAAE;;;;;;;CAQlB,MAAa,eACb,KACA,KACA,QACA,SACA,SACmB;AACjB,SAAO;CACT;;;;;CAMA,MAAa,mBACb,KACgB,CAAE;;;;;CAMlB,MAAa,qBACb,KACgB,CAAE;;;;;;CAOlB,MAAa,WACb,KACA,OACgB,CAAE;;;;;;CAOlB,MAAM,eACN,KACA,UACqC;AACnC,SAAO;CACT;;;;;;CAOA,MAAM,yBACN,KACA,OACgB,CAAE;;;;;;;CAQlB,MAAM,+BACN,KACA,OACgB,CAAE;;;;;;;CAQlB,MAAM,yCACN,KACA,OACgB,CAAE;;;;;;;CAQlB,MAAM,8BACN,KACA,OACgB,CAAE;;;;;;CAOlB,MAAM,eACN,KACA,KACA,CAAE;;;;;;CAOF,MAAa,cACb,KACA,OACA,CAAE;AACJ;AAEA,SAAgB,gBAAgB,QAA0C;AACxE,QAAO,8BAAS,OAAO,IAAI,OAAO,SAAS,gCAAW;AACxD"}
|