forked from noxious/server
Improved command loading a bit for better debugging
This commit is contained in:
parent
8fd68670c9
commit
25251d5012
@ -53,19 +53,19 @@ class CommandManager {
|
||||
|
||||
private async loadCommands() {
|
||||
const commandsDir = path.resolve(__dirname, 'commands');
|
||||
const files: string[] = await fs.promises.readdir(commandsDir);
|
||||
|
||||
try {
|
||||
const files: string[] = await fs.promises.readdir(commandsDir);
|
||||
for (const file of files) {
|
||||
for (const file of files) {
|
||||
try {
|
||||
const ext = path.extname(file);
|
||||
const commandName = path.basename(file, ext);
|
||||
const commandPath = path.join(commandsDir, file);
|
||||
const module = await import(commandPath);
|
||||
|
||||
this.registerCommand(commandName, module.default);
|
||||
} catch (error: any) {
|
||||
console.error('[❌] Failed to load file:', file, error);
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error('[❌] Failed to load command files:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user