diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index 85299bb5b..558d4e7c9 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -20,7 +20,7 @@ import { import faceConfig from '@/core/external/face_config.json'; import { NapCatOneBot11Adapter, OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageFileBase, } from '@/onebot'; import { OB11Entities } from '@/onebot/entities'; -import { EventType } from '@/onebot/event/OB11BaseEvent'; +import { EventType } from '@/onebot/event/OneBotEvent'; import { encodeCQCode } from '@/onebot/cqcode'; import { uri2local } from '@/common/file'; import { RequestUtil } from '@/common/request'; diff --git a/src/onebot/event/OB11BaseEvent.ts b/src/onebot/event/OneBotEvent.ts similarity index 91% rename from src/onebot/event/OB11BaseEvent.ts rename to src/onebot/event/OneBotEvent.ts index 1ae7d7b1a..713d38c96 100644 --- a/src/onebot/event/OB11BaseEvent.ts +++ b/src/onebot/event/OneBotEvent.ts @@ -8,7 +8,7 @@ export enum EventType { MESSAGE_SENT = 'message_sent', } -export abstract class OB11BaseEvent { +export abstract class OneBotEvent { time = Math.floor(Date.now() / 1000); self_id: number; abstract post_type: EventType; diff --git a/src/onebot/event/message/OB11BaseMessageEvent.ts b/src/onebot/event/message/OB11BaseMessageEvent.ts index 63960ef3b..89bfed050 100644 --- a/src/onebot/event/message/OB11BaseMessageEvent.ts +++ b/src/onebot/event/message/OB11BaseMessageEvent.ts @@ -1,5 +1,5 @@ -import { EventType, OB11BaseEvent } from '../OB11BaseEvent'; +import { EventType, OneBotEvent } from '../OneBotEvent'; -export abstract class OB11BaseMessageEvent extends OB11BaseEvent { +export abstract class OB11BaseMessageEvent extends OneBotEvent { post_type = EventType.MESSAGE; } \ No newline at end of file diff --git a/src/onebot/event/meta/OB11BaseMetaEvent.ts b/src/onebot/event/meta/OB11BaseMetaEvent.ts index 26386a20e..015a59588 100644 --- a/src/onebot/event/meta/OB11BaseMetaEvent.ts +++ b/src/onebot/event/meta/OB11BaseMetaEvent.ts @@ -1,6 +1,6 @@ -import { EventType, OB11BaseEvent } from '../OB11BaseEvent'; +import { EventType, OneBotEvent } from '@/onebot/event/OneBotEvent'; -export abstract class OB11BaseMetaEvent extends OB11BaseEvent { +export abstract class OB11BaseMetaEvent extends OneBotEvent { post_type = EventType.META; abstract meta_event_type: string; } diff --git a/src/onebot/event/notice/OB11BaseNoticeEvent.ts b/src/onebot/event/notice/OB11BaseNoticeEvent.ts index 982d7448a..d8e34f78d 100644 --- a/src/onebot/event/notice/OB11BaseNoticeEvent.ts +++ b/src/onebot/event/notice/OB11BaseNoticeEvent.ts @@ -1,5 +1,5 @@ -import { EventType, OB11BaseEvent } from '../OB11BaseEvent'; +import { EventType, OneBotEvent } from '@/onebot/event/OneBotEvent'; -export abstract class OB11BaseNoticeEvent extends OB11BaseEvent { +export abstract class OB11BaseNoticeEvent extends OneBotEvent { post_type = EventType.NOTICE; } \ No newline at end of file diff --git a/src/onebot/event/request/OB11FriendRequest.ts b/src/onebot/event/request/OB11FriendRequest.ts index 0f40ecdf9..41f3505a5 100644 --- a/src/onebot/event/request/OB11FriendRequest.ts +++ b/src/onebot/event/request/OB11FriendRequest.ts @@ -1,5 +1,5 @@ import { OB11BaseNoticeEvent } from '../notice/OB11BaseNoticeEvent'; -import { EventType } from '../OB11BaseEvent'; +import { EventType } from '../OneBotEvent'; import { NapCatCore } from '@/core'; export class OB11FriendRequestEvent extends OB11BaseNoticeEvent { diff --git a/src/onebot/event/request/OB11GroupRequest.ts b/src/onebot/event/request/OB11GroupRequest.ts index d5ee94652..1576be0e4 100644 --- a/src/onebot/event/request/OB11GroupRequest.ts +++ b/src/onebot/event/request/OB11GroupRequest.ts @@ -1,5 +1,5 @@ import { OB11GroupNoticeEvent } from '../notice/OB11GroupNoticeEvent'; -import { EventType } from '../OB11BaseEvent'; +import { EventType } from '../OneBotEvent'; import { NapCatCore } from '@/core'; export class OB11GroupRequestEvent extends OB11GroupNoticeEvent { diff --git a/src/onebot/network/index.ts b/src/onebot/network/index.ts index dc8b8b677..be019fd7b 100644 --- a/src/onebot/network/index.ts +++ b/src/onebot/network/index.ts @@ -1,9 +1,9 @@ -import { OB11BaseEvent } from '@/onebot/event/OB11BaseEvent'; +import { OneBotEvent } from '@/onebot/event/OneBotEvent'; import { OB11Message } from '@/onebot'; import { ActionMap } from '@/onebot/action'; import { NetworkConfigAdapter } from '../config/config'; -export type OB11EmitEventContent = OB11BaseEvent | OB11Message; +export type OB11EmitEventContent = OneBotEvent | OB11Message; export enum OB11NetworkReloadType { Normal = 0, ConfigChange = 1, @@ -16,7 +16,7 @@ export interface IOB11NetworkAdapter { name: string; isEnable: boolean; config: NetworkConfigAdapter; - + onEvent(event: T): void; open(): void | Promise; diff --git a/src/onebot/types/message.ts b/src/onebot/types/message.ts index c97357fe2..fe4e26e49 100644 --- a/src/onebot/types/message.ts +++ b/src/onebot/types/message.ts @@ -1,5 +1,5 @@ import { OB11Sender } from './entity'; -import { EventType } from '@/onebot/event/OB11BaseEvent'; +import { EventType } from '@/onebot/event/OneBotEvent'; import { CustomMusicSignPostData, IdMusicSignPostData, PicSubType, RawMessage } from '@/core'; export enum OB11MessageType {