commandkit 1.0.0-dev.20250601124817 → 1.0.0-dev.20250601135251

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.
Files changed (116) hide show
  1. package/dist/{CommandKit-DDSUNOAe.d.ts → CommandKit-LJlFFidn.d.ts} +12 -9
  2. package/dist/{CommandKit-DbKHr6qT.js → CommandKit-pZKcOltw.js} +101 -20
  3. package/dist/CommandKit-pZKcOltw.js.map +1 -0
  4. package/dist/CommandKit.d.ts +2 -2
  5. package/dist/CommandKit.js +5 -10
  6. package/dist/{EventWorkerContext-CjU5wt-a.d.ts → EventWorkerContext-sHV9x0eB.d.ts} +2 -2
  7. package/dist/app/commands/AppCommandRunner.d.ts +2 -2
  8. package/dist/app/commands/AppCommandRunner.js +4 -4
  9. package/dist/app/commands/Context.d.ts +2 -2
  10. package/dist/app/commands/Context.js +4 -4
  11. package/dist/app/events/EventWorkerContext.d.ts +3 -3
  12. package/dist/app/handlers/AppCommandHandler.d.ts +2 -2
  13. package/dist/app/handlers/AppCommandHandler.js +4 -4
  14. package/dist/app/handlers/AppEventsHandler.d.ts +2 -2
  15. package/dist/app/handlers/AppEventsHandler.js +4 -4
  16. package/dist/app/index.d.ts +2 -2
  17. package/dist/app/index.js +4 -4
  18. package/dist/app/register/CommandRegistrar.d.ts +2 -2
  19. package/dist/app/register/CommandRegistrar.js +4 -4
  20. package/dist/{app-process-juzsCZp9.js → app-process-DGKqfi5y.js} +3 -3
  21. package/dist/{app-process-juzsCZp9.js.map → app-process-DGKqfi5y.js.map} +1 -1
  22. package/dist/{build-BB9ezwQN.js → build-CXO5bwcP.js} +13 -9
  23. package/dist/{build-BB9ezwQN.js.map → build-CXO5bwcP.js.map} +1 -1
  24. package/dist/cli/app-process.d.ts +2 -2
  25. package/dist/cli/app-process.js +5 -5
  26. package/dist/cli/build.d.ts +2 -2
  27. package/dist/cli/build.js +7 -7
  28. package/dist/cli/common.d.ts +6 -6
  29. package/dist/cli/common.js +3 -3
  30. package/dist/cli/development.js +8 -8
  31. package/dist/cli/env.d.ts +2 -1
  32. package/dist/cli/env.js +3 -2
  33. package/dist/cli/generators.js +3 -3
  34. package/dist/cli/information.js +1 -1
  35. package/dist/cli/init.js +5 -5
  36. package/dist/cli/production.js +8 -8
  37. package/dist/cli/type-checker.js +4 -4
  38. package/dist/{common-CtMBxAf-.js → common-CoUM9Czx.js} +2 -2
  39. package/dist/{common-CtMBxAf-.js.map → common-CoUM9Czx.js.map} +1 -1
  40. package/dist/components/index.js +4 -4
  41. package/dist/components/v1/button/Button.js +4 -4
  42. package/dist/components/v1/button/ButtonKit.js +4 -4
  43. package/dist/components/v1/modal/Modal.js +4 -4
  44. package/dist/components/v1/modal/ModalKit.js +4 -4
  45. package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +4 -4
  46. package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +4 -4
  47. package/dist/components/v1/select-menu/RoleSelectMenuKit.js +4 -4
  48. package/dist/components/v1/select-menu/SelectMenu.js +4 -4
  49. package/dist/components/v1/select-menu/StringSelectMenuKit.js +4 -4
  50. package/dist/components/v1/select-menu/UserSelectMenuKit.js +4 -4
  51. package/dist/config/config.d.ts +5 -5
  52. package/dist/config/config.js +4 -4
  53. package/dist/config/default.d.ts +4 -4
  54. package/dist/config/default.js +4 -4
  55. package/dist/config/loader.d.ts +4 -4
  56. package/dist/config/loader.js +4 -4
  57. package/dist/config/types.d.ts +3 -3
  58. package/dist/config/utils.d.ts +4 -4
  59. package/dist/{config-LPxTebft.d.ts → config-bs6v9gyT.d.ts} +3 -3
  60. package/dist/{constants-Ce6w4OFe.d.ts → constants-BPWSrMkn.d.ts} +3 -2
  61. package/dist/{constants-DOPSzXI0.js → constants-CCqS_v55.js} +8 -1
  62. package/dist/constants-CCqS_v55.js.map +1 -0
  63. package/dist/context/async-context.d.ts +2 -2
  64. package/dist/context/async-context.js +4 -4
  65. package/dist/context/environment.d.ts +2 -2
  66. package/dist/context/environment.js +4 -4
  67. package/dist/{env-DXL8PZiG.js → env-D3rn_eei.js} +10 -1
  68. package/dist/{env-DXL8PZiG.js.map → env-D3rn_eei.js.map} +1 -1
  69. package/dist/events/CommandKitEventsChannel.d.ts +2 -2
  70. package/dist/{feature-flags-DqKVc2-p.js → feature-flags-DhHcB5h5.js} +2 -2
  71. package/dist/{feature-flags-DqKVc2-p.js.map → feature-flags-DhHcB5h5.js.map} +1 -1
  72. package/dist/flags/feature-flags.d.ts +2 -2
  73. package/dist/flags/feature-flags.js +5 -5
  74. package/dist/flags/store.d.ts +2 -2
  75. package/dist/index.d.ts +8 -8
  76. package/dist/index.js +9 -13
  77. package/dist/{init-O2deAczC.js → init-B_2lOZKJ.js} +9 -4
  78. package/dist/init-B_2lOZKJ.js.map +1 -0
  79. package/dist/logger/DefaultLogger.js +4 -4
  80. package/dist/logger/Logger.js +4 -4
  81. package/dist/plugins/CompilerPlugin.d.ts +2 -2
  82. package/dist/plugins/PluginCommon.d.ts +2 -2
  83. package/dist/plugins/RuntimePlugin.d.ts +2 -2
  84. package/dist/plugins/index.d.ts +2 -2
  85. package/dist/plugins/index.js +4 -4
  86. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +2 -2
  87. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +4 -4
  88. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +2 -2
  89. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +2 -2
  90. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +4 -4
  91. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +2 -2
  92. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +4 -4
  93. package/dist/plugins/plugin-runtime/runtime.d.ts +2 -2
  94. package/dist/plugins/types.d.ts +2 -2
  95. package/dist/{type-checker-BILXtCjQ.js → type-checker-FHABnKlq.js} +2 -2
  96. package/dist/{type-checker-BILXtCjQ.js.map → type-checker-FHABnKlq.js.map} +1 -1
  97. package/dist/{types-w2bWHUve.d.ts → types--Jq7UV8B.d.ts} +2 -2
  98. package/dist/{types-package-BrES1tNq.js → types-package-B0Z-xrbB.js} +2 -2
  99. package/dist/{types-package-BrES1tNq.js.map → types-package-B0Z-xrbB.js.map} +1 -1
  100. package/dist/types.d.ts +2 -2
  101. package/dist/{utilities-oDL3vjhR.d.ts → utilities-DpA7EalK.d.ts} +12 -2
  102. package/dist/utils/constants.d.ts +2 -2
  103. package/dist/utils/constants.js +2 -1
  104. package/dist/utils/dev-hooks.d.ts +2 -2
  105. package/dist/utils/dev-hooks.js +4 -4
  106. package/dist/utils/types-package.js +2 -2
  107. package/dist/utils/utilities.d.ts +2 -2
  108. package/dist/utils/utilities.js +5 -4
  109. package/dist/{utils-Dprjd7Oz.d.ts → utils-BJAW-jcv.d.ts} +2 -2
  110. package/dist/{version-BLxI87nt.js → version-wRFKSz6q.js} +2 -2
  111. package/dist/{version-BLxI87nt.js.map → version-wRFKSz6q.js.map} +1 -1
  112. package/dist/version.js +1 -1
  113. package/package.json +2 -2
  114. package/dist/CommandKit-DbKHr6qT.js.map +0 -1
  115. package/dist/constants-DOPSzXI0.js.map +0 -1
  116. package/dist/init-O2deAczC.js.map +0 -1
