NapCatQQ source snapshot
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
Release Tag / validate-version (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:01:47 +08:00
commit f954252a34
1111 files changed
+139867

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
import { NapCatCore } from 'napcat-core';
import { NapCatOneBot11Adapter } from '@/napcat-onebot/index';
import { OB11ProfileLikeEvent } from '@/napcat-onebot/event/notice/OB11ProfileLikeEvent';
import { decodeProfileLikeTip } from 'napcat-core/helper/adaptDecoder';
export class OneBotUserApi {
obContext: NapCatOneBot11Adapter;
core: NapCatCore;
constructor (obContext: NapCatOneBot11Adapter, core: NapCatCore) {
this.obContext = obContext;
this.core = core;
}
async parseLikeEvent (wrappedBody: Uint8Array): Promise<OB11ProfileLikeEvent | undefined> {
const likeTip = decodeProfileLikeTip(wrappedBody);
if (likeTip?.msgType !== 0 || likeTip?.subType !== 203) return;
this.core.context.logger.logDebug('收到点赞通知消息');
const likeMsg = likeTip.content.msg;
if (!likeMsg) return;
const detail = likeMsg.detail;
if (!detail) return;
const times = detail.txt.match(/\d+/) ?? '0';
return new OB11ProfileLikeEvent(
this.core,
Number(detail.uin),
detail.nickname,
parseInt(times[0], 10),
likeMsg.time
);
}
}