diff --git a/packages/commandkit/hooks.d.ts b/packages/commandkit/hooks.d.ts index 5619460f..d2eb0732 100644 --- a/packages/commandkit/hooks.d.ts +++ b/packages/commandkit/hooks.d.ts @@ -5,7 +5,7 @@ import type { CommandKitEnvironment, EventWorkerContext, } from './dist/index.js'; -import type { Client } from 'discord.js'; +import type { Client, Collection } from 'discord.js'; export function useAnyEnvironment(): CommandKitEnvironment | EventWorkerContext; @@ -16,3 +16,5 @@ export function useCommandKit(): CommandKit; export function useCommand(): LoadedCommand; export function useEvent(): ParsedEvent; + +export function useStore(): Collection; diff --git a/packages/commandkit/src/commandkit.ts b/packages/commandkit/src/commandkit.ts index a4a699ff..c808816f 100644 --- a/packages/commandkit/src/commandkit.ts +++ b/packages/commandkit/src/commandkit.ts @@ -370,7 +370,13 @@ export class CommandKit extends EventEmitter { async #init() { const appDir = this.getAppDirectory(); - if (!appDir) return; + if (!appDir) { + throw new Error( + 'CommandKit could not determine the application directory. ' + + 'This issue is common when you are not using the `commandkit dev` command to start the project. ' + + 'You can either use `commandkit dev` to start the project, or set the `COMMANDKIT_IS_CLI=true` environment variable (Note that adding this to `.env` file may not work).', + ); + } const commandsPath = this.getPath('commands')!; const events = this.getPath('events')!;