fix: command names incorrect
This commit is contained in:
parent
83259240a9
commit
cba9440519
2 changed files with 7 additions and 5 deletions
|
@ -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 () => {
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue