Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/commandkit/hooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -16,3 +16,5 @@ export function useCommandKit(): CommandKit;
export function useCommand(): LoadedCommand;

export function useEvent(): ParsedEvent;

export function useStore<K = any, V = any>(): Collection<K, V>;
8 changes: 7 additions & 1 deletion packages/commandkit/src/commandkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')!;
Expand Down