This commit is contained in:
手瓜一十雪 2024-08-10 21:48:08 +08:00
commit ef7d2f4a82
3 changed files with 23 additions and 7 deletions

View File

@ -105,7 +105,16 @@ export interface IKernelMsgListener {
onImportOldDbProgressUpdate(importOldDbMsgNotifyInfo: unknown): void; onImportOldDbProgressUpdate(importOldDbMsgNotifyInfo: unknown): void;
onInputStatusPush(inputStatusInfo: unknown): void; onInputStatusPush(inputStatusInfo: {
chatType: number;
eventType: number;
fromUin: string;
interval: string;
showTime: string;
statusText: string;
timestamp: string;
toUin: string;
}): void;
onKickedOffLine(kickedInfo: unknown): void; onKickedOffLine(kickedInfo: unknown): void;
@ -341,7 +350,16 @@ export class MsgListener implements IKernelMsgListener {
} }
onInputStatusPush(inputStatusInfo: unknown) { onInputStatusPush(inputStatusInfo: {
chatType: number;
eventType: number;
fromUin: string;
interval: string;
showTime: string;
statusText: string;
timestamp: string;
toUin: string;
}) {
} }

View File

@ -5,7 +5,7 @@ import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
import { NapCatCore } from '@/core'; import { NapCatCore } from '@/core';
import { NapCatOneBot11Adapter } from '../main'; import { NapCatOneBot11Adapter } from '../main';
class BaseAction<PayloadType, ReturnDataType> { abstract class BaseAction<PayloadType, ReturnDataType> {
actionName: ActionName = ActionName.Unknown; actionName: ActionName = ActionName.Unknown;
CoreContext: NapCatCore; CoreContext: NapCatCore;
private validate: undefined | ValidateFunction<any> = undefined; private validate: undefined | ValidateFunction<any> = undefined;
@ -64,9 +64,7 @@ class BaseAction<PayloadType, ReturnDataType> {
} }
} }
protected async _handle(payload: PayloadType): Promise<ReturnDataType> { abstract _handle(payload: PayloadType): PromiseLike<ReturnDataType>;
throw `pleas override ${this.actionName} _handle`;
}
} }
export default BaseAction; export default BaseAction;

View File

@ -18,7 +18,7 @@ export class OB11NetworkManager {
return this.adapters; return this.adapters;
} }
async PostEvent(event: OB11BaseEvent) { async emitEvent(event: OB11BaseEvent) {
// Mlikiowa V2.0.0 Refactor Todo // Mlikiowa V2.0.0 Refactor Todo
return Promise.all(this.adapters.map(adapter => adapter.onEvent(event))); return Promise.all(this.adapters.map(adapter => adapter.onEvent(event)));
} }