fix: use constructor to pass config name

This commit is contained in:
Wesley F. Young
2024-08-12 01:08:55 +08:00
parent 6d863ac29c
commit 436249597d
3 changed files with 11 additions and 7 deletions

View File

@@ -3,12 +3,13 @@ import fs from 'node:fs';
import type { NapCatCore } from '@/core';
export abstract class ConfigBase<T> {
abstract name: string;
name: string;
coreContext: NapCatCore;
configPath: string;
configData: T = {} as T;
constructor(coreContext: NapCatCore, configPath: string) {
protected constructor(name: string, coreContext: NapCatCore, configPath: string) {
this.name = name;
this.coreContext = coreContext;
this.configPath = configPath;
fs.mkdirSync(this.configPath, { recursive: true });