fix & refactor: no longer merge config data and loader; use static imports to represent config struct

This commit is contained in:
Wesley F. Young
2024-08-12 00:49:59 +08:00
parent 17aa7f7df8
commit e78ca3f2bb
4 changed files with 21 additions and 56 deletions

View File

@@ -1,40 +1,10 @@
import { ConfigBase } from '@/common/utils/ConfigBase';
import ob11DefaultConfig from '@/onebot/external/onebot11.json';
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
export interface OB11Config {
http: {
enable: boolean;
host: string;
port: number;
secret: string;
enableHeart: boolean;
enablePost: boolean;
postUrls: string[];
};
ws: {
enable: boolean;
host: string;
port: number;
};
reverseWs: {
enable: boolean;
urls: string[];
};
debug: boolean;
heartInterval: number;
messagePostFormat: 'array' | 'string';
enableLocalFile2Url: boolean;
musicSignUrl: string;
reportSelfMessage: boolean;
token: string;
GroupLocalTime: {
Record: boolean,
RecordList: Array<string>
};
}
export type OB11Config = typeof ob11DefaultConfig;
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
export class OB11Config extends ConfigBase<OB11Config> {
export class OB11ConfigLoader extends ConfigBase<OB11Config> {
name = 'onebot11';
}