refactor: onMsgRecall

This commit is contained in:
手瓜一十雪
2024-11-25 22:36:07 +08:00
parent 988c52ecc0
commit 5188e3c6b3
5 changed files with 24 additions and 17 deletions

View File

@@ -666,10 +666,10 @@ export class OneBotMsgApi {
}
async parsePrivateMsgEvent(msg: RawMessage, grayTipElement: GrayTipElement) {
if (grayTipElement && grayTipElement.subElementType == NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_JSON) {
if (grayTipElement.subElementType == NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_JSON) {
if (grayTipElement.jsonGrayTipElement.busiId == 1061) {
const PokeEvent = await this.obContext.apis.FriendApi.parsePrivatePokeEvent(grayTipElement);
if (PokeEvent) return PokeEvent;
if (PokeEvent) { return PokeEvent };
} else if (grayTipElement.jsonGrayTipElement.busiId == 19324 && msg.peerUid !== '') {
return new OB11FriendAddNoticeEvent(this.core, Number(await this.core.apis.UserApi.getUinByUidV2(msg.peerUid)));
}

View File

@@ -1,4 +1,4 @@
import { NapCatCore } from '@/core';
import { GrayTipRovokeElement, NapCatCore, RawMessage } from '@/core';
import { NapCatOneBot11Adapter } from '@/onebot';
import { OB11ProfileLikeEvent } from '@/onebot/event/notice/OB11ProfileLikeEvent';
import { decodeProfileLikeTip } from "@/core/helper/adaptDecoder";
@@ -11,7 +11,7 @@ export class OneBotUserApi {
this.obContext = obContext;
this.core = core;
}
async parseLikeEvent(wrappedBody: Uint8Array): Promise<OB11ProfileLikeEvent | undefined> {
const likeTip = decodeProfileLikeTip(Uint8Array.from(wrappedBody));
if (likeTip?.msgType !== 0 || likeTip?.subType !== 203) return;