commandkit 1.2.0-dev.20260228005229 → 1.2.0-dev.20260301010539
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-CT-uyxW0.d.ts → ActionRow-Bt9qi0Mb.d.ts} +2 -2
- package/dist/{Button-oMnlpF6W.d.ts → Button-DxJLcZIU.d.ts} +5 -5
- package/dist/{ButtonKit-DKu0VAe4.d.ts → ButtonKit-BfcyvWfj.d.ts} +35 -35
- package/dist/{ChannelSelectMenuKit-HQZ4hH5s.d.ts → ChannelSelectMenuKit-DYkudikb.d.ts} +33 -33
- package/dist/{CommandsRouter-C7dZEepB.d.ts → CommandsRouter-DiNoF0dq.d.ts} +48 -48
- package/dist/{EventInterceptor-CZmWpS08.d.ts → EventInterceptor-D9JKMcfi.d.ts} +39 -39
- package/dist/{EventsRouter-DZ37r54v.d.ts → EventsRouter-EuuSu6NH.d.ts} +34 -34
- package/dist/{MentionableSelectMenuKit-7URDUM3-.d.ts → MentionableSelectMenuKit-Mu4xqP6B.d.ts} +33 -33
- package/dist/MessageCommandParser-DPCbHXCS.d.ts +194 -0
- package/dist/{Modal--iMEUqSm.d.ts → Modal-v9rrcMl-.d.ts} +7 -7
- package/dist/{ModalKit-BWXI3Z26.d.ts → ModalKit-XJSM65SV.d.ts} +32 -32
- package/dist/{RoleSelectMenuKit-BY-JJ18w.d.ts → RoleSelectMenuKit-CCjcp3HY.d.ts} +33 -33
- package/dist/{SelectMenu-DQbmOp1Y.d.ts → SelectMenu-CY0vvoSu.d.ts} +8 -8
- package/dist/{StringSelectMenuKit-lVhUMc3g.d.ts → StringSelectMenuKit-G5nBTicX.d.ts} +33 -33
- package/dist/{UserSelectMenuKit-CCj4Fpkr.d.ts → UserSelectMenuKit-D3SO_fXA.d.ts} +33 -33
- package/dist/analytics/analytics-engine.d.ts +1 -1
- package/dist/analytics/analytics-engine.js +2 -19
- package/dist/analytics/analytics-provider.d.ts +1 -1
- package/dist/analytics/analytics-provider.js +1 -0
- package/dist/analytics/constants.js +26 -3
- package/dist/analytics/constants.js.map +1 -0
- package/dist/analytics/utils.js +2 -19
- package/dist/{analytics-engine-_urJ5QTH.d.ts → analytics-engine-DnRsHBId.d.ts} +843 -843
- package/dist/app/commands/AppCommandRunner.d.ts +1 -1
- package/dist/app/commands/AppCommandRunner.js +2 -19
- package/dist/app/commands/Context.d.ts +1 -1
- package/dist/app/commands/Context.js +2 -19
- package/dist/app/commands/MessageCommandParser.d.ts +1 -1
- package/dist/app/commands/MessageCommandParser.js +261 -3
- package/dist/app/commands/MessageCommandParser.js.map +1 -0
- package/dist/app/commands/helpers.d.ts +1 -1
- package/dist/app/commands/helpers.js +25 -3
- package/dist/app/commands/helpers.js.map +1 -0
- package/dist/app/events/EventWorkerContext.d.ts +2 -2
- package/dist/app/events/EventWorkerContext.js +48 -5
- package/dist/app/events/EventWorkerContext.js.map +1 -0
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
- package/dist/app/handlers/AppCommandHandler.js +2 -19
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
- package/dist/app/handlers/AppEventsHandler.js +2 -19
- package/dist/app/index.d.ts +4 -4
- package/dist/app/index.js +13 -27
- package/dist/app/interrupt/signals.d.ts +1 -1
- package/dist/app/interrupt/signals.js +54 -6
- package/dist/app/interrupt/signals.js.map +1 -0
- package/dist/app/middlewares/permissions.d.ts +1 -1
- package/dist/app/middlewares/permissions.js +2 -19
- package/dist/app/register/CommandRegistrar.d.ts +1 -1
- package/dist/app/register/CommandRegistrar.js +2 -19
- package/dist/app/router/CommandsRouter.d.ts +1 -1
- package/dist/app/router/CommandsRouter.js +210 -2
- package/dist/app/router/CommandsRouter.js.map +1 -0
- package/dist/app/router/EventsRouter.d.ts +1 -1
- package/dist/app/router/EventsRouter.js +128 -2
- package/dist/app/router/EventsRouter.js.map +1 -0
- package/dist/app/router/index.d.ts +2 -2
- package/dist/app/router/index.js +5 -5
- package/dist/{chunk-kSYXY2_d.js → chunk-BE-pF4vm.js} +1 -1
- package/dist/cli/app-process.d.ts +2 -2
- package/dist/cli/app-process.js +6 -8
- package/dist/cli/app-process.js.map +1 -1
- package/dist/cli/build.d.ts +2 -2
- package/dist/cli/build.js +14 -29
- package/dist/cli/build.js.map +1 -1
- package/dist/cli/common.d.ts +5 -5
- package/dist/cli/common.js +182 -12
- package/dist/cli/common.js.map +1 -0
- package/dist/cli/development.d.ts +3 -3
- package/dist/cli/development.js +38 -54
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.js +73 -9
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/generators.js +10 -10
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.js +9 -8
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.d.ts +2 -2
- package/dist/cli/init.js +14 -28
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/production.d.ts +2 -2
- package/dist/cli/production.js +11 -28
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.js +83 -6
- package/dist/cli/type-checker.js.map +1 -0
- package/dist/cli/utils.js +1 -0
- package/dist/cli/utils.js.map +1 -1
- package/dist/{commandkit-B1_NP74k.js → commandkit--k6yDJEr.js} +192 -192
- package/dist/{commandkit-B1_NP74k.js.map → commandkit--k6yDJEr.js.map} +1 -1
- package/dist/commandkit.d.ts +1 -1
- package/dist/commandkit.js +2 -19
- package/dist/{common-DnwCYit8.d.ts → common-CCvvgnxi.d.ts} +2 -2
- package/dist/components/common/EventInterceptor.d.ts +1 -1
- package/dist/components/common/EventInterceptor.js +137 -2
- package/dist/components/common/EventInterceptor.js.map +1 -0
- package/dist/components/common/element.d.ts +1 -1
- package/dist/components/common/element.js +2 -19
- package/dist/components/common/types.d.ts +1 -1
- package/dist/components/common/types.js +1 -0
- package/dist/components/display/common.js +2 -19
- package/dist/components/display/container.d.ts +1 -1
- package/dist/components/display/container.js +2 -19
- package/dist/components/display/file.d.ts +1 -1
- package/dist/components/display/file.js +23 -2
- package/dist/components/display/file.js.map +1 -0
- package/dist/components/display/index.d.ts +8 -8
- package/dist/components/display/index.js +12 -25
- package/dist/components/display/label.d.ts +1 -1
- package/dist/components/display/label.js +2 -19
- package/dist/components/display/media-gallery.d.ts +1 -1
- package/dist/components/display/media-gallery.js +2 -19
- package/dist/components/display/poll.d.ts +1 -1
- package/dist/components/display/poll.js +85 -4
- package/dist/{poll-ziQQQbMU.js.map → components/display/poll.js.map} +1 -1
- package/dist/components/display/section.d.ts +1 -1
- package/dist/components/display/section.js +2 -19
- package/dist/components/display/separator.d.ts +1 -1
- package/dist/components/display/separator.js +21 -2
- package/dist/components/display/separator.js.map +1 -0
- package/dist/components/display/text-display.d.ts +1 -1
- package/dist/components/display/text-display.js +26 -2
- package/dist/components/display/text-display.js.map +1 -0
- package/dist/components/index.d.ts +22 -22
- package/dist/components/index.js +14 -26
- package/dist/components/interactive/action-row/ActionRow.d.ts +1 -1
- package/dist/components/interactive/action-row/ActionRow.js +20 -2
- package/dist/{ActionRow-CSN_UKmM.js.map → components/interactive/action-row/ActionRow.js.map} +1 -1
- package/dist/components/interactive/button/Button.d.ts +1 -1
- package/dist/components/interactive/button/Button.js +2 -19
- package/dist/components/interactive/button/ButtonKit.d.ts +1 -1
- package/dist/components/interactive/button/ButtonKit.js +2 -19
- package/dist/components/interactive/modal/Modal.d.ts +1 -1
- package/dist/components/interactive/modal/Modal.js +2 -19
- package/dist/components/interactive/modal/ModalKit.d.ts +1 -1
- package/dist/components/interactive/modal/ModalKit.js +2 -19
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +2 -19
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +2 -19
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +2 -19
- package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -1
- package/dist/components/interactive/select-menu/SelectMenu.js +2 -19
- package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/StringSelectMenuKit.js +2 -19
- package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/UserSelectMenuKit.js +2 -19
- package/dist/components/interactive/select-menu/common.d.ts +1 -1
- package/dist/components/interactive/select-menu/common.js +1 -0
- package/dist/config/config.d.ts +1 -1
- package/dist/config/config.js +2 -19
- package/dist/config/default.d.ts +1 -1
- package/dist/config/default.js +2 -19
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.js +2 -19
- package/dist/config/types.d.ts +1 -1
- package/dist/config/types.js +1 -0
- package/dist/config/utils.d.ts +1 -1
- package/dist/config/utils.js +29 -2
- package/dist/config/utils.js.map +1 -0
- package/dist/{constants-EpKcj0dH.d.ts → constants-DqtJY0t-.d.ts} +2 -2
- package/dist/{constants-CuYW0K10.d.ts → constants-DwxpkIeH.d.ts} +7 -7
- package/dist/{container-DYcb7zGw.d.ts → container-CYojOA9d.d.ts} +1 -1
- package/dist/context/async-context.d.ts +1 -1
- package/dist/context/async-context.js +2 -19
- package/dist/context/environment.d.ts +1 -1
- package/dist/context/environment.js +2 -19
- package/dist/{element-DZeqbSTk.d.ts → element-DeLvTMfZ.d.ts} +3 -3
- package/dist/events/CommandKitEventsChannel.d.ts +1 -1
- package/dist/events/CommandKitEventsChannel.js +83 -2
- package/dist/events/CommandKitEventsChannel.js.map +1 -0
- package/dist/{file-CrV4lSnl.d.ts → file-DLO1zEcH.d.ts} +1 -1
- package/dist/flags/FlagProvider.d.ts +1 -1
- package/dist/flags/FlagProvider.js +1 -0
- package/dist/flags/FlagProvider.js.map +1 -1
- package/dist/flags/feature-flags.d.ts +1 -1
- package/dist/flags/feature-flags.js +2 -19
- package/dist/flags/store.d.ts +1 -1
- package/dist/flags/store.js +13 -2
- package/dist/flags/store.js.map +1 -0
- package/dist/{helpers-AQPLVY35.d.ts → helpers-zmC44Mcu.d.ts} +1 -1
- package/dist/index.d.ts +30 -30
- package/dist/index.js +61 -67
- package/dist/kv/constants.d.ts +1 -1
- package/dist/kv/constants.js +22 -2
- package/dist/kv/constants.js.map +1 -0
- package/dist/kv/dotprops.js +1 -0
- package/dist/kv/dotprops.js.map +1 -1
- package/dist/kv/kv.d.ts +288 -288
- package/dist/kv/kv.js +2 -1
- package/dist/kv/kv.js.map +1 -1
- package/dist/kv/serde.d.ts +1 -1
- package/dist/kv/serde.js +29 -28
- package/dist/kv/serde.js.map +1 -1
- package/dist/{label-37kaNWMH.d.ts → label-DqGRqodo.d.ts} +3 -3
- package/dist/logger/DefaultLogger.d.ts +19 -19
- package/dist/logger/DefaultLogger.js +2 -19
- package/dist/logger/ILogger.d.ts +35 -35
- package/dist/logger/ILogger.js +1 -0
- package/dist/logger/Logger.d.ts +5 -5
- package/dist/logger/Logger.js +2 -19
- package/dist/logger/NoopLogger.d.ts +35 -35
- package/dist/logger/NoopLogger.js +1 -0
- package/dist/logger/NoopLogger.js.map +1 -1
- package/dist/{media-gallery-Ci3I4ElH.d.ts → media-gallery-Ca8es-eB.d.ts} +1 -1
- package/dist/plugins/CompilerPlugin.d.ts +1 -1
- package/dist/plugins/CompilerPlugin.js +33 -3
- package/dist/plugins/CompilerPlugin.js.map +1 -0
- package/dist/plugins/PluginCommon.d.ts +1 -1
- package/dist/plugins/PluginCommon.js +55 -4
- package/dist/plugins/PluginCommon.js.map +1 -0
- package/dist/plugins/RuntimePlugin.d.ts +1 -1
- package/dist/plugins/RuntimePlugin.js +124 -3
- package/dist/plugins/RuntimePlugin.js.map +1 -0
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +8 -25
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +2 -19
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +2 -19
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +2 -19
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +2 -19
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/runtime.js +1 -0
- package/dist/plugins/types.d.ts +1 -1
- package/dist/plugins/types.js +1 -0
- package/dist/{poll-Ddtapd6n.d.ts → poll-DQ6DX_Tt.d.ts} +8 -8
- package/dist/{section-DkUKULnB.d.ts → section-Q8nwx_-q.d.ts} +1 -1
- package/dist/{separator-CbXsIFCa.d.ts → separator-B8P-kdIK.d.ts} +1 -1
- package/dist/{signals-BbTgTc0i.d.ts → signals-CBXwugBW.d.ts} +1 -1
- package/dist/{text-display-D7j39VC-.d.ts → text-display-CL9C2yMc.d.ts} +1 -1
- package/dist/{types-BywA9d2Z.d.ts → types-DZy7U-Ld.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -0
- package/dist/utils/colors.js +9 -3
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +50 -8
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/dev-hooks.d.ts +1 -1
- package/dist/utils/dev-hooks.js +2 -19
- package/dist/utils/error-codes.d.ts +10 -10
- package/dist/utils/error-codes.js +53 -5
- package/dist/utils/error-codes.js.map +1 -0
- package/dist/utils/resolve-file-url.js +18 -2
- package/dist/utils/resolve-file-url.js.map +1 -0
- package/dist/utils/types-package.js +61 -4
- package/dist/utils/types-package.js.map +1 -0
- package/dist/utils/useful-stuff/async-queue.d.ts +21 -21
- package/dist/utils/useful-stuff/async-queue.js +1 -0
- package/dist/utils/useful-stuff/async-queue.js.map +1 -1
- package/dist/utils/useful-stuff/mutex.d.ts +62 -62
- package/dist/utils/useful-stuff/mutex.js +1 -0
- package/dist/utils/useful-stuff/mutex.js.map +1 -1
- package/dist/utils/useful-stuff/ratelimiter.d.ts +56 -56
- package/dist/utils/useful-stuff/ratelimiter.js +1 -0
- package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
- package/dist/utils/useful-stuff/semaphore.d.ts +82 -82
- package/dist/utils/useful-stuff/semaphore.js +1 -0
- package/dist/utils/useful-stuff/semaphore.js.map +1 -1
- package/dist/utils/utilities.d.ts +5 -5
- package/dist/utils/utilities.js +2 -19
- package/dist/utils/warning.js +38 -4
- package/dist/utils/warning.js.map +1 -0
- package/dist/version.js +13 -2
- package/dist/version.js.map +1 -0
- package/package.json +11 -14
- package/dist/ActionRow-CSN_UKmM.js +0 -25
- package/dist/CommandKitEventsChannel-DDI0UVh9.js +0 -88
- package/dist/CommandKitEventsChannel-DDI0UVh9.js.map +0 -1
- package/dist/CommandsRouter-D5mGRFEr.js +0 -215
- package/dist/CommandsRouter-D5mGRFEr.js.map +0 -1
- package/dist/CompilerPlugin-DZidFuHJ.js +0 -43
- package/dist/CompilerPlugin-DZidFuHJ.js.map +0 -1
- package/dist/EventInterceptor-CxA95XYA.js +0 -142
- package/dist/EventInterceptor-CxA95XYA.js.map +0 -1
- package/dist/EventWorkerContext-CfqamFWu.js +0 -68
- package/dist/EventWorkerContext-CfqamFWu.js.map +0 -1
- package/dist/EventsRouter-Be5NDOX4.js +0 -133
- package/dist/EventsRouter-Be5NDOX4.js.map +0 -1
- package/dist/ILogger-JI8VGyJf.js +0 -0
- package/dist/MessageCommandParser-VMFFGs0R.js +0 -271
- package/dist/MessageCommandParser-VMFFGs0R.js.map +0 -1
- package/dist/MessageCommandParser-q3dQcE5N.d.ts +0 -194
- package/dist/PluginCommon-Bfs8d9s7.js +0 -70
- package/dist/PluginCommon-Bfs8d9s7.js.map +0 -1
- package/dist/RuntimePlugin-BYQXQO8w.js +0 -134
- package/dist/RuntimePlugin-BYQXQO8w.js.map +0 -1
- package/dist/colors-Csc0X4QJ.js +0 -14
- package/dist/colors-Csc0X4QJ.js.map +0 -1
- package/dist/common-vGj3fpz3.js +0 -0
- package/dist/common-zQwj90Nz.js +0 -222
- package/dist/common-zQwj90Nz.js.map +0 -1
- package/dist/constants-BA0TJU6e.js +0 -36
- package/dist/constants-BA0TJU6e.js.map +0 -1
- package/dist/constants-BS9N2avz.js +0 -27
- package/dist/constants-BS9N2avz.js.map +0 -1
- package/dist/constants-CeIMhMD0.js +0 -85
- package/dist/constants-CeIMhMD0.js.map +0 -1
- package/dist/env-FxaiNasU.js +0 -113
- package/dist/env-FxaiNasU.js.map +0 -1
- package/dist/error-codes-Ds0bnPvT.js +0 -73
- package/dist/error-codes-Ds0bnPvT.js.map +0 -1
- package/dist/file-DqI3v90P.js +0 -28
- package/dist/file-DqI3v90P.js.map +0 -1
- package/dist/helpers-DSy7EjzP.js +0 -35
- package/dist/helpers-DSy7EjzP.js.map +0 -1
- package/dist/poll-ziQQQbMU.js +0 -100
- package/dist/resolve-file-url-BmjHzIKe.js +0 -23
- package/dist/resolve-file-url-BmjHzIKe.js.map +0 -1
- package/dist/router-CtcApqrw.js +0 -0
- package/dist/runtime-UJIpkNww.js +0 -0
- package/dist/separator-DGwA_b1J.js +0 -26
- package/dist/separator-DGwA_b1J.js.map +0 -1
- package/dist/signals-ewEPW2cO.js +0 -74
- package/dist/signals-ewEPW2cO.js.map +0 -1
- package/dist/store-DK4JA-fQ.js +0 -18
- package/dist/store-DK4JA-fQ.js.map +0 -1
- package/dist/text-display-BVuG7dT-.js +0 -31
- package/dist/text-display-BVuG7dT-.js.map +0 -1
- package/dist/type-checker-CFpKDDs8.js +0 -88
- package/dist/type-checker-CFpKDDs8.js.map +0 -1
- package/dist/types-Bx1EKe0v.js +0 -0
- package/dist/types-CAwOz52q.js +0 -0
- package/dist/types-package-Bjh_ap0V.js +0 -71
- package/dist/types-package-Bjh_ap0V.js.map +0 -1
- package/dist/utils-CVaVycsK.js +0 -34
- package/dist/utils-CVaVycsK.js.map +0 -1
- package/dist/version-DJ8LkIWx.js +0 -18
- package/dist/version-DJ8LkIWx.js.map +0 -1
- package/dist/warning-BWiQltHE.js +0 -53
- package/dist/warning-BWiQltHE.js.map +0 -1
- /package/dist/{index-BJfko-dP.d.ts → index-BIsCUWAs.d.ts} +0 -0
- /package/dist/{index-CCggO_hw.d.ts → index-CwHYpK-f.d.ts} +0 -0
- /package/dist/{index-CLjpoGi1.d.ts → index-DHrsNvX1.d.ts} +0 -0
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
1
|
+
const require_chunk = require('./chunk-BE-pF4vm.js');
|
|
2
|
+
const require_utils_colors = require('./utils/colors.js');
|
|
3
|
+
const require_utils_error_codes = require('./utils/error-codes.js');
|
|
4
|
+
const require_plugins_CompilerPlugin = require('./plugins/CompilerPlugin.js');
|
|
5
|
+
const require_plugins_RuntimePlugin = require('./plugins/RuntimePlugin.js');
|
|
6
|
+
const require_utils_constants = require('./utils/constants.js');
|
|
7
|
+
const require_utils_resolve_file_url = require('./utils/resolve-file-url.js');
|
|
8
|
+
const require_config_utils = require('./config/utils.js');
|
|
9
|
+
const require_utils_warning = require('./utils/warning.js');
|
|
10
|
+
const require_components_common_EventInterceptor = require('./components/common/EventInterceptor.js');
|
|
11
|
+
const require_utils_types_package = require('./utils/types-package.js');
|
|
12
|
+
const require_analytics_constants = require('./analytics/constants.js');
|
|
13
|
+
const require_app_events_EventWorkerContext = require('./app/events/EventWorkerContext.js');
|
|
14
|
+
const require_app_interrupt_signals = require('./app/interrupt/signals.js');
|
|
15
|
+
const require_app_commands_helpers = require('./app/commands/helpers.js');
|
|
16
|
+
const require_app_commands_MessageCommandParser = require('./app/commands/MessageCommandParser.js');
|
|
17
|
+
const require_app_router_CommandsRouter = require('./app/router/CommandsRouter.js');
|
|
18
|
+
const require_app_router_EventsRouter = require('./app/router/EventsRouter.js');
|
|
19
|
+
const require_cli_common = require('./cli/common.js');
|
|
20
|
+
const require_events_CommandKitEventsChannel = require('./events/CommandKitEventsChannel.js');
|
|
21
|
+
const require_flags_store = require('./flags/store.js');
|
|
22
22
|
let node_events = require("node:events");
|
|
23
23
|
node_events = require_chunk.__toESM(node_events);
|
|
24
24
|
let discord_js = require("discord.js");
|
|
@@ -65,7 +65,7 @@ function makeContextAwareFunction(env, fn, finalizer) {
|
|
|
65
65
|
try {
|
|
66
66
|
return await fn(...args);
|
|
67
67
|
} catch (e) {
|
|
68
|
-
if (!
|
|
68
|
+
if (!require_utils_error_codes.isCommandKitError(e)) env.setExecutionError(e);
|
|
69
69
|
else throw e;
|
|
70
70
|
} finally {
|
|
71
71
|
if (typeof finalizer === "function") setImmediate(async () => {
|
|
@@ -405,18 +405,18 @@ const execHandlerKind = {
|
|
|
405
405
|
message: "Message"
|
|
406
406
|
};
|
|
407
407
|
const TextColorMap = {
|
|
408
|
-
[LogLevel.DEBUG]:
|
|
409
|
-
[LogLevel.INFO]:
|
|
410
|
-
[LogLevel.WARN]:
|
|
411
|
-
[LogLevel.ERROR]:
|
|
412
|
-
[LogLevel.DEFAULT]:
|
|
408
|
+
[LogLevel.DEBUG]: require_utils_colors.default.blue,
|
|
409
|
+
[LogLevel.INFO]: require_utils_colors.default.green,
|
|
410
|
+
[LogLevel.WARN]: require_utils_colors.default.yellow,
|
|
411
|
+
[LogLevel.ERROR]: require_utils_colors.default.red,
|
|
412
|
+
[LogLevel.DEFAULT]: require_utils_colors.default.white
|
|
413
413
|
};
|
|
414
414
|
const TextBgColorMap = {
|
|
415
|
-
[LogLevel.DEBUG]:
|
|
416
|
-
[LogLevel.INFO]:
|
|
417
|
-
[LogLevel.WARN]:
|
|
418
|
-
[LogLevel.ERROR]:
|
|
419
|
-
[LogLevel.DEFAULT]:
|
|
415
|
+
[LogLevel.DEBUG]: require_utils_colors.default.bgBlue,
|
|
416
|
+
[LogLevel.INFO]: require_utils_colors.default.bgGreen,
|
|
417
|
+
[LogLevel.WARN]: require_utils_colors.default.bgYellow,
|
|
418
|
+
[LogLevel.ERROR]: require_utils_colors.default.bgRed,
|
|
419
|
+
[LogLevel.DEFAULT]: require_utils_colors.default.bgWhite
|
|
420
420
|
};
|
|
421
421
|
const BoxChars = {
|
|
422
422
|
vertical: "│",
|
|
@@ -455,9 +455,9 @@ var DefaultLogger = class {
|
|
|
455
455
|
if (!h && !commandHandler) return "";
|
|
456
456
|
const forwardedBy = ctx.variables.get("forwardedBy");
|
|
457
457
|
const forwardedTo = ctx.variables.get("forwardedTo");
|
|
458
|
-
const cmdText = command ?
|
|
459
|
-
const forward = forwardedTo ? `${
|
|
460
|
-
return
|
|
458
|
+
const cmdText = command ? require_utils_colors.default.magenta(`/${command}`) + " " : "";
|
|
459
|
+
const forward = forwardedTo ? `${require_utils_colors.default.yellowBright(`(${forwardedBy || command} → ${forwardedTo})`)} ` : "";
|
|
460
|
+
return require_utils_colors.default.dim(`${BoxChars.vertical} `) + require_utils_colors.default.cyanBright(`${cmdText}${forward}${h ? require_utils_colors.default.gray(`[${h}]`) : ""}`.trim());
|
|
461
461
|
}
|
|
462
462
|
_getLevelLabel(level) {
|
|
463
463
|
let label;
|
|
@@ -476,24 +476,24 @@ var DefaultLogger = class {
|
|
|
476
476
|
break;
|
|
477
477
|
default: label = "[LOG]";
|
|
478
478
|
}
|
|
479
|
-
return `${TextBgColorMap[level](
|
|
479
|
+
return `${TextBgColorMap[level](require_utils_colors.default.whiteBright(` ${label} `))} `;
|
|
480
480
|
}
|
|
481
481
|
_getPrefix(level) {
|
|
482
482
|
const timestamp = this._formatTime(/* @__PURE__ */ new Date());
|
|
483
|
-
return `${this._getLevelLabel(level)}${
|
|
483
|
+
return `${this._getLevelLabel(level)}${require_utils_colors.default.dim(BoxChars.vertical)} ${require_utils_colors.default.dim(timestamp)}`;
|
|
484
484
|
}
|
|
485
485
|
_log(level, message) {
|
|
486
486
|
const prefix = this._getPrefix(level);
|
|
487
|
-
const context
|
|
487
|
+
const context = this._getContext();
|
|
488
488
|
const colorFn = TextColorMap[level];
|
|
489
489
|
let processedMessage = message;
|
|
490
490
|
if (message instanceof Error) processedMessage = `${message.message}\n${message.stack}`;
|
|
491
|
-
if (context
|
|
492
|
-
else this.logger.log(`${prefix} ${
|
|
491
|
+
if (context) this.logger.log(`${prefix}\n${context} ${require_utils_colors.default.dim(BoxChars.corner)}`, colorFn(processedMessage));
|
|
492
|
+
else this.logger.log(`${prefix} ${require_utils_colors.default.dim(BoxChars.corner)}`, colorFn(processedMessage));
|
|
493
493
|
}
|
|
494
494
|
_logTemplate(level, strings, ...values) {
|
|
495
495
|
const prefix = this._getPrefix(level);
|
|
496
|
-
const context
|
|
496
|
+
const context = this._getContext();
|
|
497
497
|
const colorFn = TextColorMap[level];
|
|
498
498
|
let result = "";
|
|
499
499
|
for (let i = 0; i < strings.length; i++) {
|
|
@@ -508,8 +508,8 @@ var DefaultLogger = class {
|
|
|
508
508
|
else result += value;
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
if (context
|
|
512
|
-
else this.logger.log(`${prefix} ${
|
|
511
|
+
if (context) this.logger.log(`${prefix}\n${context} ${require_utils_colors.default.dim(BoxChars.corner)}`, colorFn(result));
|
|
512
|
+
else this.logger.log(`${prefix} ${require_utils_colors.default.dim(BoxChars.corner)}`, colorFn(result));
|
|
513
513
|
}
|
|
514
514
|
debug(messageOrStrings, ...values) {
|
|
515
515
|
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(LogLevel.DEBUG, messageOrStrings, ...values);
|
|
@@ -553,8 +553,8 @@ function createLogger(options) {
|
|
|
553
553
|
"info",
|
|
554
554
|
"debug"
|
|
555
555
|
];
|
|
556
|
-
const impl = { configure(options
|
|
557
|
-
opt = options
|
|
556
|
+
const impl = { configure(options) {
|
|
557
|
+
opt = options;
|
|
558
558
|
} };
|
|
559
559
|
for (const method of methods) impl[method] = (...message) => {
|
|
560
560
|
opt.provider[method](...message);
|
|
@@ -572,8 +572,8 @@ const Logger = createLogger({ provider: new DefaultLogger() });
|
|
|
572
572
|
let appDir = null;
|
|
573
573
|
let currentDir = null;
|
|
574
574
|
function getSrcDir() {
|
|
575
|
-
if (
|
|
576
|
-
if (
|
|
575
|
+
if (require_utils_constants.COMMANDKIT_IS_CLI) return "src";
|
|
576
|
+
if (require_utils_constants.COMMANDKIT_IS_DEV) return ".commandkit";
|
|
577
577
|
return getConfig().distDir;
|
|
578
578
|
}
|
|
579
579
|
/**
|
|
@@ -582,8 +582,8 @@ function getSrcDir() {
|
|
|
582
582
|
*/
|
|
583
583
|
function getCurrentDirectory() {
|
|
584
584
|
if (currentDir) return currentDir;
|
|
585
|
-
let root = (0, node_path.join)(
|
|
586
|
-
if (!(0, node_fs.existsSync)(root)) root =
|
|
585
|
+
let root = (0, node_path.join)(require_utils_constants.COMMANDKIT_CWD, getSrcDir());
|
|
586
|
+
if (!(0, node_fs.existsSync)(root)) root = require_utils_constants.COMMANDKIT_CWD;
|
|
587
587
|
currentDir = root;
|
|
588
588
|
return root;
|
|
589
589
|
}
|
|
@@ -597,7 +597,7 @@ function getSourceDirectories() {
|
|
|
597
597
|
"src",
|
|
598
598
|
".commandkit",
|
|
599
599
|
getConfig().distDir
|
|
600
|
-
].map((dir) => (0, node_path.join)(
|
|
600
|
+
].map((dir) => (0, node_path.join)(require_utils_constants.COMMANDKIT_CWD, dir));
|
|
601
601
|
}
|
|
602
602
|
/**
|
|
603
603
|
* Returns the path to the app directory.
|
|
@@ -605,8 +605,8 @@ function getSourceDirectories() {
|
|
|
605
605
|
*/
|
|
606
606
|
function findAppDirectory() {
|
|
607
607
|
if (appDir) return appDir;
|
|
608
|
-
let root = (0, node_path.join)(
|
|
609
|
-
if (!(0, node_fs.existsSync)(root)) root =
|
|
608
|
+
let root = (0, node_path.join)(require_utils_constants.COMMANDKIT_CWD, getSrcDir());
|
|
609
|
+
if (!(0, node_fs.existsSync)(root)) root = require_utils_constants.COMMANDKIT_CWD;
|
|
610
610
|
const dirs = ["app"].map((dir) => (0, node_path.join)(root, dir));
|
|
611
611
|
for (const dir of dirs) if ((0, node_fs.existsSync)(dir)) {
|
|
612
612
|
appDir = dir;
|
|
@@ -689,7 +689,7 @@ function JsonSerialize(value, defaultValue = {}) {
|
|
|
689
689
|
*/
|
|
690
690
|
function devOnly(fn) {
|
|
691
691
|
const f = (...args) => {
|
|
692
|
-
if (
|
|
692
|
+
if (require_utils_constants.COMMANDKIT_IS_DEV) return fn(...args);
|
|
693
693
|
};
|
|
694
694
|
return f;
|
|
695
695
|
}
|
|
@@ -707,7 +707,7 @@ function devOnly(fn) {
|
|
|
707
707
|
*/
|
|
708
708
|
function buildOnly(fn) {
|
|
709
709
|
const f = (...args) => {
|
|
710
|
-
if (
|
|
710
|
+
if (require_utils_constants.isBuildLikeEnvironment()) return fn(...args);
|
|
711
711
|
};
|
|
712
712
|
return f;
|
|
713
713
|
}
|
|
@@ -725,7 +725,7 @@ function buildOnly(fn) {
|
|
|
725
725
|
*/
|
|
726
726
|
function noBuildOnly(fn) {
|
|
727
727
|
const f = (...args) => {
|
|
728
|
-
if (!
|
|
728
|
+
if (!require_utils_constants.isBuildLikeEnvironment()) return fn(...args);
|
|
729
729
|
};
|
|
730
730
|
return f;
|
|
731
731
|
}
|
|
@@ -738,43 +738,43 @@ function createProxy(target) {
|
|
|
738
738
|
let _target = target;
|
|
739
739
|
return {
|
|
740
740
|
proxy: new Proxy(_target, {
|
|
741
|
-
get(target
|
|
741
|
+
get(target, prop, receiver) {
|
|
742
742
|
return Reflect.get(_target, prop, receiver);
|
|
743
743
|
},
|
|
744
|
-
set(target
|
|
744
|
+
set(target, prop, value, receiver) {
|
|
745
745
|
return Reflect.set(_target, prop, value, receiver);
|
|
746
746
|
},
|
|
747
|
-
deleteProperty(target
|
|
747
|
+
deleteProperty(target, prop) {
|
|
748
748
|
return Reflect.deleteProperty(_target, prop);
|
|
749
749
|
},
|
|
750
|
-
has(target
|
|
750
|
+
has(target, prop) {
|
|
751
751
|
return Reflect.has(_target, prop);
|
|
752
752
|
},
|
|
753
|
-
ownKeys(target
|
|
753
|
+
ownKeys(target) {
|
|
754
754
|
return Reflect.ownKeys(_target);
|
|
755
755
|
},
|
|
756
|
-
getOwnPropertyDescriptor(target
|
|
756
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
757
757
|
return Reflect.getOwnPropertyDescriptor(_target, prop);
|
|
758
758
|
},
|
|
759
|
-
defineProperty(target
|
|
759
|
+
defineProperty(target, prop, attributes) {
|
|
760
760
|
return Reflect.defineProperty(_target, prop, attributes);
|
|
761
761
|
},
|
|
762
|
-
getPrototypeOf(target
|
|
762
|
+
getPrototypeOf(target) {
|
|
763
763
|
return Reflect.getPrototypeOf(_target);
|
|
764
764
|
},
|
|
765
|
-
setPrototypeOf(target
|
|
765
|
+
setPrototypeOf(target, proto) {
|
|
766
766
|
return Reflect.setPrototypeOf(_target, proto);
|
|
767
767
|
},
|
|
768
|
-
isExtensible(target
|
|
768
|
+
isExtensible(target) {
|
|
769
769
|
return Reflect.isExtensible(_target);
|
|
770
770
|
},
|
|
771
|
-
preventExtensions(target
|
|
771
|
+
preventExtensions(target) {
|
|
772
772
|
return Reflect.preventExtensions(_target);
|
|
773
773
|
},
|
|
774
|
-
apply(target
|
|
774
|
+
apply(target, thisArg, args) {
|
|
775
775
|
return Reflect.apply(_target, thisArg, args);
|
|
776
776
|
},
|
|
777
|
-
construct(target
|
|
777
|
+
construct(target, args, newTarget) {
|
|
778
778
|
return Reflect.construct(_target, args, newTarget);
|
|
779
779
|
}
|
|
780
780
|
}),
|
|
@@ -795,8 +795,8 @@ var CommandKitPluginRuntime = class {
|
|
|
795
795
|
* Creates a new instance of CommandKitPluginRuntime.
|
|
796
796
|
* @param commandkit The CommandKit instance associated with this runtime.
|
|
797
797
|
*/
|
|
798
|
-
constructor(commandkit
|
|
799
|
-
this.commandkit = commandkit
|
|
798
|
+
constructor(commandkit) {
|
|
799
|
+
this.commandkit = commandkit;
|
|
800
800
|
}
|
|
801
801
|
/**
|
|
802
802
|
* Returns the plugins registered in this runtime.
|
|
@@ -825,7 +825,7 @@ var CommandKitPluginRuntime = class {
|
|
|
825
825
|
* @param plugin The plugin to pre-load.
|
|
826
826
|
*/
|
|
827
827
|
async preload(plugin) {
|
|
828
|
-
for (const entrypoint of plugin.preload) await (entrypoint.startsWith("module:") ? import(entrypoint.slice(7)) : import(
|
|
828
|
+
for (const entrypoint of plugin.preload) await (entrypoint.startsWith("module:") ? import(entrypoint.slice(7)) : import(require_utils_resolve_file_url.toFileURL(`${getCurrentDirectory()}/${entrypoint}`)));
|
|
829
829
|
}
|
|
830
830
|
/**
|
|
831
831
|
* Soft registers a plugin in the runtime.
|
|
@@ -885,7 +885,7 @@ var CommandKitPluginRuntime = class {
|
|
|
885
885
|
* Signals the runtime to allow the current plugin take ownership of the execution context.
|
|
886
886
|
*/
|
|
887
887
|
capture() {
|
|
888
|
-
throw
|
|
888
|
+
throw require_utils_error_codes.createCommandKitError(require_utils_error_codes.CommandKitErrorCodes.PluginCaptureHandle);
|
|
889
889
|
}
|
|
890
890
|
/**
|
|
891
891
|
* Executes a function for each plugin in the runtime.
|
|
@@ -897,7 +897,7 @@ var CommandKitPluginRuntime = class {
|
|
|
897
897
|
for (const plugin of this.plugins.values()) try {
|
|
898
898
|
result = await f(this, plugin);
|
|
899
899
|
} catch (e) {
|
|
900
|
-
if (
|
|
900
|
+
if (require_utils_error_codes.isErrorType(e, require_utils_error_codes.CommandKitErrorCodes.PluginCaptureHandle)) return true;
|
|
901
901
|
Logger.error`Plugin "${plugin.name}" failed: ${(e === null || e === void 0 ? void 0 : e.stack) || e}`;
|
|
902
902
|
}
|
|
903
903
|
return result;
|
|
@@ -932,7 +932,7 @@ var CompilerPluginRuntime = class {
|
|
|
932
932
|
constructor(plugins, isDevMode) {
|
|
933
933
|
this.plugins = plugins;
|
|
934
934
|
this.isDevMode = isDevMode;
|
|
935
|
-
this.plugins = this.plugins.filter((p) => !!p &&
|
|
935
|
+
this.plugins = this.plugins.filter((p) => !!p && require_plugins_CompilerPlugin.isCompilerPlugin(p));
|
|
936
936
|
}
|
|
937
937
|
/**
|
|
938
938
|
* Returns the plugins managed by this runtime.
|
|
@@ -1079,7 +1079,7 @@ var CompilerPluginRuntime = class {
|
|
|
1079
1079
|
/**
|
|
1080
1080
|
* Common directive transformer plugin is a compiler plugin that transforms directives to higher-order functions.
|
|
1081
1081
|
*/
|
|
1082
|
-
var CommonDirectiveTransformer = class extends
|
|
1082
|
+
var CommonDirectiveTransformer = class extends require_plugins_CompilerPlugin.CompilerPlugin {
|
|
1083
1083
|
transformer = null;
|
|
1084
1084
|
async activate(ctx) {
|
|
1085
1085
|
const { createDirectiveTransformer } = await import("directive-to-hof");
|
|
@@ -1114,7 +1114,7 @@ var CommonDirectiveTransformer = class extends require_CompilerPlugin.CompilerPl
|
|
|
1114
1114
|
* // This will be transformed to a constant value at compile time.
|
|
1115
1115
|
* const result = myMacro();
|
|
1116
1116
|
*/
|
|
1117
|
-
var MacroPlugin = class extends
|
|
1117
|
+
var MacroPlugin = class extends require_plugins_CompilerPlugin.CompilerPlugin {
|
|
1118
1118
|
name = "MacroPlugin";
|
|
1119
1119
|
macroTransformer;
|
|
1120
1120
|
async activate() {
|
|
@@ -1183,7 +1183,7 @@ function getConfig() {
|
|
|
1183
1183
|
*/
|
|
1184
1184
|
function defineConfig(config = {}) {
|
|
1185
1185
|
var _config$compilerOptio, _config$compilerOptio2, _config$compilerOptio3;
|
|
1186
|
-
defined =
|
|
1186
|
+
defined = require_config_utils.mergeDeep(config, require_config_utils.mergeDeep({}, defaultConfig));
|
|
1187
1187
|
defined = {
|
|
1188
1188
|
compilerOptions: {
|
|
1189
1189
|
macro: {
|
|
@@ -1304,15 +1304,15 @@ var CommandKitEnvironment = class {
|
|
|
1304
1304
|
* Creates the commandkit execution environment.
|
|
1305
1305
|
* @param commandkit - The commandkit instance.
|
|
1306
1306
|
*/
|
|
1307
|
-
constructor(commandkit
|
|
1308
|
-
this.commandkit = commandkit
|
|
1307
|
+
constructor(commandkit) {
|
|
1308
|
+
this.commandkit = commandkit;
|
|
1309
1309
|
}
|
|
1310
1310
|
/**
|
|
1311
1311
|
* Set the context.
|
|
1312
1312
|
* @param context - The context to set.
|
|
1313
1313
|
*/
|
|
1314
|
-
setContext(context
|
|
1315
|
-
this.#data.context = context
|
|
1314
|
+
setContext(context) {
|
|
1315
|
+
this.#data.context = context;
|
|
1316
1316
|
}
|
|
1317
1317
|
/**
|
|
1318
1318
|
* Get the context. `null` if not set.
|
|
@@ -1543,13 +1543,13 @@ var Context = class Context {
|
|
|
1543
1543
|
* @param commandkit The command kit instance.
|
|
1544
1544
|
* @param config The context parameters.
|
|
1545
1545
|
*/
|
|
1546
|
-
constructor(commandkit
|
|
1546
|
+
constructor(commandkit, config) {
|
|
1547
1547
|
var _config$environment;
|
|
1548
|
-
this.commandkit = commandkit
|
|
1548
|
+
this.commandkit = commandkit;
|
|
1549
1549
|
this.config = config;
|
|
1550
1550
|
this.interaction = config.interaction;
|
|
1551
1551
|
this.message = config.message;
|
|
1552
|
-
this.client = commandkit
|
|
1552
|
+
this.client = commandkit.client;
|
|
1553
1553
|
this.#store = ((_config$environment = config.environment) === null || _config$environment === void 0 ? void 0 : _config$environment.store) ?? config.store ?? new discord_js.Collection();
|
|
1554
1554
|
this.command = config.command;
|
|
1555
1555
|
if (config.interaction) {
|
|
@@ -1625,7 +1625,7 @@ var Context = class Context {
|
|
|
1625
1625
|
env.variables.set("forwardedBy", this.commandName);
|
|
1626
1626
|
env.variables.set("forwardedTo", command);
|
|
1627
1627
|
await handler(this.clone({ forwarded: true }));
|
|
1628
|
-
|
|
1628
|
+
require_app_interrupt_signals.redirect();
|
|
1629
1629
|
}
|
|
1630
1630
|
/**
|
|
1631
1631
|
* The execution mode of the command.
|
|
@@ -1779,18 +1779,18 @@ var AppCommandRunner = class {
|
|
|
1779
1779
|
* @param options - The options for running the command
|
|
1780
1780
|
*/
|
|
1781
1781
|
async runCommand(prepared, source, options) {
|
|
1782
|
-
const { commandkit
|
|
1782
|
+
const { commandkit } = this.handler;
|
|
1783
1783
|
const shouldThrowOnError = !!(options === null || options === void 0 ? void 0 : options.throwOnError);
|
|
1784
1784
|
const executionMode = this.getExecutionMode(source);
|
|
1785
1785
|
let runCommand = null;
|
|
1786
|
-
const env = new CommandKitEnvironment(commandkit
|
|
1786
|
+
const env = new CommandKitEnvironment(commandkit);
|
|
1787
1787
|
env.setType(CommandKitEnvironmentType.CommandHandler);
|
|
1788
1788
|
env.variables.set("commandHandlerType", "app");
|
|
1789
1789
|
env.variables.set("currentCommandName", prepared.command.command.name);
|
|
1790
1790
|
env.variables.set("execHandlerKind", executionMode);
|
|
1791
1791
|
env.variables.set("customHandler", (options === null || options === void 0 ? void 0 : options.handler) ?? null);
|
|
1792
1792
|
try {
|
|
1793
|
-
const middlewareCtx = new MiddlewareContext(commandkit
|
|
1793
|
+
const middlewareCtx = new MiddlewareContext(commandkit, {
|
|
1794
1794
|
command: prepared.command,
|
|
1795
1795
|
environment: env,
|
|
1796
1796
|
executionMode,
|
|
@@ -1808,12 +1808,12 @@ var AppCommandRunner = class {
|
|
|
1808
1808
|
for (const middleware of beforeMiddlewares) try {
|
|
1809
1809
|
await middleware.data.beforeExecute(middlewareCtx);
|
|
1810
1810
|
} catch (e) {
|
|
1811
|
-
if (
|
|
1811
|
+
if (require_utils_error_codes.isErrorType(e, require_utils_error_codes.CommandKitErrorCodes.StopMiddlewares)) {
|
|
1812
1812
|
beforeMiddlewaresStopped = true;
|
|
1813
1813
|
Logger.debug(`Middleware propagation stopped for command "${middlewareCtx.commandName}". stopMiddlewares() was called inside a beforeExecute function at "${middleware.middleware.relativePath}"`);
|
|
1814
1814
|
break;
|
|
1815
1815
|
}
|
|
1816
|
-
if (
|
|
1816
|
+
if (require_utils_error_codes.isErrorType(e, [require_utils_error_codes.CommandKitErrorCodes.ForwardedCommand, require_utils_error_codes.CommandKitErrorCodes.InvalidCommandPrefix])) continue;
|
|
1817
1817
|
throw e;
|
|
1818
1818
|
}
|
|
1819
1819
|
});
|
|
@@ -1822,27 +1822,27 @@ var AppCommandRunner = class {
|
|
|
1822
1822
|
if (!beforeMiddlewaresStopped) {
|
|
1823
1823
|
const fn = prepared.command.data[(options === null || options === void 0 ? void 0 : options.handler) || executionMode];
|
|
1824
1824
|
if (!fn) Logger.warn(`Command ${prepared.command.command.name} has no handler for ${executionMode}`);
|
|
1825
|
-
const analytics = commandkit
|
|
1825
|
+
const analytics = commandkit.analytics;
|
|
1826
1826
|
if (fn) try {
|
|
1827
1827
|
const _executeCommand = makeContextAwareFunction(env, async () => {
|
|
1828
|
-
env.registerDeferredFunction(async (env
|
|
1828
|
+
env.registerDeferredFunction(async (env) => {
|
|
1829
1829
|
var _prepared$command2;
|
|
1830
|
-
env
|
|
1831
|
-
const error = env
|
|
1832
|
-
const marker = env
|
|
1833
|
-
const time = `${env
|
|
1830
|
+
env.markEnd();
|
|
1831
|
+
const error = env.getExecutionError();
|
|
1832
|
+
const marker = env.getMarker();
|
|
1833
|
+
const time = `${env.getExecutionTime().toFixed(2)}ms`;
|
|
1834
1834
|
if (error) {
|
|
1835
1835
|
var _prepared$command;
|
|
1836
1836
|
Logger.error`[${marker} - ${time}] Error executing command: ${error}`;
|
|
1837
|
-
const commandName
|
|
1837
|
+
const commandName = ((_prepared$command = prepared.command) === null || _prepared$command === void 0 || (_prepared$command = _prepared$command.data) === null || _prepared$command === void 0 || (_prepared$command = _prepared$command.command) === null || _prepared$command === void 0 ? void 0 : _prepared$command.name) ?? prepared.command.command.name;
|
|
1838
1838
|
await analytics.track({
|
|
1839
|
-
name:
|
|
1840
|
-
id: commandName
|
|
1839
|
+
name: require_analytics_constants.AnalyticsEvents.COMMAND_EXECUTION,
|
|
1840
|
+
id: commandName,
|
|
1841
1841
|
data: {
|
|
1842
1842
|
error: true,
|
|
1843
|
-
executionTime: env
|
|
1843
|
+
executionTime: env.getExecutionTime().toFixed(2),
|
|
1844
1844
|
type: executionMode,
|
|
1845
|
-
command: commandName
|
|
1845
|
+
command: commandName
|
|
1846
1846
|
}
|
|
1847
1847
|
});
|
|
1848
1848
|
return;
|
|
@@ -1850,11 +1850,11 @@ var AppCommandRunner = class {
|
|
|
1850
1850
|
Logger.info(`[${marker} - ${time}] Command executed successfully`);
|
|
1851
1851
|
const commandName = ((_prepared$command2 = prepared.command) === null || _prepared$command2 === void 0 || (_prepared$command2 = _prepared$command2.data) === null || _prepared$command2 === void 0 || (_prepared$command2 = _prepared$command2.command) === null || _prepared$command2 === void 0 ? void 0 : _prepared$command2.name) ?? prepared.command.command.name;
|
|
1852
1852
|
await analytics.track({
|
|
1853
|
-
name:
|
|
1853
|
+
name: require_analytics_constants.AnalyticsEvents.COMMAND_EXECUTION,
|
|
1854
1854
|
id: commandName,
|
|
1855
1855
|
data: {
|
|
1856
1856
|
error: false,
|
|
1857
|
-
executionTime: env
|
|
1857
|
+
executionTime: env.getExecutionTime().toFixed(2),
|
|
1858
1858
|
type: executionMode,
|
|
1859
1859
|
command: commandName
|
|
1860
1860
|
}
|
|
@@ -1864,14 +1864,14 @@ var AppCommandRunner = class {
|
|
|
1864
1864
|
}, this.#finalizer.bind(this));
|
|
1865
1865
|
const executeCommand = runCommand != null ? runCommand(_executeCommand) : _executeCommand;
|
|
1866
1866
|
env.markStart(prepared.command.data.command.name);
|
|
1867
|
-
if (!await commandkit
|
|
1867
|
+
if (!await commandkit.plugins.execute(async (ctx, plugin) => {
|
|
1868
1868
|
return plugin.executeCommand(ctx, env, source, prepared, executeCommand);
|
|
1869
1869
|
})) result = await executeCommand();
|
|
1870
1870
|
} catch (e) {
|
|
1871
|
-
if (
|
|
1871
|
+
if (require_utils_error_codes.isErrorType(e, require_utils_error_codes.CommandKitErrorCodes.StopMiddlewares)) {
|
|
1872
1872
|
stopMiddlewaresCalledInCmd = true;
|
|
1873
1873
|
Logger.debug(`Middleware propagation stopped for command "${middlewareCtx.commandName}". stopMiddlewares() was called by the command itself`);
|
|
1874
|
-
} else if (!
|
|
1874
|
+
} else if (!require_utils_error_codes.isErrorType(e, require_utils_error_codes.CommandKitErrorCodes.ForwardedCommand)) {
|
|
1875
1875
|
if (shouldThrowOnError) throw e;
|
|
1876
1876
|
Logger.error`${e}`;
|
|
1877
1877
|
}
|
|
@@ -1885,7 +1885,7 @@ var AppCommandRunner = class {
|
|
|
1885
1885
|
for (const middleware of afterMiddlewares) try {
|
|
1886
1886
|
await middleware.data.afterExecute(middlewareCtx);
|
|
1887
1887
|
} catch (e) {
|
|
1888
|
-
if (
|
|
1888
|
+
if (require_utils_error_codes.isErrorType(e, require_utils_error_codes.CommandKitErrorCodes.StopMiddlewares)) {
|
|
1889
1889
|
Logger.debug(`Middleware propagation stopped for command "${middlewareCtx.commandName}". stopMiddlewares() was called inside an afterExecute function at "${middleware.middleware.relativePath}"`);
|
|
1890
1890
|
break;
|
|
1891
1891
|
}
|
|
@@ -1944,17 +1944,17 @@ async function beforeExecute(ctx) {
|
|
|
1944
1944
|
if (!userPermissionsRequired.length && !botPermissionsRequired.length) return;
|
|
1945
1945
|
if (interaction && ((_interaction$channel = interaction.channel) === null || _interaction$channel === void 0 ? void 0 : _interaction$channel.isDMBased()) || message && ((_message$channel = message.channel) === null || _message$channel === void 0 ? void 0 : _message$channel.isDMBased())) {
|
|
1946
1946
|
const channel = (interaction === null || interaction === void 0 ? void 0 : interaction.channel) ?? (message === null || message === void 0 ? void 0 : message.channel);
|
|
1947
|
-
const embed
|
|
1947
|
+
const embed = new discord_js.EmbedBuilder().setTitle(":x: Server-only command!").setDescription("This command can only be used in a server.").setColor("Red");
|
|
1948
1948
|
try {
|
|
1949
1949
|
if (channel === null || channel === void 0 ? void 0 : channel.isSendable()) if (interaction && interaction.isRepliable()) await interaction.reply({
|
|
1950
|
-
embeds: [embed
|
|
1950
|
+
embeds: [embed],
|
|
1951
1951
|
flags: discord_js.MessageFlags.Ephemeral
|
|
1952
1952
|
});
|
|
1953
|
-
else await message.reply({ embeds: [embed
|
|
1953
|
+
else await message.reply({ embeds: [embed] });
|
|
1954
1954
|
} catch (error) {
|
|
1955
1955
|
Logger.error`Could not send 'Server-only command' DM to user ${(interaction === null || interaction === void 0 ? void 0 : interaction.user.id) ?? (message === null || message === void 0 ? void 0 : message.author.id)} for command ${command.command.name}: ${error}`;
|
|
1956
1956
|
}
|
|
1957
|
-
|
|
1957
|
+
require_app_interrupt_signals.stopMiddlewares();
|
|
1958
1958
|
}
|
|
1959
1959
|
const userPermissions = (interaction === null || interaction === void 0 ? void 0 : interaction.memberPermissions) ?? (message === null || message === void 0 || (_message$member = message.member) === null || _message$member === void 0 ? void 0 : _message$member.permissions);
|
|
1960
1960
|
let missingUserPermissions = [];
|
|
@@ -1997,7 +1997,7 @@ async function beforeExecute(ctx) {
|
|
|
1997
1997
|
} catch (error) {
|
|
1998
1998
|
Logger.error`Could not send 'Not enough permissions' reply to user ${(interaction === null || interaction === void 0 ? void 0 : interaction.user.id) ?? (message === null || message === void 0 ? void 0 : message.author.id)} for command ${command.command.name}: ${error}`;
|
|
1999
1999
|
}
|
|
2000
|
-
|
|
2000
|
+
require_app_interrupt_signals.stopMiddlewares();
|
|
2001
2001
|
}
|
|
2002
2002
|
|
|
2003
2003
|
//#endregion
|
|
@@ -2015,8 +2015,8 @@ var CommandRegistrar = class {
|
|
|
2015
2015
|
* Creates an instance of CommandRegistrar.
|
|
2016
2016
|
* @param commandkit The commandkit instance.
|
|
2017
2017
|
*/
|
|
2018
|
-
constructor(commandkit
|
|
2019
|
-
this.commandkit = commandkit
|
|
2018
|
+
constructor(commandkit) {
|
|
2019
|
+
this.commandkit = commandkit;
|
|
2020
2020
|
this.api.setToken(this.commandkit.client.token ?? process.env.DISCORD_TOKEN ?? process.env.TOKEN ?? "");
|
|
2021
2021
|
}
|
|
2022
2022
|
/**
|
|
@@ -2168,18 +2168,18 @@ var CommandRegistrar = class {
|
|
|
2168
2168
|
if (!guildCommandsMap.size) return;
|
|
2169
2169
|
let count = 0;
|
|
2170
2170
|
for (const [guild, guildCommands] of guildCommandsMap) {
|
|
2171
|
-
let prevented
|
|
2172
|
-
const preRegisterEvent
|
|
2171
|
+
let prevented = false;
|
|
2172
|
+
const preRegisterEvent = {
|
|
2173
2173
|
preventDefault() {
|
|
2174
|
-
prevented
|
|
2174
|
+
prevented = true;
|
|
2175
2175
|
},
|
|
2176
2176
|
commands: guildCommands
|
|
2177
2177
|
};
|
|
2178
2178
|
await this.commandkit.plugins.execute(async (ctx, plugin) => {
|
|
2179
|
-
if (prevented
|
|
2180
|
-
return plugin.onBeforeRegisterGuildCommands(ctx, preRegisterEvent
|
|
2179
|
+
if (prevented) return;
|
|
2180
|
+
return plugin.onBeforeRegisterGuildCommands(ctx, preRegisterEvent);
|
|
2181
2181
|
});
|
|
2182
|
-
if (prevented
|
|
2182
|
+
if (prevented) continue;
|
|
2183
2183
|
const data = await this.api.put(discord_js.Routes.applicationGuildCommands(this.commandkit.client.user.id, guild), { body: guildCommands.map((b) => ({
|
|
2184
2184
|
...b,
|
|
2185
2185
|
__metadata: void 0,
|
|
@@ -2274,8 +2274,8 @@ var AppCommandHandler = class {
|
|
|
2274
2274
|
* Creates a new AppCommandHandler instance.
|
|
2275
2275
|
* @param commandkit - The CommandKit instance
|
|
2276
2276
|
*/
|
|
2277
|
-
constructor(commandkit
|
|
2278
|
-
this.commandkit = commandkit
|
|
2277
|
+
constructor(commandkit) {
|
|
2278
|
+
this.commandkit = commandkit;
|
|
2279
2279
|
this.registrar = new CommandRegistrar(this.commandkit);
|
|
2280
2280
|
}
|
|
2281
2281
|
/**
|
|
@@ -2289,7 +2289,7 @@ var AppCommandHandler = class {
|
|
|
2289
2289
|
acc[category].push(cmd);
|
|
2290
2290
|
return acc;
|
|
2291
2291
|
}, {});
|
|
2292
|
-
console.log(
|
|
2292
|
+
console.log(require_utils_colors.default.green(`Loaded ${require_utils_colors.default.magenta(this.loadedCommands.size.toString())} commands:`));
|
|
2293
2293
|
const categories = Object.keys(categorizedCommands).sort();
|
|
2294
2294
|
const categoryTree = {};
|
|
2295
2295
|
categories.forEach((category) => {
|
|
@@ -2320,14 +2320,14 @@ var AppCommandHandler = class {
|
|
|
2320
2320
|
const childIndent = parentPrefix + (isLast ? " " : "│ ");
|
|
2321
2321
|
if (category !== uncategorized) {
|
|
2322
2322
|
const displayName = category.includes(":") ? category.split(":").pop() : category;
|
|
2323
|
-
console.log(
|
|
2323
|
+
console.log(require_utils_colors.default.cyan(`${indent}${thisPrefix} ${require_utils_colors.default.bold(displayName)}`));
|
|
2324
2324
|
}
|
|
2325
2325
|
commands.forEach((cmd, cmdIndex) => {
|
|
2326
2326
|
const cmdPrefix = cmdIndex === commands.length - 1 && !hasChildren ? "└─" : "├─";
|
|
2327
2327
|
const cmdIndent = category !== uncategorized ? childIndent : indent;
|
|
2328
2328
|
const name = cmd.data.command.name;
|
|
2329
|
-
const middlewareIcon = cmd.command.middlewares.length > 0 ?
|
|
2330
|
-
console.log(`${
|
|
2329
|
+
const middlewareIcon = cmd.command.middlewares.length > 0 ? require_utils_colors.default.magenta(" (λ)") : "";
|
|
2330
|
+
console.log(`${require_utils_colors.default.green(`${cmdIndent}${cmdPrefix}`)} ${require_utils_colors.default.yellow(name)}${middlewareIcon}`);
|
|
2331
2331
|
});
|
|
2332
2332
|
if (hasChildren) {
|
|
2333
2333
|
const children = categoryTree[category].sort();
|
|
@@ -2398,15 +2398,15 @@ var AppCommandHandler = class {
|
|
|
2398
2398
|
if (source.author.bot) return null;
|
|
2399
2399
|
const prefix = await this.commandkit.appConfig.getMessageCommandPrefix(source);
|
|
2400
2400
|
if (!prefix || (typeof prefix === "string" || Array.isArray(prefix)) && !prefix.length) return null;
|
|
2401
|
-
parser = new
|
|
2401
|
+
parser = new require_app_commands_MessageCommandParser.MessageCommandParser(source, prefix instanceof RegExp ? prefix : Array.isArray(prefix) ? prefix : [prefix], (command) => {
|
|
2402
2402
|
var _loadedCommand$metada, _loadedCommand$metada2, _json$options;
|
|
2403
|
-
const loadedCommand
|
|
2404
|
-
if (!loadedCommand
|
|
2405
|
-
if (
|
|
2403
|
+
const loadedCommand = this.findCommandByName(command);
|
|
2404
|
+
if (!loadedCommand) {
|
|
2405
|
+
if (require_utils_constants.COMMANDKIT_IS_DEV && this.commandkit.config.showUnknownPrefixCommandsWarning) Logger.error`Prefix command "${command}" was not found.\nNote: This warning is only shown in development mode as an alert to help you find the command. If you wish to remove this warning, set \`showUnknownPrefixCommandsWarning\` to \`false\` in your commandkit config.`;
|
|
2406
2406
|
return null;
|
|
2407
2407
|
}
|
|
2408
|
-
if (source.guildId && ((_loadedCommand$metada = loadedCommand
|
|
2409
|
-
return ((_json$options = ("toJSON" in loadedCommand
|
|
2408
|
+
if (source.guildId && ((_loadedCommand$metada = loadedCommand.metadata) === null || _loadedCommand$metada === void 0 || (_loadedCommand$metada = _loadedCommand$metada.guilds) === null || _loadedCommand$metada === void 0 ? void 0 : _loadedCommand$metada.length) && !((_loadedCommand$metada2 = loadedCommand.metadata) === null || _loadedCommand$metada2 === void 0 ? void 0 : _loadedCommand$metada2.guilds.includes(source.guildId))) return null;
|
|
2409
|
+
return ((_json$options = ("toJSON" in loadedCommand.data.command ? loadedCommand.data.command.toJSON() : loadedCommand.data.command).options) === null || _json$options === void 0 ? void 0 : _json$options.reduce((acc, opt) => {
|
|
2410
2410
|
acc[opt.name] = opt.type;
|
|
2411
2411
|
return acc;
|
|
2412
2412
|
}, {})) ?? {};
|
|
@@ -2414,7 +2414,7 @@ var AppCommandHandler = class {
|
|
|
2414
2414
|
try {
|
|
2415
2415
|
cmdName = parser.getFullCommand().split(" ")[0];
|
|
2416
2416
|
} catch (e) {
|
|
2417
|
-
if (
|
|
2417
|
+
if (require_utils_error_codes.isErrorType(e, require_utils_error_codes.CommandKitErrorCodes.InvalidCommandPrefix)) return null;
|
|
2418
2418
|
Logger.error`${e}`;
|
|
2419
2419
|
return null;
|
|
2420
2420
|
}
|
|
@@ -2422,7 +2422,7 @@ var AppCommandHandler = class {
|
|
|
2422
2422
|
if (!(source.isChatInputCommand() || source.isAutocomplete() || source.isContextMenuCommand())) return null;
|
|
2423
2423
|
cmdName = source.commandName;
|
|
2424
2424
|
}
|
|
2425
|
-
const hint =
|
|
2425
|
+
const hint = require_app_commands_helpers.isInteractionSource(source) ? source.isUserContextMenuCommand() ? "user" : source.isMessageContextMenuCommand() ? "message" : void 0 : void 0;
|
|
2426
2426
|
const loadedCommand = this.findCommandByName(cmdName, hint);
|
|
2427
2427
|
if (!loadedCommand) return null;
|
|
2428
2428
|
if ((source instanceof discord_js.CommandInteraction || source instanceof discord_js.AutocompleteInteraction) && source.guildId && ((_loadedCommand$metada3 = loadedCommand.metadata) === null || _loadedCommand$metada3 === void 0 || (_loadedCommand$metada3 = _loadedCommand$metada3.guilds) === null || _loadedCommand$metada3 === void 0 ? void 0 : _loadedCommand$metada3.length) && !((_loadedCommand$metada4 = loadedCommand.metadata) === null || _loadedCommand$metada4 === void 0 ? void 0 : _loadedCommand$metada4.guilds.includes(source.guildId))) return null;
|
|
@@ -2432,8 +2432,8 @@ var AppCommandHandler = class {
|
|
|
2432
2432
|
if (((_loadedCommand$metada5 = loadedCommand.metadata) === null || _loadedCommand$metada5 === void 0 || (_loadedCommand$metada5 = _loadedCommand$metada5.guilds) === null || _loadedCommand$metada5 === void 0 ? void 0 : _loadedCommand$metada5.length) && !loadedCommand.metadata.guilds.includes(source.guildId)) return null;
|
|
2433
2433
|
}
|
|
2434
2434
|
const middlewares = [];
|
|
2435
|
-
for (const middlewareId
|
|
2436
|
-
const middleware = this.loadedMiddlewares.get(middlewareId
|
|
2435
|
+
for (const middlewareId of loadedCommand.command.middlewares) {
|
|
2436
|
+
const middleware = this.loadedMiddlewares.get(middlewareId);
|
|
2437
2437
|
if (middleware) middlewares.push(middleware);
|
|
2438
2438
|
}
|
|
2439
2439
|
if (!getConfig().disablePermissionsMiddleware) middlewares.push({
|
|
@@ -2541,10 +2541,10 @@ var AppCommandHandler = class {
|
|
|
2541
2541
|
const combinedMiddlewares = this.externalMiddlewareData.size ? middlewares.concat(this.externalMiddlewareData) : middlewares;
|
|
2542
2542
|
for (const [id, middleware] of combinedMiddlewares) await this.loadMiddleware(id, middleware);
|
|
2543
2543
|
for (const [id, command] of combinedCommands) await this.loadCommand(id, command);
|
|
2544
|
-
if (
|
|
2544
|
+
if (require_utils_constants.COMMANDKIT_IS_DEV) {
|
|
2545
2545
|
const commandNames = Array.from(this.loadedCommands.values()).map((v) => v.data.command.name);
|
|
2546
2546
|
const aliases = Array.from(this.loadedCommands.values()).flatMap((v) => v.metadata.aliases || []);
|
|
2547
|
-
await
|
|
2547
|
+
await require_utils_types_package.rewriteCommandDeclaration(`type CommandTypeData = ${[...commandNames, ...aliases].map((name) => JSON.stringify(name)).join(" | ")}`);
|
|
2548
2548
|
}
|
|
2549
2549
|
await this.commandkit.plugins.execute((ctx, plugin) => {
|
|
2550
2550
|
return plugin.onAfterCommandsLoad(ctx);
|
|
@@ -2556,7 +2556,7 @@ var AppCommandHandler = class {
|
|
|
2556
2556
|
*/
|
|
2557
2557
|
async loadMiddleware(id, middleware) {
|
|
2558
2558
|
try {
|
|
2559
|
-
const data = await import(`${
|
|
2559
|
+
const data = await import(`${require_utils_resolve_file_url.toFileURL(middleware.path)}?t=${Date.now()}`);
|
|
2560
2560
|
let handlerCount = 0;
|
|
2561
2561
|
for (const [key, validator] of Object.entries(middlewareDataSchema)) {
|
|
2562
2562
|
if (data[key] && !await validator(data[key])) throw new Error(`Invalid export for middleware ${id}: ${key} does not match expected value`);
|
|
@@ -2591,7 +2591,7 @@ var AppCommandHandler = class {
|
|
|
2591
2591
|
});
|
|
2592
2592
|
return;
|
|
2593
2593
|
}
|
|
2594
|
-
const commandFileData = await import(`${
|
|
2594
|
+
const commandFileData = await import(`${require_utils_resolve_file_url.toFileURL(command.path)}?t=${Date.now()}`);
|
|
2595
2595
|
if (!commandFileData.command) throw new Error(`Invalid export for command ${command.name}: no command definition found`);
|
|
2596
2596
|
const metadataFunc = commandFileData.generateMetadata;
|
|
2597
2597
|
const metadataObj = commandFileData.metadata;
|
|
@@ -2687,17 +2687,17 @@ var FeatureFlag = class {
|
|
|
2687
2687
|
constructor(options) {
|
|
2688
2688
|
this.options = options;
|
|
2689
2689
|
this.commandkit = getCommandKit(true);
|
|
2690
|
-
const FlagStore
|
|
2691
|
-
if (FlagStore
|
|
2692
|
-
FlagStore
|
|
2690
|
+
const FlagStore = this.commandkit.flags;
|
|
2691
|
+
if (FlagStore.has(options.key)) throw new Error(`Feature flag with key "${options.key}" already exists.`);
|
|
2692
|
+
FlagStore.set(options.key, this);
|
|
2693
2693
|
}
|
|
2694
2694
|
getContext() {
|
|
2695
2695
|
const env = getContext();
|
|
2696
2696
|
if (env === null || env === void 0 ? void 0 : env.context) {
|
|
2697
|
-
const { client, commandkit
|
|
2697
|
+
const { client, commandkit, interaction, message, guild, channel, command } = env.context;
|
|
2698
2698
|
return {
|
|
2699
2699
|
client,
|
|
2700
|
-
commandkit
|
|
2700
|
+
commandkit,
|
|
2701
2701
|
command: {
|
|
2702
2702
|
interaction,
|
|
2703
2703
|
message,
|
|
@@ -2708,12 +2708,12 @@ var FeatureFlag = class {
|
|
|
2708
2708
|
event: null
|
|
2709
2709
|
};
|
|
2710
2710
|
}
|
|
2711
|
-
const eventCtx =
|
|
2711
|
+
const eventCtx = require_app_events_EventWorkerContext.eventWorkerContext.getStore();
|
|
2712
2712
|
if (eventCtx) {
|
|
2713
|
-
const { commandkit
|
|
2713
|
+
const { commandkit, data, event, namespace } = eventCtx;
|
|
2714
2714
|
return {
|
|
2715
|
-
client: commandkit
|
|
2716
|
-
commandkit
|
|
2715
|
+
client: commandkit.client,
|
|
2716
|
+
commandkit,
|
|
2717
2717
|
event: {
|
|
2718
2718
|
data,
|
|
2719
2719
|
event,
|
|
@@ -2762,7 +2762,7 @@ var FeatureFlag = class {
|
|
|
2762
2762
|
if (!disableAnalytics) {
|
|
2763
2763
|
defer(async () => {
|
|
2764
2764
|
await this.commandkit.analytics.track({
|
|
2765
|
-
name:
|
|
2765
|
+
name: require_analytics_constants.AnalyticsEvents.FEATURE_FLAG_METRICS,
|
|
2766
2766
|
data: {
|
|
2767
2767
|
flag: this.options.key,
|
|
2768
2768
|
identificationTime: identificationTime.toFixed(2),
|
|
@@ -2774,7 +2774,7 @@ var FeatureFlag = class {
|
|
|
2774
2774
|
});
|
|
2775
2775
|
defer(async () => {
|
|
2776
2776
|
await this.commandkit.analytics.track({
|
|
2777
|
-
name:
|
|
2777
|
+
name: require_analytics_constants.AnalyticsEvents.FEATURE_FLAG_DECISION,
|
|
2778
2778
|
id: entities && typeof entities === "object" && "id" in entities && typeof entities.id === "string" ? entities.id : void 0,
|
|
2779
2779
|
data: {
|
|
2780
2780
|
flag: this.options.key,
|
|
@@ -2797,8 +2797,8 @@ function flag(options) {
|
|
|
2797
2797
|
const runner = flag.execute.bind(flag, void 0);
|
|
2798
2798
|
runner.run = async function(ctx) {
|
|
2799
2799
|
if (!(ctx === null || ctx === void 0 ? void 0 : ctx.identify)) throw new Error("Custom evaluation context must have an identify function or object.");
|
|
2800
|
-
const context
|
|
2801
|
-
return await flag.execute(context
|
|
2800
|
+
const context = typeof ctx === "function" ? await ctx() : ctx;
|
|
2801
|
+
return await flag.execute(context);
|
|
2802
2802
|
};
|
|
2803
2803
|
return runner;
|
|
2804
2804
|
}
|
|
@@ -2850,7 +2850,7 @@ function TextInput(props) {
|
|
|
2850
2850
|
const input = new discord_js.TextInputBuilder().setStyle(props.style);
|
|
2851
2851
|
if (props.customId) input.setCustomId(props.customId);
|
|
2852
2852
|
if (props.label) {
|
|
2853
|
-
|
|
2853
|
+
require_utils_warning.warnDeprecated({
|
|
2854
2854
|
what: "Property `label`",
|
|
2855
2855
|
where: "<TextInput />",
|
|
2856
2856
|
message: "Use the <Label /> component instead."
|
|
@@ -3800,8 +3800,8 @@ var AppEventsHandler = class {
|
|
|
3800
3800
|
* Creates a new AppEventsHandler instance.
|
|
3801
3801
|
* @param commandkit - The CommandKit instance
|
|
3802
3802
|
*/
|
|
3803
|
-
constructor(commandkit
|
|
3804
|
-
this.commandkit = commandkit
|
|
3803
|
+
constructor(commandkit) {
|
|
3804
|
+
this.commandkit = commandkit;
|
|
3805
3805
|
}
|
|
3806
3806
|
/**
|
|
3807
3807
|
* Gets information about all loaded events.
|
|
@@ -3835,7 +3835,7 @@ var AppEventsHandler = class {
|
|
|
3835
3835
|
for (const event of Object.values(events)) {
|
|
3836
3836
|
const listeners = [];
|
|
3837
3837
|
for (const listener of event.listeners) {
|
|
3838
|
-
const handler = await import(
|
|
3838
|
+
const handler = await import(require_utils_resolve_file_url.toFileURL(listener, true));
|
|
3839
3839
|
if (!handler.default || typeof handler.default !== "function") {
|
|
3840
3840
|
Logger.warn`Event handler for ${event.event}${event.namespace ? ` of namespace ${event.namespace}` : ""} at "${listener}" does not have a default export or is not a function. Skipping...`;
|
|
3841
3841
|
continue;
|
|
@@ -3901,7 +3901,7 @@ var AppEventsHandler = class {
|
|
|
3901
3901
|
if (accepted) return;
|
|
3902
3902
|
return (_plugin$willEmitEvent = plugin.willEmitEvent) === null || _plugin$willEmitEvent === void 0 ? void 0 : _plugin$willEmitEvent.call(plugin, ctx, event);
|
|
3903
3903
|
}).catch(Object);
|
|
3904
|
-
await
|
|
3904
|
+
await require_app_events_EventWorkerContext.runInEventWorkerContext({
|
|
3905
3905
|
event: name,
|
|
3906
3906
|
namespace: namespace ?? null,
|
|
3907
3907
|
data: data.event,
|
|
@@ -3919,7 +3919,7 @@ var AppEventsHandler = class {
|
|
|
3919
3919
|
for (const listener of onSequentialListeners) try {
|
|
3920
3920
|
await listener.handler(...args, client, this.commandkit);
|
|
3921
3921
|
} catch (e) {
|
|
3922
|
-
if (
|
|
3922
|
+
if (require_utils_error_codes.isErrorType(e, require_utils_error_codes.CommandKitErrorCodes.StopEvents)) {
|
|
3923
3923
|
Logger.debug(`Event propagation stopped for ${name}${namespace ? ` of namespace ${namespace}` : ""}`);
|
|
3924
3924
|
break;
|
|
3925
3925
|
}
|
|
@@ -3947,7 +3947,7 @@ var AppEventsHandler = class {
|
|
|
3947
3947
|
return (_plugin$willEmitEvent2 = plugin.willEmitEvent) === null || _plugin$willEmitEvent2 === void 0 ? void 0 : _plugin$willEmitEvent2.call(plugin, ctx, event);
|
|
3948
3948
|
}).catch(Object);
|
|
3949
3949
|
if (onceParallelListeners.length > 0) await Promise.all(onceParallelListeners.map(async (listener) => {
|
|
3950
|
-
return
|
|
3950
|
+
return require_app_events_EventWorkerContext.runInEventWorkerContext({
|
|
3951
3951
|
event: name,
|
|
3952
3952
|
namespace: namespace ?? null,
|
|
3953
3953
|
data: data.event,
|
|
@@ -3966,7 +3966,7 @@ var AppEventsHandler = class {
|
|
|
3966
3966
|
}));
|
|
3967
3967
|
for (const listener of onceSequentialListeners) {
|
|
3968
3968
|
if (broken) break;
|
|
3969
|
-
await
|
|
3969
|
+
await require_app_events_EventWorkerContext.runInEventWorkerContext({
|
|
3970
3970
|
event: name,
|
|
3971
3971
|
namespace: namespace ?? null,
|
|
3972
3972
|
data: data.event,
|
|
@@ -3979,7 +3979,7 @@ var AppEventsHandler = class {
|
|
|
3979
3979
|
await listener.handler(...args, client, this.commandkit);
|
|
3980
3980
|
executedOnceListeners.add(listener.handler);
|
|
3981
3981
|
} catch (e) {
|
|
3982
|
-
if (
|
|
3982
|
+
if (require_utils_error_codes.isErrorType(e, require_utils_error_codes.CommandKitErrorCodes.StopEvents)) {
|
|
3983
3983
|
Logger.debug(`Event propagation stopped for ${name}${namespace ? ` of namespace ${namespace}` : ""}`);
|
|
3984
3984
|
broken = true;
|
|
3985
3985
|
}
|
|
@@ -4057,11 +4057,11 @@ let loadedConfig = null;
|
|
|
4057
4057
|
* Load the configuration file from the given entrypoint.
|
|
4058
4058
|
* @param entrypoint The entrypoint to load the configuration file from. Defaults to the current working directory.
|
|
4059
4059
|
*/
|
|
4060
|
-
async function loadConfigFile(entrypoint =
|
|
4060
|
+
async function loadConfigFile(entrypoint = require_utils_constants.COMMANDKIT_CWD) {
|
|
4061
4061
|
if (loadedConfig) return loadedConfig;
|
|
4062
4062
|
const filePath = findConfigFile(entrypoint);
|
|
4063
4063
|
if (!filePath) return getConfig();
|
|
4064
|
-
const config = await
|
|
4064
|
+
const config = await require_cli_common.loadConfigFileFromPath(filePath.path);
|
|
4065
4065
|
loadedConfig = config;
|
|
4066
4066
|
return config;
|
|
4067
4067
|
}
|
|
@@ -4072,8 +4072,8 @@ async function loadConfigFile(entrypoint = require_constants.COMMANDKIT_CWD) {
|
|
|
4072
4072
|
* Registers development hooks for CommandKit to handle HMR (Hot Module Replacement) events.
|
|
4073
4073
|
* @param commandkit - The CommandKit instance to register hooks for.
|
|
4074
4074
|
*/
|
|
4075
|
-
function registerDevHooks(commandkit
|
|
4076
|
-
if (!
|
|
4075
|
+
function registerDevHooks(commandkit) {
|
|
4076
|
+
if (!require_utils_constants.COMMANDKIT_IS_DEV) return;
|
|
4077
4077
|
process.on("message", async (message) => {
|
|
4078
4078
|
if (typeof message !== "object" || message === null) return;
|
|
4079
4079
|
const { event, path, id } = message;
|
|
@@ -4091,22 +4091,22 @@ function registerDevHooks(commandkit$1) {
|
|
|
4091
4091
|
event
|
|
4092
4092
|
};
|
|
4093
4093
|
try {
|
|
4094
|
-
await commandkit
|
|
4094
|
+
await commandkit.plugins.execute(async (ctx, plugin) => {
|
|
4095
4095
|
var _plugin$performHMR;
|
|
4096
4096
|
if (accepted) return;
|
|
4097
4097
|
await ((_plugin$performHMR = plugin.performHMR) === null || _plugin$performHMR === void 0 ? void 0 : _plugin$performHMR.call(plugin, ctx, hmrEvent));
|
|
4098
4098
|
});
|
|
4099
4099
|
if (prevented) return;
|
|
4100
4100
|
switch (event) {
|
|
4101
|
-
case
|
|
4102
|
-
commandkit
|
|
4101
|
+
case require_utils_constants.HMREventType.ReloadCommands:
|
|
4102
|
+
commandkit.commandHandler.reloadCommands();
|
|
4103
4103
|
handled = true;
|
|
4104
4104
|
break;
|
|
4105
|
-
case
|
|
4106
|
-
commandkit
|
|
4105
|
+
case require_utils_constants.HMREventType.ReloadEvents:
|
|
4106
|
+
commandkit.eventHandler.reloadEvents();
|
|
4107
4107
|
handled = true;
|
|
4108
4108
|
break;
|
|
4109
|
-
case
|
|
4109
|
+
case require_utils_constants.HMREventType.Unknown:
|
|
4110
4110
|
handled = false;
|
|
4111
4111
|
break;
|
|
4112
4112
|
default: break;
|
|
@@ -4130,7 +4130,7 @@ function registerDevHooks(commandkit$1) {
|
|
|
4130
4130
|
function getVariableStore() {
|
|
4131
4131
|
const ctx = getContext();
|
|
4132
4132
|
if (!ctx) try {
|
|
4133
|
-
return
|
|
4133
|
+
return require_app_events_EventWorkerContext.getEventWorkerContext().variables;
|
|
4134
4134
|
} catch {
|
|
4135
4135
|
return null;
|
|
4136
4136
|
}
|
|
@@ -4142,7 +4142,7 @@ function getVariableStore() {
|
|
|
4142
4142
|
*/
|
|
4143
4143
|
function getDoNotTrack() {
|
|
4144
4144
|
const variables = getVariableStore();
|
|
4145
|
-
return (variables === null || variables === void 0 ? void 0 : variables.get(
|
|
4145
|
+
return (variables === null || variables === void 0 ? void 0 : variables.get(require_analytics_constants.DO_NOT_TRACK_KEY)) === true;
|
|
4146
4146
|
}
|
|
4147
4147
|
/**
|
|
4148
4148
|
* Signals commandkit to not track further analytics events within current context.
|
|
@@ -4156,7 +4156,7 @@ function getDoNotTrack() {
|
|
|
4156
4156
|
function noAnalytics() {
|
|
4157
4157
|
const variables = getVariableStore();
|
|
4158
4158
|
if (!variables) throw new Error("noAnalytics may only be used inside commandkit context");
|
|
4159
|
-
variables.set(
|
|
4159
|
+
variables.set(require_analytics_constants.DO_NOT_TRACK_KEY, true);
|
|
4160
4160
|
}
|
|
4161
4161
|
|
|
4162
4162
|
//#endregion
|
|
@@ -4172,8 +4172,8 @@ var AnalyticsEngine = class {
|
|
|
4172
4172
|
* Creates an instance of the AnalyticsEngine.
|
|
4173
4173
|
* @param commandkit The CommandKit instance.
|
|
4174
4174
|
*/
|
|
4175
|
-
constructor(commandkit
|
|
4176
|
-
this.commandkit = commandkit
|
|
4175
|
+
constructor(commandkit) {
|
|
4176
|
+
this.commandkit = commandkit;
|
|
4177
4177
|
}
|
|
4178
4178
|
/**
|
|
4179
4179
|
* Sets a filter function for analytics events.
|
|
@@ -4317,7 +4317,7 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
4317
4317
|
/**
|
|
4318
4318
|
* A flag store for storing flags that can be used to enable or disable features.
|
|
4319
4319
|
*/
|
|
4320
|
-
flags = new
|
|
4320
|
+
flags = new require_flags_store.FlagStore();
|
|
4321
4321
|
/**
|
|
4322
4322
|
* The command router for the CommandKit instance.
|
|
4323
4323
|
*/
|
|
@@ -4393,11 +4393,11 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
4393
4393
|
*/
|
|
4394
4394
|
async start(token) {
|
|
4395
4395
|
if (this.#started) return;
|
|
4396
|
-
if (!this.#client) throw new Error(
|
|
4397
|
-
this.eventInterceptor = new
|
|
4398
|
-
if (
|
|
4396
|
+
if (!this.#client) throw new Error(require_utils_colors.default.red("\"client\" is required when starting CommandKit."));
|
|
4397
|
+
this.eventInterceptor = new require_components_common_EventInterceptor.EventInterceptor(this.client);
|
|
4398
|
+
if (require_utils_constants.COMMANDKIT_IS_DEV) try {
|
|
4399
4399
|
registerDevHooks(this);
|
|
4400
|
-
await
|
|
4400
|
+
await require_utils_types_package.generateTypesPackage();
|
|
4401
4401
|
} catch (e) {
|
|
4402
4402
|
if (process.env.COMMANDKIT_DEBUG_TYPEGEN) Logger.error`${e}`;
|
|
4403
4403
|
}
|
|
@@ -4427,7 +4427,7 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
4427
4427
|
* Loads all the plugins.
|
|
4428
4428
|
*/
|
|
4429
4429
|
async loadPlugins() {
|
|
4430
|
-
const plugins = (await loadConfigFile()).plugins.flat(2).filter((p) =>
|
|
4430
|
+
const plugins = (await loadConfigFile()).plugins.flat(2).filter((p) => require_plugins_RuntimePlugin.isRuntimePlugin(p));
|
|
4431
4431
|
if (!plugins.length) return;
|
|
4432
4432
|
for (const plugin of plugins) await this.plugins.softRegisterPlugin(plugin);
|
|
4433
4433
|
}
|
|
@@ -4480,12 +4480,12 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
4480
4480
|
const events = this.getPath("events");
|
|
4481
4481
|
this.commandHandler = new AppCommandHandler(this);
|
|
4482
4482
|
this.eventHandler = new AppEventsHandler(this);
|
|
4483
|
-
this.events = new
|
|
4484
|
-
this.commandsRouter = new
|
|
4483
|
+
this.events = new require_events_CommandKitEventsChannel.CommandKitEventsChannel(this);
|
|
4484
|
+
this.commandsRouter = new require_app_router_CommandsRouter.CommandsRouter({ entrypoint: commandsPath });
|
|
4485
4485
|
await this.plugins.execute((ctx, plugin) => {
|
|
4486
4486
|
return plugin.onCommandsRouterInit(ctx);
|
|
4487
4487
|
});
|
|
4488
|
-
this.eventsRouter = new
|
|
4488
|
+
this.eventsRouter = new require_app_router_EventsRouter.EventsRouter({ entrypoints: [events] });
|
|
4489
4489
|
await this.plugins.execute((ctx, plugin) => {
|
|
4490
4490
|
return plugin.onEventsRouterInit(ctx);
|
|
4491
4491
|
});
|
|
@@ -4495,7 +4495,7 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
4495
4495
|
async #initCommands() {
|
|
4496
4496
|
if (this.commandsRouter.isValidPath()) {
|
|
4497
4497
|
const result = await this.commandsRouter.scan();
|
|
4498
|
-
if (
|
|
4498
|
+
if (require_utils_constants.COMMANDKIT_IS_DEV) (0, node_fs.writeFileSync)("./.commandkit/commands.json", JSON.stringify(result, null, 2));
|
|
4499
4499
|
}
|
|
4500
4500
|
await this.commandHandler.loadCommands();
|
|
4501
4501
|
this.commandHandler.printBanner();
|
|
@@ -4543,11 +4543,11 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
4543
4543
|
* @returns The path to the commands or events directory
|
|
4544
4544
|
*/
|
|
4545
4545
|
getPath(to) {
|
|
4546
|
-
const appDir
|
|
4547
|
-
if (!appDir
|
|
4546
|
+
const appDir = this.getAppDirectory();
|
|
4547
|
+
if (!appDir) return null;
|
|
4548
4548
|
switch (to) {
|
|
4549
|
-
case "commands": return (0, node_path.join)(appDir
|
|
4550
|
-
case "events": return (0, node_path.join)(appDir
|
|
4549
|
+
case "commands": return (0, node_path.join)(appDir, "commands");
|
|
4550
|
+
case "events": return (0, node_path.join)(appDir, "events");
|
|
4551
4551
|
default: return to;
|
|
4552
4552
|
}
|
|
4553
4553
|
}
|
|
@@ -5080,4 +5080,4 @@ Object.defineProperty(exports, 'useStore', {
|
|
|
5080
5080
|
return useStore;
|
|
5081
5081
|
}
|
|
5082
5082
|
});
|
|
5083
|
-
//# sourceMappingURL=commandkit
|
|
5083
|
+
//# sourceMappingURL=commandkit--k6yDJEr.js.map
|