1
0
forked from noxious/server

Storage class is now OOP

This commit is contained in:
2025-01-01 21:34:23 +01:00
parent 04e081c31a
commit 5982422e04
15 changed files with 109 additions and 72 deletions

View File

@ -3,7 +3,7 @@ import * as path from 'path'
import { pathToFileURL } from 'url'
import Logger, { LoggerType } from '#application/logger'
import { getAppPath } from '#application/storage'
import Storage from '#application/storage'
import { Command } from '#application/types'
export class CommandRegistry {
@ -15,7 +15,7 @@ export class CommandRegistry {
}
public async loadCommands(): Promise<void> {
const directory = getAppPath('commands')
const directory = Storage.getAppPath('commands')
this.logger.info(`Loading commands from: ${directory}`)
try {
@ -32,7 +32,7 @@ export class CommandRegistry {
private async loadCommandFile(file: fs.Dirent): Promise<void> {
try {
const filePath = getAppPath('commands', file.name)
const filePath = Storage.getAppPath('commands', file.name)
const commandName = path.basename(file.name, path.extname(file.name))
const module = await import(pathToFileURL(filePath).href)