forked from noxious/server
Bug fix for loading commands
This commit is contained in:
parent
ee18a28006
commit
8fd68670c9
@ -14,13 +14,15 @@ class CommandManager {
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
this.loadCommands();
|
||||
}
|
||||
|
||||
public async boot(io: Server) {
|
||||
// Start the command manager
|
||||
this.io = io as Server;
|
||||
await this.loadCommands();
|
||||
console.log('[✅] Command manager loaded');
|
||||
|
||||
// Start the prompt
|
||||
await this.startPrompt();
|
||||
}
|
||||
|
||||
@ -57,17 +59,9 @@ class CommandManager {
|
||||
for (const file of files) {
|
||||
const ext = path.extname(file);
|
||||
const commandName = path.basename(file, ext);
|
||||
let commandPath = path.join(commandsDir, file);
|
||||
|
||||
console.log(commandPath);
|
||||
|
||||
if (os.platform() === 'win32') {
|
||||
commandPath = path.join(commandsDir, file).replace(/\\/g, '/');
|
||||
}
|
||||
|
||||
console.log(commandPath);
|
||||
|
||||
const commandPath = path.join(commandsDir, file);
|
||||
const module = await import(commandPath);
|
||||
|
||||
this.registerCommand(commandName, module.default);
|
||||
}
|
||||
} catch (error: any) {
|
||||
|
@ -1 +0,0 @@
|
||||
In this folder will come commands that can be used in the server console
|
Loading…
x
Reference in New Issue
Block a user