This commit is contained in:
Dennis Postma 2024-12-29 01:30:06 +01:00
parent 4745fb5145
commit ba0ceda03a

View File

@ -1,5 +1,6 @@
import * as fs from 'fs' import * as fs from 'fs'
import * as path from 'path' import * as path from 'path'
import { pathToFileURL } from 'url'
import Logger, { LoggerType } from '#application/logger' import Logger, { LoggerType } from '#application/logger'
import { getAppPath } from '#application/storage' import { getAppPath } from '#application/storage'
@ -34,7 +35,7 @@ export class CommandRegistry {
const filePath = getAppPath('commands', file.name) const filePath = getAppPath('commands', file.name)
const commandName = path.basename(file.name, path.extname(file.name)) const commandName = path.basename(file.name, path.extname(file.name))
const module = await import(filePath) const module = await import(pathToFileURL(filePath).href)
if (typeof module.default !== 'function') { if (typeof module.default !== 'function') {
this.logger.warn(`Unrecognized export in ${file.name}`) this.logger.warn(`Unrecognized export in ${file.name}`)
return return