forked from noxious/server
Test #1
This commit is contained in:
@ -20,6 +20,8 @@ class CommandManager {
|
||||
this.rl.on('close', () => {
|
||||
this.rlClosed = true
|
||||
})
|
||||
|
||||
console.log(process.cwd())
|
||||
}
|
||||
|
||||
public async boot(io: Server) {
|
||||
@ -61,17 +63,14 @@ class CommandManager {
|
||||
}
|
||||
|
||||
private async loadCommands() {
|
||||
const baseDir = config.ENV === 'production' ? path.join(__dirname, '..') : process.cwd();
|
||||
const commandsDir = path.join(baseDir, config.ENV === 'production' ? 'commands' : 'src', 'commands');
|
||||
const extension = config.ENV === 'production' ? '.js' : '.ts';
|
||||
|
||||
const commandsDir = path.join(process.cwd(), 'commands');
|
||||
commandLogger.info(`Loading commands from: ${commandsDir}`);
|
||||
|
||||
try {
|
||||
const files = await fs.promises.readdir(commandsDir, { withFileTypes: true });
|
||||
|
||||
for (const file of files) {
|
||||
if (!file.isFile() || !file.name.endsWith(extension)) {
|
||||
if (!file.isFile() || (!file.name.endsWith('.ts') && !file.name.endsWith('.js'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user