mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-19 05:05:44 +08:00
Moved various helper, event, and utility files from napcat-common to napcat-core/helper for better modularity and separation of concerns. Updated imports across packages to reflect new file locations. Removed unused dependencies from napcat-common and added them to napcat-core where needed. Also consolidated type definitions and cleaned up tsconfig settings for improved compatibility.
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { NetworkAdapterConfig } from '@/napcat-onebot/config/config';
|
|
import { LogWrapper } from 'napcat-core/helper/log';
|
|
import { NapCatCore } from 'napcat-core';
|
|
import { NapCatOneBot11Adapter } from '@/napcat-onebot/index';
|
|
import { ActionMap } from '@/napcat-onebot/action';
|
|
import { OB11EmitEventContent, OB11NetworkReloadType } from '@/napcat-onebot/network/index';
|
|
|
|
export abstract class IOB11NetworkAdapter<CT extends NetworkAdapterConfig> {
|
|
name: string;
|
|
isEnable: boolean = false;
|
|
config: CT;
|
|
readonly logger: LogWrapper;
|
|
readonly core: NapCatCore;
|
|
readonly obContext: NapCatOneBot11Adapter;
|
|
readonly actions: ActionMap;
|
|
|
|
constructor (name: string, config: CT, core: NapCatCore, obContext: NapCatOneBot11Adapter, actions: ActionMap) {
|
|
this.name = name;
|
|
this.config = structuredClone(config);
|
|
this.core = core;
|
|
this.obContext = obContext;
|
|
this.actions = actions;
|
|
this.logger = core.context.logger;
|
|
}
|
|
|
|
abstract onEvent<T extends OB11EmitEventContent>(event: T): Promise<void>;
|
|
|
|
abstract open (): void | Promise<void>;
|
|
|
|
abstract close (): void | Promise<void>;
|
|
|
|
abstract reload (config: unknown): OB11NetworkReloadType | Promise<OB11NetworkReloadType>;
|
|
}
|