Archived
0
0
Fork 0

fix: command names incorrect

This commit is contained in:
Daryl Ronningen 2021-06-21 07:50:02 -07:00
parent 83259240a9
commit cba9440519
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
2 changed files with 7 additions and 5 deletions

View file

@ -98,7 +98,7 @@ client.on('message', async (msg) => {
return; return;
} }
findCommand.run(msg, ...args); await findCommand.run(msg, ...args);
}); });
client.on('ready', async () => { client.on('ready', async () => {

View file

@ -22,18 +22,20 @@ import type { ICommandOptions } from '@utils/types';
export default abstract class Command { export default abstract class Command {
public readonly client: Client; public readonly client: Client;
public readonly file: string;
public readonly options: ICommandOptions; public readonly options: ICommandOptions;
protected constructor(client: Client, options?: ICommandOptions) { protected constructor(client: Client, file: string, options?: ICommandOptions) {
this.client = client; this.client = client;
this.file = file;
const defaultOptions: ICommandOptions = { const defaultOptions: ICommandOptions = {
name: path.basename(__filename, path.extname(__filename)), name: path.basename(this.file, path.extname(this.file)),
group: path.basename(path.dirname(__filename)) === 'commands' ? '' : path.basename(path.dirname(__filename)), group: path.basename(path.dirname(this.file)) === 'commands' ? '' : path.basename(path.dirname(this.file)),
}; };
this.options = config.util.extendDeep(defaultOptions, options); this.options = config.util.extendDeep(defaultOptions, options);
} }
public abstract run(message: Message, ...args: string[]): void; public abstract run(message: Message, ...args: string[]): Promise<void> | void;
} }