@@ -3,10 +3,9 @@ import { Fragment, createElement } from "./element-D_nyVwgB.js";
3
3
  import { MessageCommandOptions, MessageCommandParser } from "./MessageCommandParser-tzroBwij.js";
4
4
  import { Command, CommandsRouter, Middleware } from "./CommandsRouter-C7X-eXE2.js";
5
5
  import { EventsRouter, ParsedEvent } from "./EventsRouter-BacqK6z3.js";
6
- import { HMREventType } from "./constants-Ce6w4OFe.js";
7
- import * as discord_js0 from "discord.js";
8
- import { AutocompleteInteraction, Awaitable, CacheType, ChatInputCommandInteraction, Client, ClientEvents, Collection, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Guild, Interaction, Locale, Message, MessageContextMenuCommandInteraction, RESTPostAPIApplicationCommandsJSONBody, SlashCommandBuilder, TextBasedChannel, UserContextMenuCommandInteraction } from "discord.js";
6
+ import { HMREventType } from "./constants-BPWSrMkn.js";
9
7
  import EventEmitter from "node:events";
8
+ import { AutocompleteInteraction, Awaitable, CacheType, ChatInputCommandInteraction, Client, ClientEvents, Collection, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Guild, Interaction, Locale, Message, MessageContextMenuCommandInteraction, RESTPostAPIApplicationCommandsJSONBody, SlashCommandBuilder, TextBasedChannel, UserContextMenuCommandInteraction } from "discord.js";
10
9
  import { DirectiveTransformerOptions } from "directive-to-hof";
