commandkit 1.2.0-rc.13 → 1.2.0-rc.15
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/README.md +42 -23
- package/dist/{ActionRow-B-CGmjDp.d.ts → ActionRow-Bt9qi0Mb.d.ts} +2 -2
- package/dist/{Button-C-GPeFA3.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-CZT9MZsy.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-q_b3Mjv9.d.ts → SelectMenu-CY0vvoSu.d.ts} +15 -11
- 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 -24
- 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 -24
- package/dist/{analytics-engine-WQhXmx3H.d.ts → analytics-engine-DnRsHBId.d.ts} +846 -841
- package/dist/app/commands/AppCommandRunner.d.ts +1 -1
- package/dist/app/commands/AppCommandRunner.js +2 -24
- package/dist/app/commands/Context.d.ts +1 -1
- package/dist/app/commands/Context.js +2 -24
- 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 -24
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
- package/dist/app/handlers/AppEventsHandler.js +2 -24
- package/dist/app/index.d.ts +4 -4
- package/dist/app/index.js +13 -32
- 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 -24
- package/dist/app/register/CommandRegistrar.d.ts +1 -1
- package/dist/app/register/CommandRegistrar.js +2 -24
- 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 +15 -35
- 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 -59
- 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 +8 -7
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.d.ts +2 -2
- package/dist/cli/init.js +14 -33
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/production.d.ts +2 -2
- package/dist/cli/production.js +11 -33
- 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-SIjTLD2R.js → commandkit--k6yDJEr.js} +3157 -2699
- package/dist/commandkit--k6yDJEr.js.map +1 -0
- package/dist/commandkit.d.ts +1 -1
- package/dist/commandkit.js +2 -24
- 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 +2 -2
- package/dist/components/common/element.js +10 -8
- package/dist/components/common/types.d.ts +1 -1
- package/dist/components/common/types.js +1 -0
- package/dist/components/display/common.js +3 -2
- package/dist/components/display/container.d.ts +1 -1
- package/dist/components/display/container.js +3 -2
- 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 +18 -21
- package/dist/components/display/label.d.ts +1 -1
- package/dist/components/display/label.js +3 -2
- package/dist/components/display/media-gallery.d.ts +1 -1
- package/dist/components/display/media-gallery.js +4 -3
- package/dist/components/display/poll.d.ts +1 -1
- package/dist/components/display/poll.js +85 -4
- package/dist/{poll-CFe8yvoJ.js.map → components/display/poll.js.map} +1 -1
- package/dist/components/display/section.d.ts +1 -1
- package/dist/components/display/section.js +4 -3
- 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 +23 -23
- package/dist/components/index.js +28 -45
- 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 -24
- package/dist/components/interactive/button/ButtonKit.d.ts +1 -1
- package/dist/components/interactive/button/ButtonKit.js +2 -24
- package/dist/components/interactive/modal/Modal.d.ts +1 -1
- package/dist/components/interactive/modal/Modal.js +2 -24
- package/dist/components/interactive/modal/ModalKit.d.ts +1 -1
- package/dist/components/interactive/modal/ModalKit.js +2 -24
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +2 -24
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +2 -24
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +2 -24
- package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -1
- package/dist/components/interactive/select-menu/SelectMenu.js +2 -24
- package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/StringSelectMenuKit.js +2 -24
- package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/UserSelectMenuKit.js +2 -24
- 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 -24
- package/dist/config/default.d.ts +1 -1
- package/dist/config/default.js +2 -24
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.js +2 -24
- 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 -24
- package/dist/context/environment.d.ts +1 -1
- package/dist/context/environment.js +2 -24
- package/dist/{element-wQo0heGj.d.ts → element-DeLvTMfZ.d.ts} +5 -4
- 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 +5 -165
- 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 +31 -31
- package/dist/index.js +78 -97
- 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 -24
- 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 -24
- 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 -30
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +2 -24
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +2 -24
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +2 -24
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +2 -24
- 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 -24
- 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 -24
- package/dist/utils/warning.js +38 -4
- package/dist/utils/warning.js.map +1 -0
- package/dist/version.js +2 -1
- package/dist/version.js.map +1 -1
- package/package.json +12 -15
- package/dist/ActionRow-CSN_UKmM.js +0 -25
- package/dist/CommandKitEventsChannel-CnT5ymYe.js +0 -88
- package/dist/CommandKitEventsChannel-CnT5ymYe.js.map +0 -1
- package/dist/CommandsRouter-C_HLsrGX.js +0 -215
- package/dist/CommandsRouter-C_HLsrGX.js.map +0 -1
- package/dist/CompilerPlugin-CUsGAfgl.js +0 -43
- package/dist/CompilerPlugin-CUsGAfgl.js.map +0 -1
- package/dist/EventInterceptor-BWoEJMHZ.js +0 -142
- package/dist/EventInterceptor-BWoEJMHZ.js.map +0 -1
- package/dist/EventWorkerContext-Dfhgv329.js +0 -68
- package/dist/EventWorkerContext-Dfhgv329.js.map +0 -1
- package/dist/EventsRouter-DZYIha6m.js +0 -133
- package/dist/EventsRouter-DZYIha6m.js.map +0 -1
- package/dist/MessageCommandParser-Bs9fimmd.js +0 -271
- package/dist/MessageCommandParser-Bs9fimmd.js.map +0 -1
- package/dist/MessageCommandParser-q3dQcE5N.d.ts +0 -194
- package/dist/PluginCommon-BLxWww5u.js +0 -70
- package/dist/PluginCommon-BLxWww5u.js.map +0 -1
- package/dist/RuntimePlugin-CtobluSU.js +0 -134
- package/dist/RuntimePlugin-CtobluSU.js.map +0 -1
- package/dist/colors-Csc0X4QJ.js +0 -14
- package/dist/colors-Csc0X4QJ.js.map +0 -1
- package/dist/commandkit-SIjTLD2R.js.map +0 -1
- package/dist/common-C2jAjX4U.js +0 -0
- package/dist/common-CEordwf3.js +0 -17
- package/dist/common-CEordwf3.js.map +0 -1
- package/dist/common-DSRs_mfw.js +0 -222
- package/dist/common-DSRs_mfw.js.map +0 -1
- package/dist/constants-BFFK-hfP.js +0 -27
- package/dist/constants-BFFK-hfP.js.map +0 -1
- package/dist/constants-Cw8VjCVz.js +0 -36
- package/dist/constants-Cw8VjCVz.js.map +0 -1
- package/dist/constants-CxkFFZ7p.js +0 -85
- package/dist/constants-CxkFFZ7p.js.map +0 -1
- package/dist/container-DCPljKVH.js +0 -43
- package/dist/container-DCPljKVH.js.map +0 -1
- package/dist/display-WDb9wMCv.js +0 -0
- package/dist/element-DibzzA5L.js +0 -84
- package/dist/element-DibzzA5L.js.map +0 -1
- package/dist/env-CmspDhHy.js +0 -113
- package/dist/env-CmspDhHy.js.map +0 -1
- package/dist/error-codes-Ds0bnPvT.js +0 -73
- package/dist/error-codes-Ds0bnPvT.js.map +0 -1
- package/dist/file-Ca1kpEtE.js +0 -28
- package/dist/file-Ca1kpEtE.js.map +0 -1
- package/dist/flags/feature-flags.js.map +0 -1
- package/dist/helpers-Btx1FSZx.js +0 -35
- package/dist/helpers-Btx1FSZx.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/label-B6vXvwLM.js +0 -35
- package/dist/label-B6vXvwLM.js.map +0 -1
- package/dist/media-gallery-u3gjX7yD.js +0 -61
- package/dist/media-gallery-u3gjX7yD.js.map +0 -1
- package/dist/poll-CFe8yvoJ.js +0 -100
- package/dist/resolve-file-url-CdHqwWs3.js +0 -23
- package/dist/resolve-file-url-CdHqwWs3.js.map +0 -1
- package/dist/router-BvamdzoF.js +0 -0
- package/dist/runtime-Skt5NiOc.js +0 -0
- package/dist/section-BC8LF-B2.js +0 -59
- package/dist/section-BC8LF-B2.js.map +0 -1
- package/dist/separator-BUTiW7uz.js +0 -26
- package/dist/separator-BUTiW7uz.js.map +0 -1
- package/dist/signals-B8z1wJ6W.js +0 -74
- package/dist/signals-B8z1wJ6W.js.map +0 -1
- package/dist/store-D8r_hryO.js +0 -18
- package/dist/store-D8r_hryO.js.map +0 -1
- package/dist/text-display-DANahMN3.js +0 -31
- package/dist/text-display-DANahMN3.js.map +0 -1
- package/dist/type-checker-cVd3Hpnh.js +0 -88
- package/dist/type-checker-cVd3Hpnh.js.map +0 -1
- package/dist/types-Cdh4uaFR.js +0 -0
- package/dist/types-TC4g3w91.js +0 -0
- package/dist/types-package-CsTNfvv2.js +0 -71
- package/dist/types-package-CsTNfvv2.js.map +0 -1
- package/dist/utils-Br3eenD1.js +0 -34
- package/dist/utils-Br3eenD1.js.map +0 -1
- package/dist/warning-CszH8HeS.js +0 -53
- package/dist/warning-CszH8HeS.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
package/README.md
CHANGED
|
@@ -6,43 +6,62 @@
|
|
|
6
6
|
<a href="https://www.npmjs.com/package/commandkit"><img src="https://img.shields.io/npm/dt/commandkit?maxAge=3600" alt="npm downloads" /></a>
|
|
7
7
|
</div>
|
|
8
8
|
|
|
9
|
-
<p align="center">
|
|
9
|
+
<p align="center">Stop rebuilding command and event handlers for every new discord.js bot. CommandKit does it for you — and a lot more.</p>
|
|
10
|
+
|
|
11
|
+
## Why CommandKit?
|
|
12
|
+
|
|
13
|
+
Every new discord.js project starts the same way: write a command handler, write an event handler, set up interaction collectors, register slash commands with the API, figure out a project structure. It's hours of boilerplate before you write any real bot logic.
|
|
14
|
+
|
|
15
|
+
Most existing discord.js frameworks solve this by giving you a handler class you instantiate and point at a folder — and that's about it. They're loaders, not frameworks. Others like Sapphire go further and have decent features, but require heavy OOP boilerplate where everything is a class extending a base class.
|
|
16
|
+
|
|
17
|
+
CommandKit takes a different approach entirely. It works like a proper meta-framework — think **Next.js for Discord bots**. It ships with a smart CLI that handles bundling, TypeScript/JSX compilation, hot-reloading, command registration, and project scaffolding automatically. You run `commandkit dev` and everything just works — zero configuration.
|
|
18
|
+
|
|
19
|
+
The design philosophy is **convention over configuration**: put a file in `src/app/commands/` and it's a command. Put a file in `src/app/events/` and it's an event listener. Export a `chatInput` function and it handles slash commands. Export a `message` function in the same file and it handles prefix commands too. No registration calls, no base classes, no decorators. The framework knows what to do with your code based on where it is and what it exports — so you skip the setup and go straight to building.
|
|
10
20
|
|
|
11
21
|
## Features
|
|
12
22
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- Slash + context menu commands + prefix commands support ✅
|
|
16
|
-
- Automatic command registration and updates 🤖
|
|
17
|
-
- Command middlewares for easy command management 🛠️
|
|
18
|
-
- Localization support through `@commandkit/i18n` plugin 🌍
|
|
19
|
-
- Plugin system to extend functionality 🔌
|
|
20
|
-
- Built-in command line interface for easy development 🖥️
|
|
21
|
-
- Out-of-the-box support for TypeScript and JavaScript 📜
|
|
22
|
-
- Built-in customizable cache system for speedy data storage and retrieval 🗄️
|
|
23
|
-
- User installable/guild scoped commands 🔧
|
|
24
|
-
- Custom events support 🔔
|
|
25
|
-
- JSX support for declaring Discord interaction components and modals 🎨
|
|
26
|
-
- Easy to use interaction components and modals system (forget about collectors) 🧩
|
|
27
|
-
- Less boilerplate code, more productivity 💪
|
|
28
|
-
- and much more...
|
|
23
|
+
### Automatic command and event handling
|
|
24
|
+
Drop your command files in a folder, export a function, and they just work. Slash commands, context menu commands, and prefix commands are all supported under a single unified command structure — no separate handler for each type. Commands are automatically registered and kept in sync with Discord. Events work the same way: create a file, export a listener, and CommandKit handles the rest.
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
### JSX components for Discord UI
|
|
27
|
+
discord.js builder chains (`ActionRowBuilder` → `ButtonBuilder` → `setCustomId` → ...) get messy fast. CommandKit lets you write Discord components in JSX — the same declarative syntax used in React — so your UI code is clean and readable.
|
|
28
|
+
|
|
29
|
+
### Built-in component handlers (no more collectors)
|
|
30
|
+
Buttons get `onClick`. Modals get `onSubmit`. Select menus get `onSelect`. Define a component and its behavior in one place — no `InteractionCollector` setup, no timeout management, no cleanup boilerplate.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
### Command middlewares
|
|
33
|
+
Run logic before or after any command executes — permission checks, cooldowns, logging, analytics — without touching the command itself. A proper middleware layer, like you'd find in Express.
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
### Unified prefix commands
|
|
36
|
+
Message-based (prefix) commands live in the same file as your slash commands and context menus. One command file handles all input types. No separate handler needed.
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
### Caching with Redis support
|
|
39
|
+
The `@commandkit/cache` plugin gives you a customizable caching layer — in-memory by default, Redis-backed when you need persistence. Just add the `'use cache'` directive to any function.
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
### Plugin system with custom events
|
|
42
|
+
Extend CommandKit through plugins that hook into the framework lifecycle. Plugins can emit custom events — for example, listening to an external webhook and firing events your bot can react to. This isn't a wrapper around `node:events`; it's a structured extension system for building modular, decoupled bot features. Official plugins include `@commandkit/i18n` for localization and `@commandkit/analytics` for usage tracking.
|
|
39
43
|
|
|
44
|
+
### AI-powered command execution
|
|
45
|
+
The `@commandkit/ai` plugin lets users interact with your bot through natural language. Instead of memorizing slash command names, users just talk to your bot — and the AI figures out which command to run. Built on the [AI SDK](https://ai-sdk.dev) with support for Google Gemini, OpenAI, and more. Includes built-in tools, custom tool support, lifecycle hooks, and per-user model selection.
|
|
46
|
+
|
|
47
|
+
### Zero-config TypeScript and JavaScript
|
|
48
|
+
Native TypeScript and JSX support with no configuration. No `tsconfig.json` fiddling, no separate build step, no bundler setup. The CLI handles compilation, bundling, hot-reloading, and project scaffolding.
|
|
49
|
+
|
|
50
|
+
## Who is this for?
|
|
51
|
+
|
|
52
|
+
- **Beginners** who don't want to spend hours building handlers before they can do anything useful
|
|
53
|
+
- **Experienced developers** tired of rebuilding the same boilerplate for every new bot project
|
|
54
|
+
- **Teams and freelancers** who need a reliable, structured foundation they can build on quickly
|
|
55
|
+
|
|
56
|
+
CommandKit has been used in production client projects and has saved hours of setup time on each one. It's not overhead — it's the setup work you'd do anyway, already done well.
|
|
57
|
+
|
|
58
|
+
## Getting Started
|
|
40
59
|
|
|
41
60
|
```bash
|
|
42
61
|
npm create commandkit
|
|
43
62
|
```
|
|
44
63
|
|
|
45
|
-
|
|
64
|
+
Follow the prompts, then run `commandkit dev` to start your bot. Check out the [documentation](https://commandkit.dev) for guides and API reference.
|
|
46
65
|
|
|
47
66
|
## Support and Suggestions
|
|
48
67
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as CommandKitElement, t as AnyCommandKitElement } from "./element-
|
|
1
|
+
import { n as CommandKitElement, t as AnyCommandKitElement } from "./element-DeLvTMfZ.js";
|
|
2
2
|
|
|
3
3
|
//#region src/components/interactive/action-row/ActionRow.d.ts
|
|
4
4
|
/**
|
|
@@ -16,4 +16,4 @@ interface ActionRowProps {
|
|
|
16
16
|
declare function ActionRow(props: ActionRowProps): CommandKitElement<'action-row'>;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { ActionRowProps as n, ActionRow as t };
|
|
19
|
-
//# sourceMappingURL=ActionRow-
|
|
19
|
+
//# sourceMappingURL=ActionRow-Bt9qi0Mb.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as EventInterceptorErrorHandler } from "./EventInterceptor-
|
|
2
|
-
import { a as CommandKitButtonBuilderOnEnd, i as CommandKitButtonBuilderInteractionCollectorDispatchContextData, r as CommandKitButtonBuilderInteractionCollectorDispatch } from "./ButtonKit-
|
|
3
|
-
import { n as CommandKitElement } from "./element-
|
|
4
|
-
import { t as MaybeArray } from "./types-
|
|
1
|
+
import { r as EventInterceptorErrorHandler } from "./EventInterceptor-D9JKMcfi.js";
|
|
2
|
+
import { a as CommandKitButtonBuilderOnEnd, i as CommandKitButtonBuilderInteractionCollectorDispatchContextData, r as CommandKitButtonBuilderInteractionCollectorDispatch } from "./ButtonKit-BfcyvWfj.js";
|
|
3
|
+
import { n as CommandKitElement } from "./element-DeLvTMfZ.js";
|
|
4
|
+
import { t as MaybeArray } from "./types-DZy7U-Ld.js";
|
|
5
5
|
import { ButtonStyle, ComponentEmojiResolvable } from "discord.js";
|
|
6
6
|
|
|
7
7
|
//#region src/components/interactive/button/Button.d.ts
|
|
@@ -35,4 +35,4 @@ interface ButtonProps {
|
|
|
35
35
|
declare function Button(props: ButtonProps): CommandKitElement<'button-kit'>;
|
|
36
36
|
//#endregion
|
|
37
37
|
export { ButtonChildrenLike as n, ButtonProps as r, Button as t };
|
|
38
|
-
//# sourceMappingURL=Button-
|
|
38
|
+
//# sourceMappingURL=Button-DxJLcZIU.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as EventInterceptorContextData, r as EventInterceptorErrorHandler } from "./EventInterceptor-
|
|
1
|
+
import { n as EventInterceptorContextData, r as EventInterceptorErrorHandler } from "./EventInterceptor-D9JKMcfi.js";
|
|
2
2
|
import { Awaitable, ButtonBuilder, ButtonInteraction, Events } from "discord.js";
|
|
3
3
|
|
|
4
4
|
//#region src/components/interactive/button/ButtonKit.d.ts
|
|
@@ -38,49 +38,49 @@ type CommandKitButtonBuilderInteractionCollectorDispatchContextData = EventInter
|
|
|
38
38
|
declare class ButtonKit extends ButtonBuilder {
|
|
39
39
|
#private;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
41
|
+
* Sets up an inline interaction collector for this button. This collector by default allows as many interactions as possible if it is actively used.
|
|
42
|
+
* If unused, this expires after 24 hours or custom time if specified.
|
|
43
|
+
* @param handler The handler to run when the button is clicked
|
|
44
|
+
* @param data The context data to use for the interaction collector
|
|
45
|
+
* @returns This button
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const button = new ButtonKit()
|
|
49
|
+
* .setLabel('Click me')
|
|
50
|
+
* .setStyle(ButtonStyle.Primary)
|
|
51
|
+
* .setCustomId('click_me')
|
|
52
|
+
* .filter((interaction) => interaction.user.id === '1234567890')
|
|
53
|
+
* .onClick(async (interaction) => {
|
|
54
|
+
* await interaction.reply('You clicked me!');
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* const row = new ActionRowBuilder().addComponents(button);
|
|
58
|
+
*
|
|
59
|
+
* const message = await channel.send({ content: 'Click the button', components: [row] });
|
|
60
|
+
*
|
|
61
|
+
* // Remove onClick handler and destroy the interaction collector
|
|
62
|
+
* button.onClick(null);
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
65
|
onClick(handler: CommandKitButtonBuilderInteractionCollectorDispatch, data?: CommandKitButtonBuilderInteractionCollectorDispatchContextData): this;
|
|
66
66
|
onEnd(handler: CommandKitButtonBuilderOnEnd): this;
|
|
67
67
|
/**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
* Sets the handler to run when the interaction collector ends.
|
|
69
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
70
|
+
* @returns This instance of the modal builder.
|
|
71
|
+
*/
|
|
72
72
|
onError(handler: EventInterceptorErrorHandler): this;
|
|
73
73
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
* Sets a filter for the interaction collector.
|
|
75
|
+
* @param predicate The filter to use for the interaction collector
|
|
76
|
+
*/
|
|
77
77
|
filter(predicate: ButtonKitPredicate): this;
|
|
78
78
|
private get customId();
|
|
79
79
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
* Disposes of the button collector and cleans up resources.
|
|
81
|
+
*/
|
|
82
82
|
dispose(): this;
|
|
83
83
|
}
|
|
84
84
|
//#endregion
|
|
85
85
|
export { CommandKitButtonBuilderOnEnd as a, CommandKitButtonBuilderInteractionCollectorDispatchContextData as i, ButtonKitPredicate as n, OnButtonKitClick as o, CommandKitButtonBuilderInteractionCollectorDispatch as r, OnButtonKitEnd as s, ButtonKit as t };
|
|
86
|
-
//# sourceMappingURL=ButtonKit-
|
|
86
|
+
//# sourceMappingURL=ButtonKit-BfcyvWfj.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as EventInterceptorErrorHandler } from "./EventInterceptor-
|
|
2
|
-
import { a as OnSelectMenuKitSubmit, n as CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, o as SelectMenuKitPredicate, r as CommandKitSelectMenuBuilderOnEnd, t as CommandKitSelectMenuBuilderInteractionCollectorDispatch } from "./common-
|
|
1
|
+
import { r as EventInterceptorErrorHandler } from "./EventInterceptor-D9JKMcfi.js";
|
|
2
|
+
import { a as OnSelectMenuKitSubmit, n as CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, o as SelectMenuKitPredicate, r as CommandKitSelectMenuBuilderOnEnd, t as CommandKitSelectMenuBuilderInteractionCollectorDispatch } from "./common-CCvvgnxi.js";
|
|
3
3
|
import { ChannelSelectMenuBuilder, ChannelSelectMenuInteraction } from "discord.js";
|
|
4
4
|
|
|
5
5
|
//#region src/components/interactive/select-menu/ChannelSelectMenuKit.d.ts
|
|
@@ -20,47 +20,47 @@ type ChannelSelectMenuKitPredicate = SelectMenuKitPredicate<ChannelSelectMenuInt
|
|
|
20
20
|
declare class ChannelSelectMenuKit extends ChannelSelectMenuBuilder {
|
|
21
21
|
#private;
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
* Sets the handler to run when the modal is submitted.
|
|
24
|
+
* @param handler - The handler to run when the modal is submitted.
|
|
25
|
+
* @param data - The context data for the interaction collector.
|
|
26
|
+
* @returns This instance of the modal builder.
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const modal = new ChannelSelectMenuKit()
|
|
30
|
+
* .setTitle('My Modal')
|
|
31
|
+
* .setCustomId('my-modal')
|
|
32
|
+
* .filter((interaction) => interaction.Channel.id === '1234567890')
|
|
33
|
+
* .onSelect(async (interaction) => {
|
|
34
|
+
* await interaction.reply('You submitted the modal!');
|
|
35
|
+
* })
|
|
36
|
+
* .addComponents(actionRow1, actionRow2);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
39
|
onSelect(handler: CommandKitSelectMenuBuilderInteractionCollectorDispatch<ChannelSelectMenuInteraction, ChannelSelectMenuKit>, data?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData): this;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
* Sets the handler to run when the interaction collector ends.
|
|
42
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
43
|
+
* @returns This instance of the modal builder.
|
|
44
|
+
*/
|
|
45
45
|
onEnd(handler: CommandKitSelectMenuBuilderOnEnd): this;
|
|
46
46
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
* Sets the handler to run when the interaction collector ends.
|
|
48
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
49
|
+
* @returns This instance of the modal builder.
|
|
50
|
+
*/
|
|
51
51
|
onError(handler: EventInterceptorErrorHandler): this;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
* Sets a filter for the interaction collector.
|
|
54
|
+
* @param predicate - The filter to use for the interaction collector.
|
|
55
|
+
* @returns This instance of the modal builder.
|
|
56
|
+
*/
|
|
57
57
|
filter(predicate: SelectMenuKitPredicate<ChannelSelectMenuInteraction>): this;
|
|
58
58
|
private get customId();
|
|
59
59
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
* Cleans up the interaction collector and removes the handler.
|
|
61
|
+
*/
|
|
62
62
|
dispose(): this;
|
|
63
63
|
}
|
|
64
64
|
//#endregion
|
|
65
65
|
export { ChannelSelectMenuKitPredicate as n, OnChannelSelectMenuKitSubmit as r, ChannelSelectMenuKit as t };
|
|
66
|
-
//# sourceMappingURL=ChannelSelectMenuKit-
|
|
66
|
+
//# sourceMappingURL=ChannelSelectMenuKit-DYkudikb.d.ts.map
|
|
@@ -44,53 +44,53 @@ interface CommandsRouterOptions {
|
|
|
44
44
|
declare class CommandsRouter {
|
|
45
45
|
private readonly options;
|
|
46
46
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
* @private
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
50
|
private commands;
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
* @private
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
55
|
private middlewares;
|
|
56
56
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
* Creates a new CommandsRouter instance.
|
|
58
|
+
* @param options - Configuration options for the router
|
|
59
|
+
*/
|
|
60
60
|
constructor(options: CommandsRouterOptions);
|
|
61
61
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
* Populates the router with existing command and middleware data.
|
|
63
|
+
* @param data - Parsed command data to populate with
|
|
64
|
+
*/
|
|
65
65
|
populate(data: ParsedCommandData): void;
|
|
66
66
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
* Checks if the configured entrypoint path exists.
|
|
68
|
+
* @returns True if the path exists
|
|
69
|
+
*/
|
|
70
70
|
isValidPath(): boolean;
|
|
71
71
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
* @private
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
75
|
private isCommand;
|
|
76
76
|
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
* @private
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
80
|
private isMiddleware;
|
|
81
81
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
* @private
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
85
|
private isCategory;
|
|
86
86
|
/**
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
* Clears all loaded commands and middleware.
|
|
88
|
+
*/
|
|
89
89
|
clear(): void;
|
|
90
90
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
* Scans the filesystem for commands and middleware files.
|
|
92
|
+
* @returns Parsed command data
|
|
93
|
+
*/
|
|
94
94
|
scan(): Promise<{
|
|
95
95
|
commands: {
|
|
96
96
|
[k: string]: Command;
|
|
@@ -100,17 +100,17 @@ declare class CommandsRouter {
|
|
|
100
100
|
};
|
|
101
101
|
}>;
|
|
102
102
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
* Gets the raw command and middleware collections.
|
|
104
|
+
* @returns Object containing commands and middlewares collections
|
|
105
|
+
*/
|
|
106
106
|
getData(): {
|
|
107
107
|
commands: Collection<string, Command>;
|
|
108
108
|
middlewares: Collection<string, Middleware>;
|
|
109
109
|
};
|
|
110
110
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
* Converts the loaded data to a JSON-serializable format.
|
|
112
|
+
* @returns Plain object with commands and middlewares
|
|
113
|
+
*/
|
|
114
114
|
toJSON(): {
|
|
115
115
|
commands: {
|
|
116
116
|
[k: string]: Command;
|
|
@@ -120,26 +120,26 @@ declare class CommandsRouter {
|
|
|
120
120
|
};
|
|
121
121
|
};
|
|
122
122
|
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
* @private
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
126
|
private traverse;
|
|
127
127
|
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
* @private
|
|
129
|
+
* @internal
|
|
130
|
+
*/
|
|
131
131
|
private handle;
|
|
132
132
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
* @private
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
136
|
private applyMiddlewares;
|
|
137
137
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
* @private
|
|
139
|
+
* @internal
|
|
140
|
+
*/
|
|
141
141
|
private replaceEntrypoint;
|
|
142
142
|
}
|
|
143
143
|
//#endregion
|
|
144
144
|
export { ParsedCommandData as a, Middleware as i, CommandsRouter as n, CommandsRouterOptions as r, Command as t };
|
|
145
|
-
//# sourceMappingURL=CommandsRouter-
|
|
145
|
+
//# sourceMappingURL=CommandsRouter-DiNoF0dq.d.ts.map
|
|
@@ -3,28 +3,28 @@ import { Awaitable, Client, ClientEvents } from "discord.js";
|
|
|
3
3
|
//#region src/components/common/EventInterceptor.d.ts
|
|
4
4
|
interface EventInterceptorContextData<E extends keyof ClientEvents> {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* The filter to use for the collector.
|
|
7
|
+
*/
|
|
8
8
|
filter?: (...args: ClientEvents[E]) => Awaitable<boolean>;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* The duration (in ms) that the collector should run for.
|
|
11
|
+
*/
|
|
12
12
|
time?: number;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* If the collector should automatically reset the timer when a button is clicked.
|
|
15
|
+
*/
|
|
16
16
|
autoReset?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
* Whether the collector should run only once.
|
|
19
|
+
*/
|
|
20
20
|
once?: boolean;
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
* The handler to run when the collector ends.
|
|
23
|
+
*/
|
|
24
24
|
onEnd?: (reason: string) => Awaitable<void>;
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
* The handler to run upon an error.
|
|
27
|
+
*/
|
|
28
28
|
onError?: EventInterceptorErrorHandler;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
@@ -42,50 +42,50 @@ declare class EventInterceptor {
|
|
|
42
42
|
private globalHandlers;
|
|
43
43
|
private cleanupTimer;
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
* Creates the event interceptor.
|
|
46
|
+
*/
|
|
47
47
|
constructor(client: Client);
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
* Destroys the event interceptor.
|
|
50
|
+
*/
|
|
51
51
|
destroy(): void;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
* Whether the event has subscribers.
|
|
54
|
+
* @param event The event to check.
|
|
55
|
+
*/
|
|
56
56
|
hasSubscribers(event: keyof ClientEvents): boolean;
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
* Returns the number of subscribers for the event.
|
|
59
|
+
* @param event The event to check.
|
|
60
|
+
*/
|
|
61
61
|
getSubscriberCount(event: keyof ClientEvents): number;
|
|
62
62
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
* Whether the event has global handlers.
|
|
64
|
+
*/
|
|
65
65
|
hasGlobalHandlers(): boolean;
|
|
66
66
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
* Returns the number of global handlers.
|
|
68
|
+
*/
|
|
69
69
|
getGlobalHandlersCount(): number;
|
|
70
70
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
* Subscribes to an event.
|
|
72
|
+
* @param event The event to subscribe to.
|
|
73
|
+
* @param listener The listener to call when the event is emitted.
|
|
74
|
+
* @returns A function to unsubscribe from the event.
|
|
75
|
+
*/
|
|
76
76
|
subscribe<Event extends keyof ClientEvents>(event: Event, listener: (...args: ClientEvents[Event]) => void, options?: EventInterceptorContextData<Event>): () => void;
|
|
77
77
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
* Unsubscribes from an event.
|
|
79
|
+
* @param event The event to unsubscribe from.
|
|
80
|
+
*/
|
|
81
81
|
unsubscribe<Event extends keyof ClientEvents>(event: Event, listener: (...args: ClientEvents[Event]) => void, reason?: string): void;
|
|
82
82
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
* Creates a global handler for the event.
|
|
84
|
+
* @param event The event to create a global handler for.
|
|
85
|
+
* @returns The global handler.
|
|
86
|
+
*/
|
|
87
87
|
private createGlobalHandler;
|
|
88
88
|
}
|
|
89
89
|
//#endregion
|
|
90
90
|
export { EventInterceptorContextData as n, EventInterceptorErrorHandler as r, EventInterceptor as t };
|
|
91
|
-
//# sourceMappingURL=EventInterceptor-
|
|
91
|
+
//# sourceMappingURL=EventInterceptor-D9JKMcfi.d.ts.map
|