mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
refactor: make ConfigBase abstract
This commit is contained in:
@@ -2,17 +2,13 @@ import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import type { NapCatCore } from '@/core';
|
||||
|
||||
export class ConfigBase<T> {
|
||||
name: string = this.getConfigName();
|
||||
export abstract class ConfigBase<T> {
|
||||
abstract name: string;
|
||||
pathName: string | null = null; // 本次读取的文件路径
|
||||
coreContext: NapCatCore;
|
||||
configPath: string;
|
||||
configData: T = {} as T;
|
||||
|
||||
getConfigName() {
|
||||
return this.constructor.name
|
||||
}
|
||||
|
||||
constructor(coreContext: NapCatCore, configPath: string) {
|
||||
this.coreContext = coreContext;
|
||||
this.configPath = configPath;
|
||||
@@ -25,7 +21,6 @@ export class ConfigBase<T> {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
getConfigPath(pathName: string | undefined): string {
|
||||
const suffix = pathName ? `_${pathName}` : '';
|
||||
const filename = `${this.name}${suffix}.json`;
|
||||
|
Reference in New Issue
Block a user