11
10
 
12
11
  //#region src/types.d.ts
@@ -17,7 +16,7 @@ interface CommandKitOptions {
17
16
  /**
18
17
  * The Discord.js client object to use with CommandKit.
19
18
  */
20
- client: Client;
19
+ client?: Client;
21
20
  }
22
21
  /**
23
22
  * Represents a command context.
@@ -823,7 +822,6 @@ interface CommandKitConfiguration {
823
822
  defaultLocale: Locale;
824
823
  getMessageCommandPrefix: (message: Message) => Awaitable<string | string[]>;
825
824
  }
826
- declare let commandkit: CommandKit;
827
825
  type BootstrapFunction = GenericFunction<[CommandKit]> | AsyncFunction<[CommandKit]>;
828
826
  /**
829
827
  * Registers a bootstrap hook that will be called when the CommandKit instance is created.
@@ -855,7 +853,6 @@ declare function onBootstrap<F extends BootstrapFunction>(fn: F): void;
855
853
  declare function onApplicationBootstrap<F extends BootstrapFunction>(fn: F): void;
856
854
  declare class CommandKit extends EventEmitter {
857
855
  #private;
858
- private options;
859
856
  eventInterceptor: EventInterceptor;
860
857
  static readonly createElement: typeof createElement;
861
858
  static readonly Fragment: typeof Fragment;
@@ -875,7 +872,7 @@ declare class CommandKit extends EventEmitter {
875
872
  * @param options - The default CommandKit configuration.
876
873
  * @see {@link https://commandkit.js.org/docs/guide/commandkit-setup}
877
874
  */
878
- constructor(options: CommandKitOptions);
875
+ constructor(options?: CommandKitOptions);
879
876
  /**
880
877
  * Starts the commandkit application.
881
878
  * @param token The application token to connect to the discord gateway. If not provided, it will use the `TOKEN` or `DISCORD_TOKEN` environment variable. If set to `false`, it will not login.
@@ -902,7 +899,12 @@ declare class CommandKit extends EventEmitter {
902
899
  /**
903
900
  * Get the client attached to this CommandKit instance.
904
901
  */
