forked from noxious/server
format
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import { getAppPath } from '#application/storage'
|
||||
import { Command } from '#application/types'
|
||||
@ -18,11 +19,7 @@ export class CommandRegistry {
|
||||
|
||||
try {
|
||||
const files = await fs.promises.readdir(directory, { withFileTypes: true })
|
||||
await Promise.all(
|
||||
files
|
||||
.filter(file => this.isValidCommandFile(file))
|
||||
.map(file => this.loadCommandFile(file))
|
||||
)
|
||||
await Promise.all(files.filter((file) => this.isValidCommandFile(file)).map((file) => this.loadCommandFile(file)))
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to read commands directory: ${error instanceof Error ? error.message : String(error)}`)
|
||||
}
|
||||
@ -56,4 +53,4 @@ export class CommandRegistry {
|
||||
this.commands.set(name, CommandClass)
|
||||
this.logger.info(`Registered command: ${name}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user