This commit is contained in:
Dennis Postma 2024-12-29 01:26:24 +01:00
parent 30cce5845c
commit 4745fb5145

View File

@ -30,11 +30,11 @@ export class CommandRegistry {
}
private async loadCommandFile(file: fs.Dirent): Promise<void> {
const fullPath = getAppPath('commands', file.name)
const commandName = path.basename(file.name, path.extname(file.name))
try {
const module = await import(fullPath)
const filePath = getAppPath('commands', file.name)
const commandName = path.basename(file.name, path.extname(file.name))
const module = await import(filePath)
if (typeof module.default !== 'function') {
this.logger.warn(`Unrecognized export in ${file.name}`)
return