905
- get client(): discord_js0.Client<boolean>;
902
+ get client(): Client;
903
+ /**
904
+ * Sets the client attached to this CommandKit instance.
905
+ * @param client The client to set.
906
+ */
907
+ setClient(client: Client): this;
906
908
  /**
907
909
  * Updates application commands with the latest from "commandsPath".
908
910
  */
@@ -928,6 +930,7 @@ declare class CommandKit extends EventEmitter {
928
930
  getAppDirectory(): string | null;
929
931
  getPath(to: 'commands' | 'events'): string | null;
930
932
  }
933
+ declare const commandkit: CommandKit;
931
934
  //#endregion
932
935
  export { AnyCommandExecute, AppCommandHandler, AppCommandRunner, AppEventsHandler, AppEventsHandlerLoadedData, AsyncFunction, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, BootstrapFunction, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContext, CommandContextOptions, CommandData, CommandExecutionMode, CommandFlagContext, CommandKit, CommandKitConfiguration, CommandKitEnvironment, CommandKitEnvironmentInternalData, CommandKitEnvironmentType, CommandKitEventDispatch, CommandKitEventsChannel, CommandKitHMREvent, CommandKitOptions, CommandKitPlugin, CommandKitPluginRuntime, CommandRegistrar, CommandTypeData, CommonDirectiveTransformer, CommonDirectiveTransformerOptions, CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, ContextParameters, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, EvaluationContext, EventFlagContext, EventListener, FeatureFlag, FeatureFlagDefinition, FlagRunner, FlagStore, GenericFunction, IdentifyFunction, InteractionCommandContext, InteractionCommandMiddlewareContext, ListenerFunction, LoadedCommand, LoadedEvent, MaybeFalsey, MaybePromise, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PluginCommon, PluginOptions, PluginTransformParameters, PluginType, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, RunCommand, RuntimePlugin, SlashCommandMiddlewareContext, TemplateHandler, TransformedResult, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, after, cancelAfter, commandkit, exitContext, flag, getCommandKit, getContext, isCommandWorkerContext, isCompilerPlugin, isPlugin, isRuntimePlugin, makeContextAwareFunction, onApplicationBootstrap, onBootstrap, provideContext, registerDevHooks, useEnvironment };
933
- //# sourceMappingURL=CommandKit-DDSUNOAe.d.ts.map
936
+ //# sourceMappingURL=CommandKit-LJlFFidn.d.ts.map
@@ -3,17 +3,17 @@ const require_colors = require('./colors-Cd4Oz-r-.js');
3
3
  const require_error_codes = require('./error-codes-C_UO39jz.js');
4
4
  const require_element = require('./element-DcqNz1dV.js');
5
5
  const require_EventInterceptor = require('./EventInterceptor-Bvh05z7n.js');
6
- const require_constants = require('./constants-DOPSzXI0.js');
6
+ const require_constants = require('./constants-CCqS_v55.js');
7
7
  const require_CompilerPlugin = require('./CompilerPlugin-XzuGixkC.js');
8
8
  const require_RuntimePlugin = require('./RuntimePlugin-CKsd83M3.js');
9
9
  const require_EventWorkerContext = require('./EventWorkerContext-BAKiTqJz.js');
10
10
  const require_resolve_file_url = require('./resolve-file-url-ifwdwqmq.js');
11
11
  const require_MessageCommandParser = require('./MessageCommandParser-D02-wpZN.js');
12
12
  const require_signals = require('./signals-scJdEbly.js');
13
- const require_types_package = require('./types-package-BrES1tNq.js');
13
+ const require_types_package = require('./types-package-B0Z-xrbB.js');
14
14
  const require_CommandsRouter = require('./CommandsRouter-B91EHi6O.js');
15
15
  const require_EventsRouter = require('./EventsRouter-C_J0M3uO.js');
16
- const require_common = require('./common-CtMBxAf-.js');
16
+ const require_common = require('./common-CoUM9Czx.js');
17
17
  const require_CommandKitEventsChannel = require('./CommandKitEventsChannel-BnSPcFdq.js');
18
18
  const require_store = require('./store-B9bo6On8.js');
19
19
  const node_events = require_chunk.__toESM(require("node:events"));
@@ -1357,9 +1357,15 @@ function defineConfig(config = {}) {
1357
1357
  //#region src/utils/utilities.ts
1358
1358
  let appDir = null;
1359
1359
  let currentDir = null;
1360
+ function getSrcDir() {
1361
+ if (require_constants.COMMANDKIT_IS_CLI) return "src";
1362
+ if (require_constants.COMMANDKIT_IS_DEV) return ".commandkit";
1363
+ return getConfig().distDir;
1364
+ }
1360
1365
  function getCurrentDirectory() {
1361
1366
  if (currentDir) return currentDir;
1362
- let root = (0, node_path.join)(process.cwd(), require_constants.COMMANDKIT_IS_DEV ? ".commandkit" : getConfig().distDir);
1367
+ const src = getSrcDir();
1368
+ let root = (0, node_path.join)(process.cwd(), src);
1363
1369
  if (!(0, node_fs.existsSync)(root)) root = process.cwd();
1364
1370
  currentDir = root;
1365
1371
  return root;
@@ -1379,7 +1385,7 @@ function getSourceDirectories() {
1379
1385
  */
1380
1386
  function findAppDirectory() {
1381
1387
  if (appDir) return appDir;
1382
- let root = (0, node_path.join)(process.cwd(), require_constants.COMMANDKIT_IS_DEV ? ".commandkit" : getConfig().distDir);
1388
+ let root = (0, node_path.join)(process.cwd(), getSrcDir());
1383
1389
  if (!(0, node_fs.existsSync)(root)) root = process.cwd();
1384
1390
  const dirs = ["app"].map((dir) => (0, node_path.join)(root, dir));
1385
1391
  for (const dir of dirs) if ((0, node_fs.existsSync)(dir)) {
@@ -1448,6 +1454,61 @@ function stopEvents() {
1448
1454
  if (!require_EventWorkerContext.eventWorkerContext.getStore()) throw new Error("stopEvents() may only be called inside an event handler");
1449
1455
  throw new StopEventPropagationError();
1450
1456
  }
1457
+ /**
1458
+ * Creates a simple proxy object that mirrors the target object.
1459
+ * @param target The target object to proxy.
1460
+ * @returns The proxied object.
1461
+ */
1462
+ function createProxy(target) {
1463
+ let _target = target;
1464
+ const proxy = new Proxy(_target, {
1465
+ get(target$1, prop, receiver) {
1466
+ return Reflect.get(_target, prop, receiver);
1467
+ },
1468
+ set(target$1, prop, value, receiver) {
1469
+ return Reflect.set(_target, prop, value, receiver);
1470
+ },
1471
+ deleteProperty(target$1, prop) {
1472
+ return Reflect.deleteProperty(_target, prop);
1473
+ },
1474
+ has(target$1, prop) {
1475
+ return Reflect.has(_target, prop);
1476
+ },
1477
+ ownKeys(target$1) {
1478
+ return Reflect.ownKeys(_target);
1479
+ },
1480
+ getOwnPropertyDescriptor(target$1, prop) {
1481
+ return Reflect.getOwnPropertyDescriptor(_target, prop);
1482
+ },
1483
+ defineProperty(target$1, prop, attributes) {
1484
+ return Reflect.defineProperty(_target, prop, attributes);
1485
+ },
1486
+ getPrototypeOf(target$1) {
1487
+ return Reflect.getPrototypeOf(_target);
1488
+ },
1489
+ setPrototypeOf(target$1, proto) {
1490
+ return Reflect.setPrototypeOf(_target, proto);
1491
+ },
1492
+ isExtensible(target$1) {
1493
+ return Reflect.isExtensible(_target);
1494
+ },
1495
+ preventExtensions(target$1) {
1496
+ return Reflect.preventExtensions(_target);
1497
+ },
1498
+ apply(target$1, thisArg, args) {
1499
+ return Reflect.apply(_target, thisArg, args);
1500
+ },
1501
+ construct(target$1, args, newTarget) {
1502
+ return Reflect.construct(_target, args, newTarget);
1503
+ }
1504
+ });
1505
+ return {
1506
+ proxy,
1507
+ setTarget(newTarget) {
1508
+ _target = newTarget;
1509
+ }
1510
+ };
1511
+ }
1451
1512
 
1452
1513
  //#endregion
1453
1514
  //#region src/app/register/CommandRegistrar.ts
@@ -2685,7 +2746,6 @@ function registerDevHooks(commandkit$1) {
2685
2746
 
2686
2747
  //#endregion
2687
2748
  //#region src/CommandKit.ts
2688
- let commandkit;
2689
2749
  const bootstrapHooks = /* @__PURE__ */ new Set();
2690
2750
  const onApplicationBootstrapHooks = /* @__PURE__ */ new Set();
2691
2751
  /**
@@ -2722,7 +2782,8 @@ function onApplicationBootstrap(fn) {
2722
2782
  }
2723
2783
  var CommandKit = class CommandKit extends node_events.default {
2724
2784
  #started = false;
2725
- options;
2785
+ #clientProxy = createProxy({});
2786
+ #client;
2726
2787
  eventInterceptor;
2727
2788
  static createElement = require_element.createElement;
2728
2789
  static Fragment = require_element.Fragment;
@@ -2745,14 +2806,12 @@ var CommandKit = class CommandKit extends node_events.default {
2745
2806
  * @param options - The default CommandKit configuration.
2746
2807
  * @see {@link https://commandkit.js.org/docs/guide/commandkit-setup}
2747
2808
  */
2748
- constructor(options) {
2809
+ constructor(options = {}) {
2749
2810
  if (CommandKit.instance) process.emitWarning("CommandKit instance already exists. Having multiple instance in same project is discouraged and it may lead to unexpected behavior.", { code: "MultiInstanceWarning" });
2750
- if (!options.client) throw new Error(require_colors.colors_default.red("\"client\" is required when instantiating CommandKit."));
2751
2811
  super();
2752
- this.options = options;
2753
2812
  if (!CommandKit.instance) CommandKit.instance = this;
2813
+ if (options === null || options === void 0 ? void 0 : options.client) this.setClient(options.client);
2754
2814
  this.plugins = new CommandKitPluginRuntime(this);
2755
- commandkit = CommandKit.instance;
2756
2815
  this.#bootstrapHooks();
2757
2816
  }
2758
2817
  async #bootstrapHooks() {
@@ -2781,7 +2840,7 @@ var CommandKit = class CommandKit extends node_events.default {
2781
2840
  */
2782
2841
  async start(token) {
2783
2842
  if (this.#started) return;
2784
- if (!this.options.client) throw new Error(require_colors.colors_default.red("\"client\" is required when starting CommandKit."));
2843
+ if (!this.#client) throw new Error(require_colors.colors_default.red("\"client\" is required when starting CommandKit."));
2785
2844
  this.eventInterceptor = new require_EventInterceptor.EventInterceptor(this.client);
2786
2845
  if (require_constants.COMMANDKIT_IS_DEV) try {
2787
2846
  registerDevHooks(this);
@@ -2793,7 +2852,7 @@ var CommandKit = class CommandKit extends node_events.default {
2793
2852
  await this.#init();
2794
2853
  this.commandHandler.registerCommandHandler();
2795
2854
  this.incrementClientListenersCount();
2796
- if (token !== false && !this.options.client.isReady()) {
2855
+ if (token !== false && !this.client.isReady()) {
2797
2856
  this.client.once(discord_js.Events.ClientReady, async () => {
2798
2857
  await this.commandHandler.registrar.register();
2799
2858
  });
@@ -2801,13 +2860,13 @@ var CommandKit = class CommandKit extends node_events.default {
2801
2860
  var _plugin$onBeforeClien;
2802
2861
  return (_plugin$onBeforeClien = plugin.onBeforeClientLogin) === null || _plugin$onBeforeClien === void 0 ? void 0 : _plugin$onBeforeClien.call(plugin, ctx);
2803
2862
  });
2804
- const botToken = token ?? this.options.client.token ?? process.env.TOKEN ?? process.env.DISCORD_TOKEN;
2805
- await this.options.client.login(botToken);
2863
+ const botToken = token ?? this.client.token ?? process.env.TOKEN ?? process.env.DISCORD_TOKEN;
2864
+ await this.client.login(botToken);
2806
2865
  await this.plugins.execute((ctx, plugin) => {
2807
2866
  var _plugin$onAfterClient;
2808
2867
  return (_plugin$onAfterClient = plugin.onAfterClientLogin) === null || _plugin$onAfterClient === void 0 ? void 0 : _plugin$onAfterClient.call(plugin, ctx);
2809
2868
  });
2810
- } else if (this.options.client.isReady()) await this.commandHandler.registrar.register();
2869
+ } else if (this.client.isReady()) await this.commandHandler.registrar.register();
2811
2870
  this.#started = true;
2812
2871
  await this.#applicationBootstrapHooks();
2813
2872
  }
@@ -2846,7 +2905,22 @@ var CommandKit = class CommandKit extends node_events.default {
2846
2905
  * Get the client attached to this CommandKit instance.
2847
2906
  */
2848
2907
  get client() {
2849
- return this.options.client;
2908
+ var _this$clientProxy;
2909
+ const client = this.#client || ((_this$clientProxy = this.#clientProxy) === null || _this$clientProxy === void 0 ? void 0 : _this$clientProxy.proxy);
2910
+ if (!client) throw new Error("Client instance is not set");
2911
+ return client;
2912
+ }
2913
+ /**
2914
+ * Sets the client attached to this CommandKit instance.
2915
+ * @param client The client to set.
2916
+ */
2917
+ setClient(client) {
2918
+ this.#client = client;
2919
+ if (this.#clientProxy) {
2920
+ this.#clientProxy.setTarget(client);
2921
+ this.#clientProxy = null;
2922
+ }
2923
+ return this;
2850
2924
  }
2851
2925
  async #init() {
2852
2926
  const appDir$1 = this.getAppDirectory();
@@ -2895,13 +2969,13 @@ var CommandKit = class CommandKit extends node_events.default {
2895
2969
  * Increment the client listeners count.
2896
2970
  */
2897
2971
  incrementClientListenersCount() {
2898
- this.options.client.setMaxListeners(this.options.client.getMaxListeners() + 1);
2972
+ this.client.setMaxListeners(this.client.getMaxListeners() + 1);
2899
2973
  }
2900
2974
  /**
2901
2975
  * Decrement the client listeners count.
2902
2976
  */
2903
2977
  decrementClientListenersCount() {
2904
- this.options.client.setMaxListeners(this.options.client.getMaxListeners() - 1);
2978
+ this.client.setMaxListeners(this.client.getMaxListeners() - 1);
2905
2979
  }
2906
2980
  /**
2907
2981
  * Path to the app directory. Returns `null` if not found.
@@ -2922,6 +2996,7 @@ var CommandKit = class CommandKit extends node_events.default {
2922
2996
  }
2923
2997
  }
2924
2998
  };
2999
+ const commandkit = CommandKit.instance || new CommandKit();
2925
3000
 
2926
3001
  //#endregion
2927
3002
  Object.defineProperty(exports, 'AppCommandHandler', {
@@ -3152,6 +3227,12 @@ Object.defineProperty(exports, 'createLogger', {
3152
3227
  return createLogger;
3153
3228
  }
3154
3229
  });
3230
+ Object.defineProperty(exports, 'createProxy', {
3231
+ enumerable: true,
3232
+ get: function () {
3233
+ return createProxy;
3234
+ }
3235
+ });
3155
3236
  Object.defineProperty(exports, 'debounce', {
3156
3237
  enumerable: true,
3157
3238
  get: function () {
@@ -3278,4 +3359,4 @@ Object.defineProperty(exports, 'useEnvironment', {
3278
3359
  return useEnvironment;
3279
3360
  }
3280
3361
  });
3281
- //# sourceMappingURL=CommandKit-DbKHr6qT.js.map
3362
+ //# sourceMappingURL=CommandKit-pZKcOltw.js.map