mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 21:09:23 +00:00
style: lint
This commit is contained in:
parent
964874bdad
commit
030ba15952
@ -371,7 +371,7 @@ export class NTQQFileApi {
|
||||
const isNTV2 = imageAppid && ['1406', '1407'].includes(imageAppid);
|
||||
const imageFileId = parsedUrl.searchParams.get('fileid');
|
||||
|
||||
let rkeyData = {
|
||||
const rkeyData = {
|
||||
private_rkey: 'CAQSKAB6JWENi5LM_xp9vumLbuThJSaYf-yzMrbZsuq7Uz2qEc3Rbib9LP4',
|
||||
group_rkey: 'CAQSKAB6JWENi5LM_xp9vumLbuThJSaYf-yzMrbZsuq7Uz2qffcqm614gds',
|
||||
online_rkey: false
|
||||
@ -393,7 +393,7 @@ export class NTQQFileApi {
|
||||
|
||||
if (!rkeyData.online_rkey) {
|
||||
try {
|
||||
let tempRkeyData = await this.rkeyManager.getRkey();
|
||||
const tempRkeyData = await this.rkeyManager.getRkey();
|
||||
rkeyData.group_rkey = tempRkeyData.group_rkey;
|
||||
rkeyData.private_rkey = tempRkeyData.private_rkey;
|
||||
rkeyData.online_rkey = tempRkeyData.expired_time > Date.now() / 1000;
|
||||
@ -404,10 +404,10 @@ export class NTQQFileApi {
|
||||
if (isNTV2 && urlRkey) {
|
||||
return IMAGE_HTTP_HOST_NT + urlRkey;
|
||||
} else if (isNTV2 && rkeyData.online_rkey) {
|
||||
let rkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
|
||||
const rkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
|
||||
return IMAGE_HTTP_HOST_NT + url + `&rkey=${rkey}`;
|
||||
} else if (isNTV2 && imageFileId) {
|
||||
let rkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
|
||||
const rkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
|
||||
return IMAGE_HTTP_HOST + `/download?appid=${imageAppid}&fileid=${imageFileId}&rkey=${rkey}`;
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,9 @@ import {
|
||||
MemberExtSourceType,
|
||||
NapCatCore,
|
||||
} from '@/core';
|
||||
import {isNumeric, solveAsyncProblem} from '@/common/helper';
|
||||
import {LimitedHashTable} from '@/common/message-unique';
|
||||
import {NTEventWrapper} from '@/common/event';
|
||||
import { isNumeric, solveAsyncProblem } from '@/common/helper';
|
||||
import { LimitedHashTable } from '@/common/message-unique';
|
||||
import { NTEventWrapper } from '@/common/event';
|
||||
|
||||
export class NTQQGroupApi {
|
||||
context: InstanceContext;
|
||||
@ -46,8 +46,8 @@ export class NTQQGroupApi {
|
||||
}
|
||||
|
||||
async sendPacketRkey() {
|
||||
let data = this.core.apis.PacketApi.packetPacker.packRkeyPacket()
|
||||
let ret = await this.core.apis.PacketApi.sendPacket('OidbSvcTrpcTcp.0x9067_202', data, true);
|
||||
const data = this.core.apis.PacketApi.packetPacker.packRkeyPacket();
|
||||
const ret = await this.core.apis.PacketApi.sendPacket('OidbSvcTrpcTcp.0x9067_202', data, true);
|
||||
//console.log('ret: ', ret);
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
import * as os from 'os';
|
||||
import {InstanceContext, NapCatCore} from '..';
|
||||
import { InstanceContext, NapCatCore } from '..';
|
||||
import offset from '@/core/external/offset.json';
|
||||
import {PacketClient, RecvPacketData} from '@/core/packet/client';
|
||||
import {PacketSession} from "@/core/packet/session";
|
||||
import {PacketHexStr, PacketPacker} from "@/core/packet/packer";
|
||||
import {NapProtoMsg} from '@/core/packet/proto/NapProto';
|
||||
import {OidbSvcTrpcTcp0X9067_202_Rsp_Body} from '@/core/packet/proto/oidb/Oidb.0x9067_202';
|
||||
import {OidbSvcTrpcTcpBase, OidbSvcTrpcTcpBaseRsp} from '@/core/packet/proto/oidb/OidbBase';
|
||||
import {OidbSvcTrpcTcp0XFE1_2RSP} from '@/core/packet/proto/oidb/Oidb.fe1_2';
|
||||
import {PacketForwardNode} from "@/core/packet/msg/entity/forward";
|
||||
import { PacketClient, RecvPacketData } from '@/core/packet/client';
|
||||
import { PacketSession } from "@/core/packet/session";
|
||||
import { PacketHexStr, PacketPacker } from "@/core/packet/packer";
|
||||
import { NapProtoMsg } from '@/core/packet/proto/NapProto';
|
||||
import { OidbSvcTrpcTcp0X9067_202_Rsp_Body } from '@/core/packet/proto/oidb/Oidb.0x9067_202';
|
||||
import { OidbSvcTrpcTcpBase, OidbSvcTrpcTcpBaseRsp } from '@/core/packet/proto/oidb/OidbBase';
|
||||
import { OidbSvcTrpcTcp0XFE1_2RSP } from '@/core/packet/proto/oidb/Oidb.fe1_2';
|
||||
import { PacketForwardNode } from "@/core/packet/msg/entity/forward";
|
||||
|
||||
interface OffsetType {
|
||||
[key: string]: {
|
||||
@ -32,9 +32,9 @@ export class NTQQPacketApi {
|
||||
this.core = core;
|
||||
this.packetPacker = new PacketPacker();
|
||||
this.packetSession = undefined;
|
||||
let config = this.core.configLoader.configData;
|
||||
const config = this.core.configLoader.configData;
|
||||
if (config && config.packetServer && config.packetServer.length > 0) {
|
||||
let serverUrl = this.core.configLoader.configData.packetServer ?? '127.0.0.1:8086';
|
||||
const serverUrl = this.core.configLoader.configData.packetServer ?? '127.0.0.1:8086';
|
||||
this.InitSendPacket(serverUrl, this.context.basicInfoWrapper.getFullQQVesion())
|
||||
.then()
|
||||
.catch(this.core.context.logger.logError.bind(this.core.context.logger));
|
||||
@ -50,10 +50,10 @@ export class NTQQPacketApi {
|
||||
async InitSendPacket(serverUrl: string, qqversion: string) {
|
||||
this.serverUrl = serverUrl;
|
||||
this.qqVersion = qqversion;
|
||||
let offsetTable: OffsetType = offset;
|
||||
let table = offsetTable[qqversion + '-' + os.arch()];
|
||||
const offsetTable: OffsetType = offset;
|
||||
const table = offsetTable[qqversion + '-' + os.arch()];
|
||||
if (!table) return false;
|
||||
let url = 'ws://' + this.serverUrl + '/ws';
|
||||
const url = 'ws://' + this.serverUrl + '/ws';
|
||||
this.packetSession = new PacketSession(this.core.context.logger, new PacketClient(url, this.core));
|
||||
await this.packetSession.client.connect();
|
||||
await this.packetSession.client.init(process.pid, table.recv, table.send);
|
||||
@ -65,18 +65,18 @@ export class NTQQPacketApi {
|
||||
}
|
||||
|
||||
async sendPokePacket(group: number, peer: number) {
|
||||
let data = this.packetPacker.packPokePacket(group, peer);
|
||||
let ret = await this.sendPacket('OidbSvcTrpcTcp.0xed3_1', data, false);
|
||||
const data = this.packetPacker.packPokePacket(group, peer);
|
||||
const ret = await this.sendPacket('OidbSvcTrpcTcp.0xed3_1', data, false);
|
||||
//console.log('ret: ', ret);
|
||||
}
|
||||
|
||||
async sendRkeyPacket() {
|
||||
let packet = this.packetPacker.packRkeyPacket();
|
||||
let ret = await this.sendPacket('OidbSvcTrpcTcp.0x9067_202', packet, true);
|
||||
if (!ret?.hex_data) return []
|
||||
let body = new NapProtoMsg(OidbSvcTrpcTcpBaseRsp).decode(Buffer.from(ret.hex_data, 'hex')).body;
|
||||
const packet = this.packetPacker.packRkeyPacket();
|
||||
const ret = await this.sendPacket('OidbSvcTrpcTcp.0x9067_202', packet, true);
|
||||
if (!ret?.hex_data) return [];
|
||||
const body = new NapProtoMsg(OidbSvcTrpcTcpBaseRsp).decode(Buffer.from(ret.hex_data, 'hex')).body;
|
||||
//console.log('ret: ', Buffer.from(body).toString('hex'));
|
||||
let retData = new NapProtoMsg(OidbSvcTrpcTcp0X9067_202_Rsp_Body).decode(body)
|
||||
const retData = new NapProtoMsg(OidbSvcTrpcTcp0X9067_202_Rsp_Body).decode(body);
|
||||
//console.log('ret: ', JSON.stringify(retData.data.rkeyList));
|
||||
return retData.data.rkeyList;
|
||||
}
|
||||
@ -84,30 +84,30 @@ export class NTQQPacketApi {
|
||||
async sendStatusPacket(uin: number): Promise<{ status: number; ext_status: number; } | undefined> {
|
||||
let status = 0;
|
||||
try {
|
||||
let packet = this.packetPacker.packStatusPacket(uin);
|
||||
let ret = await this.sendPacket('OidbSvcTrpcTcp.0xfe1_2', packet, true);
|
||||
let data = Buffer.from(ret.hex_data, 'hex');
|
||||
let ext = new NapProtoMsg(OidbSvcTrpcTcp0XFE1_2RSP).decode(new NapProtoMsg(OidbSvcTrpcTcpBase).decode(data).body).data.status.value;
|
||||
const packet = this.packetPacker.packStatusPacket(uin);
|
||||
const ret = await this.sendPacket('OidbSvcTrpcTcp.0xfe1_2', packet, true);
|
||||
const data = Buffer.from(ret.hex_data, 'hex');
|
||||
const ext = new NapProtoMsg(OidbSvcTrpcTcp0XFE1_2RSP).decode(new NapProtoMsg(OidbSvcTrpcTcpBase).decode(data).body).data.status.value;
|
||||
// ext & 0xff00 + ext >> 16 & 0xff
|
||||
let extBigInt = BigInt(ext); // 转换为 BigInt
|
||||
const extBigInt = BigInt(ext); // 转换为 BigInt
|
||||
if (extBigInt <= 10n) {
|
||||
return {status: Number(extBigInt) * 10, ext_status: 0};
|
||||
return { status: Number(extBigInt) * 10, ext_status: 0 };
|
||||
}
|
||||
status = Number((extBigInt & 0xff00n) + ((extBigInt >> 16n) & 0xffn)); // 使用 BigInt 操作符
|
||||
return {status: 10, ext_status: status};
|
||||
return { status: 10, ext_status: status };
|
||||
} catch (error) {
|
||||
return undefined
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async sendSetSpecialTittlePacket(groupCode: string, uid: string, tittle: string) {
|
||||
let data = this.packetPacker.packSetSpecialTittlePacket(groupCode, uid, tittle);
|
||||
let ret = await this.sendPacket('OidbSvcTrpcTcp.0x8fc_2', data, true);
|
||||
const data = this.packetPacker.packSetSpecialTittlePacket(groupCode, uid, tittle);
|
||||
const ret = await this.sendPacket('OidbSvcTrpcTcp.0x8fc_2', data, true);
|
||||
}
|
||||
|
||||
async sendUploadForwardMsg(msg: PacketForwardNode[], groupUin: number = 0) {
|
||||
let data = this.packetPacker.packUploadForwardMsg(this.core.selfInfo.uid, msg, groupUin);
|
||||
let ret = await this.sendPacket('trpc.group.long_msg_interface.MsgService.SsoSendLongMsg', data, true);
|
||||
const data = this.packetPacker.packUploadForwardMsg(this.core.selfInfo.uid, msg, groupUin);
|
||||
const ret = await this.sendPacket('trpc.group.long_msg_interface.MsgService.SsoSendLongMsg', data, true);
|
||||
console.log(JSON.stringify(ret));
|
||||
}
|
||||
}
|
||||
|
@ -124,10 +124,10 @@ export class NTQQUserApi {
|
||||
const ClientKeyData = await this.forceFetchClientKey();
|
||||
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + this.core.selfInfo.uin +
|
||||
'&clientkey=' + ClientKeyData.clientKey + '&u1=https%3A%2F%2F' + domain + '%2F' + this.core.selfInfo.uin + '%2Finfocenter&keyindex=19%27';
|
||||
let data = await RequestUtil.HttpsGetCookies(requestUrl);
|
||||
const data = await RequestUtil.HttpsGetCookies(requestUrl);
|
||||
if (!data.p_skey || data.p_skey.length == 0) {
|
||||
try {
|
||||
let pskey = (await this.getPSkey([domain])).domainPskeyMap.get(domain);
|
||||
const pskey = (await this.getPSkey([domain])).domainPskeyMap.get(domain);
|
||||
if (pskey) data.p_skey = pskey;
|
||||
} catch {
|
||||
return data;
|
||||
|
@ -43,7 +43,7 @@ export class RkeyManager {
|
||||
//刷新rkey
|
||||
for (const url of this.serverUrl) {
|
||||
try {
|
||||
let temp = await RequestUtil.HttpGetJson<ServerRkeyData>(url, 'GET');
|
||||
const temp = await RequestUtil.HttpGetJson<ServerRkeyData>(url, 'GET');
|
||||
this.rkeyData = {
|
||||
group_rkey: temp.group_rkey.slice(6),
|
||||
private_rkey: temp.private_rkey.slice(6),
|
||||
|
@ -1,9 +1,9 @@
|
||||
import {LogWrapper} from "@/common/log";
|
||||
import {LRUCache} from "@/common/lru-cache";
|
||||
import WebSocket, {Data} from "ws";
|
||||
import crypto, {createHash} from "crypto";
|
||||
import {NapCatCore} from "@/core";
|
||||
import {PacketHexStr} from "@/core/packet/packer";
|
||||
import { LogWrapper } from "@/common/log";
|
||||
import { LRUCache } from "@/common/lru-cache";
|
||||
import WebSocket, { Data } from "ws";
|
||||
import crypto, { createHash } from "crypto";
|
||||
import { NapCatCore } from "@/core";
|
||||
import { PacketHexStr } from "@/core/packet/packer";
|
||||
|
||||
export interface RecvPacket {
|
||||
type: string, // 仅recv
|
||||
@ -24,7 +24,7 @@ export class PacketClient {
|
||||
private maxReconnectAttempts: number = 5;
|
||||
private cb = new LRUCache<string, (json: RecvPacketData) => Promise<void>>(500); // trace_id-type callback
|
||||
private readonly clientUrl: string = '';
|
||||
private readonly napCatCore: NapCatCore
|
||||
private readonly napCatCore: NapCatCore;
|
||||
private readonly logger: LogWrapper;
|
||||
|
||||
constructor(url: string, core: NapCatCore) {
|
||||
@ -39,7 +39,7 @@ export class PacketClient {
|
||||
|
||||
private randText(len: number) {
|
||||
let text = '';
|
||||
let possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for (let i = 0; i < len; i++) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
@ -147,10 +147,10 @@ export class PacketClient {
|
||||
|
||||
private async handleMessage(message: Data): Promise<void> {
|
||||
try {
|
||||
let json: RecvPacket = JSON.parse(message.toString());
|
||||
let trace_id_md5 = json.trace_id_md5;
|
||||
let action = json?.type ?? 'init';
|
||||
let event = this.cb.get(trace_id_md5 + action);
|
||||
const json: RecvPacket = JSON.parse(message.toString());
|
||||
const trace_id_md5 = json.trace_id_md5;
|
||||
const action = json?.type ?? 'init';
|
||||
const event = this.cb.get(trace_id_md5 + action);
|
||||
if (event) {
|
||||
await event(json.data);
|
||||
}
|
||||
@ -168,8 +168,8 @@ export class PacketClient {
|
||||
this.logger.logError('NapCat.Packet is not init');
|
||||
return undefined;
|
||||
}
|
||||
let md5 = crypto.createHash('md5').update(data).digest('hex');
|
||||
let trace_id = (this.randText(4) + md5 + data).slice(0, data.length / 2);
|
||||
const md5 = crypto.createHash('md5').update(data).digest('hex');
|
||||
const trace_id = (this.randText(4) + md5 + data).slice(0, data.length / 2);
|
||||
this.sendCommand(cmd, data, trace_id, rsp, 5000, async () => {
|
||||
await this.napCatCore.context.session.getMsgService().sendSsoCmdReqByContend(cmd, trace_id);
|
||||
}).then((res) => resolve(res)).catch((e) => reject(e));
|
||||
|
@ -1,12 +1,12 @@
|
||||
import {PushMsgBody} from "@/core/packet/proto/message/message";
|
||||
import {NapProtoEncodeStructType} from "@/core/packet/proto/NapProto";
|
||||
import { PushMsgBody } from "@/core/packet/proto/message/message";
|
||||
import { NapProtoEncodeStructType } from "@/core/packet/proto/NapProto";
|
||||
import * as crypto from "crypto";
|
||||
import {PacketForwardNode} from "@/core/packet/msg/entity/forward";
|
||||
import { PacketForwardNode } from "@/core/packet/msg/entity/forward";
|
||||
|
||||
export class PacketMsgBuilder {
|
||||
buildFakeMsg(selfUid: string, element: PacketForwardNode[]): NapProtoEncodeStructType<typeof PushMsgBody>[] {
|
||||
return element.map((node): NapProtoEncodeStructType<typeof PushMsgBody> => {
|
||||
const avatar = `https://q.qlogo.cn/headimg_dl?dst_uin=${node.senderId}&spec=640&img_type=jpg`
|
||||
const avatar = `https://q.qlogo.cn/headimg_dl?dst_uin=${node.senderId}&spec=640&img_type=jpg`;
|
||||
return {
|
||||
responseHead: {
|
||||
fromUid: "",
|
||||
@ -46,7 +46,7 @@ export class PacketMsgBuilder {
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {NapProtoEncodeStructType, NapProtoMsg} from "@/core/packet/proto/NapProto";
|
||||
import {Elem, MentionExtra} from "@/core/packet/proto/message/element";
|
||||
import { NapProtoEncodeStructType, NapProtoMsg } from "@/core/packet/proto/NapProto";
|
||||
import { Elem, MentionExtra } from "@/core/packet/proto/message/element";
|
||||
import {
|
||||
AtType,
|
||||
SendArkElement,
|
||||
@ -54,23 +54,23 @@ export class PacketMsgAtElement extends PacketMsgTextElement {
|
||||
constructor(element: SendTextElement) {
|
||||
super(element);
|
||||
this.targetUid = element.textElement.atNtUid;
|
||||
this.atAll = element.textElement.atType === AtType.atAll
|
||||
this.atAll = element.textElement.atType === AtType.atAll;
|
||||
}
|
||||
|
||||
buildElement(): NapProtoEncodeStructType<typeof Elem> {
|
||||
const res = new NapProtoMsg(MentionExtra).encode({
|
||||
type: this.atAll ? 1 : 2,
|
||||
uin: 0,
|
||||
field5: 0,
|
||||
uid: this.targetUid,
|
||||
}
|
||||
)
|
||||
type: this.atAll ? 1 : 2,
|
||||
uin: 0,
|
||||
field5: 0,
|
||||
uid: this.targetUid,
|
||||
}
|
||||
);
|
||||
return {
|
||||
text: {
|
||||
str: this.text,
|
||||
pbReserve: res
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {IPacketMsgElement} from "@/core/packet/msg/element";
|
||||
import {SendMessageElement} from "@/core";
|
||||
import { IPacketMsgElement } from "@/core/packet/msg/element";
|
||||
import { SendMessageElement } from "@/core";
|
||||
|
||||
export interface PacketForwardNode {
|
||||
groupId?: number
|
||||
|
@ -5,14 +5,14 @@ import { OidbSvcTrpcTcp0X9067_202 } from "@/core/packet/proto/oidb/Oidb.0x9067_2
|
||||
import { OidbSvcTrpcTcp0X8FC_2, OidbSvcTrpcTcp0X8FC_2_Body } from "@/core/packet/proto/oidb/Oidb.0x8FC_2";
|
||||
import { OidbSvcTrpcTcp0XFE1_2 } from "@/core/packet/proto/oidb/Oidb.fe1_2";
|
||||
import { OidbSvcTrpcTcp0XED3_1 } from "@/core/packet/proto/oidb/Oidb.ed3_1";
|
||||
import {LongMsgResult, SendLongMsgReq} from "@/core/packet/proto/message/action";
|
||||
import {PacketMsgBuilder} from "@/core/packet/msg/builder";
|
||||
import {PacketForwardNode} from "@/core/packet/msg/entity/forward";
|
||||
import { LongMsgResult, SendLongMsgReq } from "@/core/packet/proto/message/action";
|
||||
import { PacketMsgBuilder } from "@/core/packet/msg/builder";
|
||||
import { PacketForwardNode } from "@/core/packet/msg/entity/forward";
|
||||
|
||||
export type PacketHexStr = string & { readonly hexNya: unique symbol };
|
||||
|
||||
export class PacketPacker {
|
||||
private packetBuilder: PacketMsgBuilder
|
||||
private packetBuilder: PacketMsgBuilder;
|
||||
|
||||
constructor() {
|
||||
this.packetBuilder = new PacketMsgBuilder();
|
||||
@ -79,7 +79,7 @@ export class PacketPacker {
|
||||
}
|
||||
|
||||
packStatusPacket(uin: number): PacketHexStr {
|
||||
let oidb_0xfe1_2 = new NapProtoMsg(OidbSvcTrpcTcp0XFE1_2).encode({
|
||||
const oidb_0xfe1_2 = new NapProtoMsg(OidbSvcTrpcTcp0XFE1_2).encode({
|
||||
uin: uin,
|
||||
key: [{ key: 27372 }]
|
||||
});
|
||||
@ -98,7 +98,7 @@ export class PacketPacker {
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
// console.log("packUploadForwardMsg LONGMSGRESULT!!!", this.toHexStr(longMsgResultData));
|
||||
const payload = zlib.gzipSync(Buffer.from(longMsgResultData));
|
||||
// console.log("packUploadForwardMsg PAYLOAD!!!", payload);
|
||||
@ -116,7 +116,7 @@ export class PacketPacker {
|
||||
field1: 4, field2: 1, field3: 7, field4: 0
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
// console.log("packUploadForwardMsg REQ!!!", req);
|
||||
return this.toHexStr(req);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {ScalarType} from "@protobuf-ts/runtime";
|
||||
import {ProtoField} from "../NapProto";
|
||||
import {PushMsgBody} from "@/core/packet/proto/message/message";
|
||||
import { ScalarType } from "@protobuf-ts/runtime";
|
||||
import { ProtoField } from "../NapProto";
|
||||
import { PushMsgBody } from "@/core/packet/proto/message/message";
|
||||
|
||||
export const LongMsgResult = {
|
||||
action: ProtoField(2, () => LongMsgAction)
|
||||
|
@ -20,7 +20,7 @@ export const Elem = {
|
||||
srcMsg: ProtoField(45, () => SrcMsg, true),
|
||||
lightAppElem: ProtoField(51, () => LightAppElem, true),
|
||||
commonElem: ProtoField(53, () => CommonElem, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const Text = {
|
||||
str: ProtoField(1, ScalarType.STRING, true),
|
||||
@ -29,7 +29,7 @@ export const Text = {
|
||||
attr7Buf: ProtoField(4, ScalarType.BYTES, true),
|
||||
buf: ProtoField(11, ScalarType.BYTES, true),
|
||||
pbReserve: ProtoField(12, ScalarType.BYTES, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const Face = {
|
||||
index: ProtoField(1, ScalarType.INT32, true),
|
||||
@ -41,7 +41,7 @@ export const OnlineImage = {
|
||||
guid: ProtoField(1, ScalarType.BYTES),
|
||||
filePath: ProtoField(2, ScalarType.BYTES),
|
||||
oldVerSendFile: ProtoField(3, ScalarType.BYTES),
|
||||
}
|
||||
};
|
||||
|
||||
export const NotOnlineImage = {
|
||||
filePath: ProtoField(1, ScalarType.STRING),
|
||||
@ -73,7 +73,7 @@ export const NotOnlineImage = {
|
||||
x400Width: ProtoField(27, ScalarType.INT32),
|
||||
x400Height: ProtoField(28, ScalarType.INT32),
|
||||
pbRes: ProtoField(29, () => NotOnlineImage_PbReserve),
|
||||
}
|
||||
};
|
||||
|
||||
export const NotOnlineImage_PbReserve = {
|
||||
subType: ProtoField(1, ScalarType.INT32),
|
||||
@ -84,7 +84,7 @@ export const NotOnlineImage_PbReserve = {
|
||||
field20: ProtoField(20, () => NotOnlineImage_PbReserve2),
|
||||
url: ProtoField(30, ScalarType.STRING),
|
||||
md5Str: ProtoField(31, ScalarType.STRING),
|
||||
}
|
||||
};
|
||||
|
||||
export const NotOnlineImage_PbReserve2 = {
|
||||
field1: ProtoField(1, ScalarType.INT32),
|
||||
@ -93,12 +93,12 @@ export const NotOnlineImage_PbReserve2 = {
|
||||
field4: ProtoField(4, ScalarType.INT32),
|
||||
field5: ProtoField(5, ScalarType.INT32),
|
||||
field7: ProtoField(7, ScalarType.STRING),
|
||||
}
|
||||
};
|
||||
|
||||
export const TransElem = {
|
||||
elemType: ProtoField(1, ScalarType.INT32),
|
||||
elemValue: ProtoField(2, ScalarType.BYTES),
|
||||
}
|
||||
};
|
||||
|
||||
export const MarketFace = {
|
||||
faceName: ProtoField(1, ScalarType.BYTES),
|
||||
@ -114,7 +114,7 @@ export const MarketFace = {
|
||||
imageHeight: ProtoField(11, ScalarType.INT32),
|
||||
mobileparam: ProtoField(12, ScalarType.BYTES),
|
||||
pbReserve: ProtoField(13, ScalarType.BYTES),
|
||||
}
|
||||
};
|
||||
|
||||
export const CustomFace = {
|
||||
guid: ProtoField(1, ScalarType.BYTES),
|
||||
@ -151,12 +151,12 @@ export const CustomFace = {
|
||||
x400Width: ProtoField(32, ScalarType.INT32),
|
||||
x400Height: ProtoField(33, ScalarType.INT32),
|
||||
pbRes: ProtoField(34, () => CustomFace_PbReserve, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const CustomFace_PbReserve = {
|
||||
subType: ProtoField(1, ScalarType.INT32),
|
||||
summary: ProtoField(9, ScalarType.STRING),
|
||||
}
|
||||
};
|
||||
|
||||
export const ElemFlags2 = {
|
||||
colorTextId: ProtoField(1, ScalarType.UINT32),
|
||||
@ -173,7 +173,7 @@ export const ElemFlags2 = {
|
||||
customFont: ProtoField(12, ScalarType.UINT32),
|
||||
pcSupportDef: ProtoField(13, () => PcSupportDef),
|
||||
crmFlags: ProtoField(14, ScalarType.UINT32, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const PcSupportDef = {
|
||||
pcPtlBegin: ProtoField(1, ScalarType.UINT32),
|
||||
@ -182,12 +182,12 @@ export const PcSupportDef = {
|
||||
macPtlEnd: ProtoField(4, ScalarType.UINT32),
|
||||
ptlsSupport: ProtoField(5, ScalarType.INT32, false, true),
|
||||
ptlsNotSupport: ProtoField(6, ScalarType.UINT32, false, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const Instance = {
|
||||
appId: ProtoField(1, ScalarType.UINT32),
|
||||
instId: ProtoField(2, ScalarType.UINT32),
|
||||
}
|
||||
};
|
||||
|
||||
export const RichMsg = {
|
||||
template1: ProtoField(1, ScalarType.BYTES, true),
|
||||
@ -195,7 +195,7 @@ export const RichMsg = {
|
||||
msgResId: ProtoField(3, ScalarType.BYTES, true),
|
||||
rand: ProtoField(4, ScalarType.INT32, true),
|
||||
seq: ProtoField(5, ScalarType.UINT32, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const GroupFile = {
|
||||
filename: ProtoField(1, ScalarType.BYTES),
|
||||
@ -208,7 +208,7 @@ export const GroupFile = {
|
||||
batchItemId: ProtoField(8, ScalarType.BYTES),
|
||||
feedMsgTime: ProtoField(9, ScalarType.INT32),
|
||||
pbReserve: ProtoField(10, ScalarType.BYTES),
|
||||
}
|
||||
};
|
||||
|
||||
export const ExtraInfo = {
|
||||
nick: ProtoField(1, ScalarType.BYTES),
|
||||
@ -223,7 +223,7 @@ export const ExtraInfo = {
|
||||
msgStateFlag: ProtoField(10, ScalarType.INT32),
|
||||
apnsSoundType: ProtoField(11, ScalarType.INT32),
|
||||
newGroupFlag: ProtoField(12, ScalarType.INT32),
|
||||
}
|
||||
};
|
||||
|
||||
export const VideoFile = {
|
||||
fileUuid: ProtoField(1, ScalarType.STRING),
|
||||
@ -250,7 +250,7 @@ export const VideoFile = {
|
||||
thumbDownloadFlag: ProtoField(22, ScalarType.INT32),
|
||||
videoDownloadFlag: ProtoField(23, ScalarType.INT32),
|
||||
pbReserve: ProtoField(24, ScalarType.BYTES),
|
||||
}
|
||||
};
|
||||
|
||||
export const AnonymousGroupMessage = {
|
||||
flags: ProtoField(1, ScalarType.INT32),
|
||||
@ -260,7 +260,7 @@ export const AnonymousGroupMessage = {
|
||||
expireTime: ProtoField(5, ScalarType.INT32),
|
||||
bubbleId: ProtoField(6, ScalarType.INT32),
|
||||
rankColor: ProtoField(7, ScalarType.BYTES),
|
||||
}
|
||||
};
|
||||
|
||||
export const CustomElem = {
|
||||
desc: ProtoField(1, ScalarType.BYTES),
|
||||
@ -268,7 +268,7 @@ export const CustomElem = {
|
||||
enumType: ProtoField(3, ScalarType.INT32),
|
||||
ext: ProtoField(4, ScalarType.BYTES),
|
||||
sound: ProtoField(5, ScalarType.BYTES),
|
||||
}
|
||||
};
|
||||
|
||||
export const GeneralFlags = {
|
||||
bubbleDiyTextId: ProtoField(1, ScalarType.INT32),
|
||||
@ -304,29 +304,29 @@ export const SrcMsg = {
|
||||
sourceMsg: ProtoField(9, ScalarType.BYTES, true),
|
||||
toUin: ProtoField(10, ScalarType.UINT64, true),
|
||||
troopName: ProtoField(11, ScalarType.BYTES, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const LightAppElem = {
|
||||
data: ProtoField(1, ScalarType.BYTES),
|
||||
msgResid: ProtoField(2, ScalarType.BYTES, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const CommonElem = {
|
||||
serviceType: ProtoField(1, ScalarType.INT32),
|
||||
pbElem: ProtoField(2, ScalarType.BYTES),
|
||||
businessType: ProtoField(3, ScalarType.UINT32),
|
||||
}
|
||||
};
|
||||
|
||||
export const FaceExtra = {
|
||||
faceId: ProtoField(1, ScalarType.INT32, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const MentionExtra = {
|
||||
type: ProtoField(3, ScalarType.INT32, true),
|
||||
uin: ProtoField(4, ScalarType.UINT32, true),
|
||||
field5: ProtoField(5, ScalarType.INT32, true),
|
||||
uid: ProtoField(9, ScalarType.STRING, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const QFaceExtra = {
|
||||
field1: ProtoField(1, ScalarType.STRING, true),
|
||||
@ -337,10 +337,10 @@ export const QFaceExtra = {
|
||||
field6: ProtoField(6, ScalarType.STRING, true),
|
||||
preview: ProtoField(7, ScalarType.STRING, true),
|
||||
field9: ProtoField(9, ScalarType.INT32, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const QSmallFaceExtra = {
|
||||
faceId: ProtoField(1, ScalarType.UINT32),
|
||||
preview: ProtoField(2, ScalarType.STRING),
|
||||
preview2: ProtoField(3, ScalarType.STRING),
|
||||
}
|
||||
};
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { ScalarType } from "@protobuf-ts/runtime";
|
||||
import { ProtoField } from "../NapProto";
|
||||
import {ForwardHead, Grp, GrpTmp, ResponseForward, ResponseGrp, Trans0X211, WPATmp} from "@/core/packet/proto/message/routing";
|
||||
import {RichText} from "@/core/packet/proto/message/component";
|
||||
import {C2C} from "@/core/packet/proto/message/c2c";
|
||||
import { ForwardHead, Grp, GrpTmp, ResponseForward, ResponseGrp, Trans0X211, WPATmp } from "@/core/packet/proto/message/routing";
|
||||
import { RichText } from "@/core/packet/proto/message/component";
|
||||
import { C2C } from "@/core/packet/proto/message/c2c";
|
||||
|
||||
export const ContentHead = {
|
||||
type: ProtoField(1, ScalarType.UINT32),
|
||||
|
@ -9,8 +9,8 @@ export const OidbSvcTrpcTcp0X8FC_2_Body = {
|
||||
expiredTime: ProtoField(6, ScalarType.SINT32),
|
||||
uinName: ProtoField(7, ScalarType.STRING),
|
||||
targetName: ProtoField(8, ScalarType.STRING),
|
||||
}
|
||||
};
|
||||
export const OidbSvcTrpcTcp0X8FC_2 = {
|
||||
groupUin: ProtoField(1, ScalarType.UINT32),
|
||||
body: ProtoField(3, ScalarType.BYTES),
|
||||
}
|
||||
};
|
@ -6,10 +6,10 @@ import { MultiMediaReqHead } from "./common/Ntv2.RichMedia";
|
||||
export const OidbSvcTrpcTcp0X9067_202 = {
|
||||
ReqHead: ProtoField(1, () => MultiMediaReqHead),
|
||||
DownloadRKeyReq: ProtoField(4, () => OidbSvcTrpcTcp0X9067_202Key),
|
||||
}
|
||||
};
|
||||
export const OidbSvcTrpcTcp0X9067_202Key = {
|
||||
key: ProtoField(1, ScalarType.INT32, false, true),
|
||||
}
|
||||
};
|
||||
|
||||
//Rsp
|
||||
export const OidbSvcTrpcTcp0X9067_202_RkeyList = {
|
||||
@ -17,10 +17,10 @@ export const OidbSvcTrpcTcp0X9067_202_RkeyList = {
|
||||
time: ProtoField(4, ScalarType.UINT32),
|
||||
type: ProtoField(5, ScalarType.UINT32),
|
||||
|
||||
}
|
||||
};
|
||||
export const OidbSvcTrpcTcp0X9067_202_Data = {
|
||||
rkeyList: ProtoField(1, () => OidbSvcTrpcTcp0X9067_202_RkeyList, false, true),
|
||||
}
|
||||
};
|
||||
export const OidbSvcTrpcTcp0X9067_202_Rsp_Body = {
|
||||
data: ProtoField(4, () => OidbSvcTrpcTcp0X9067_202_Data),
|
||||
}
|
||||
};
|
@ -7,4 +7,4 @@ export const OidbSvcTrpcTcp0XED3_1 = {
|
||||
groupUin: ProtoField(2, ScalarType.UINT32),
|
||||
friendUin: ProtoField(5, ScalarType.UINT32),
|
||||
ext: ProtoField(6, ScalarType.UINT32, true)
|
||||
}
|
||||
};
|
||||
|
@ -4,20 +4,20 @@ import { ProtoField } from "../NapProto";
|
||||
export const OidbSvcTrpcTcp0XFE1_2 = {
|
||||
uin: ProtoField(1, ScalarType.UINT32),
|
||||
key: ProtoField(3, () => OidbSvcTrpcTcp0XFE1_2Key, false, true),
|
||||
}
|
||||
};
|
||||
|
||||
export const OidbSvcTrpcTcp0XFE1_2Key = {
|
||||
key: ProtoField(1, ScalarType.UINT32)
|
||||
}
|
||||
};
|
||||
export const OidbSvcTrpcTcp0XFE1_2RSP_Status = {
|
||||
key: ProtoField(1, ScalarType.UINT32),
|
||||
value: ProtoField(2, ScalarType.UINT64)
|
||||
}
|
||||
};
|
||||
|
||||
export const OidbSvcTrpcTcp0XFE1_2RSP_Data = {
|
||||
status: ProtoField(2, () => OidbSvcTrpcTcp0XFE1_2RSP_Status)
|
||||
}
|
||||
};
|
||||
|
||||
export const OidbSvcTrpcTcp0XFE1_2RSP = {
|
||||
data: ProtoField(1, () => OidbSvcTrpcTcp0XFE1_2RSP_Data)
|
||||
}
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ export const OidbSvcTrpcTcpBase = {
|
||||
body: ProtoField(4, ScalarType.BYTES),
|
||||
errorMsg: ProtoField(5, ScalarType.STRING, true),
|
||||
isReserved: ProtoField(12, ScalarType.UINT32)
|
||||
}
|
||||
};
|
||||
export const OidbSvcTrpcTcpBaseRsp = {
|
||||
body: ProtoField(4, ScalarType.BYTES)
|
||||
}
|
||||
};
|
@ -4,35 +4,35 @@ import { ProtoField } from "../../NapProto";
|
||||
export const NTV2RichMediaReq = {
|
||||
ReqHead: ProtoField(1, ScalarType.BYTES),
|
||||
DownloadRKeyReq: ProtoField(4, ScalarType.BYTES),
|
||||
}
|
||||
};
|
||||
export const MultiMediaReqHead = {
|
||||
Common: ProtoField(1, () => CommonHead),
|
||||
Scene: ProtoField(2, () => SceneInfo),
|
||||
Client: ProtoField(3, () => ClientMeta),
|
||||
}
|
||||
};
|
||||
export const CommonHead = {
|
||||
RequestId: ProtoField(1, ScalarType.UINT32),
|
||||
Command: ProtoField(2, ScalarType.UINT32),
|
||||
}
|
||||
};
|
||||
export const SceneInfo = {
|
||||
RequestType: ProtoField(101, ScalarType.UINT32),
|
||||
BusinessType: ProtoField(102, ScalarType.UINT32),
|
||||
SceneType: ProtoField(200, ScalarType.UINT32),
|
||||
}
|
||||
};
|
||||
export const ClientMeta = {
|
||||
AgentType: ProtoField(1, ScalarType.UINT32),
|
||||
}
|
||||
};
|
||||
export const C2CUserInfo = {
|
||||
AccountType: ProtoField(1, ScalarType.UINT32),
|
||||
TargetUid: ProtoField(2, ScalarType.STRING),
|
||||
}
|
||||
};
|
||||
export const GroupInfo = {
|
||||
GroupUin: ProtoField(1, ScalarType.UINT32),
|
||||
}
|
||||
};
|
||||
export const DownloadReq = {
|
||||
Node: ProtoField(1, ScalarType.BYTES),
|
||||
Download: ProtoField(2, ScalarType.BYTES),
|
||||
}
|
||||
};
|
||||
export const FileInfo = {
|
||||
FileSize: ProtoField(1, ScalarType.UINT32),
|
||||
FileHash: ProtoField(2, ScalarType.STRING),
|
||||
@ -43,7 +43,7 @@ export const FileInfo = {
|
||||
Height: ProtoField(7, ScalarType.UINT32),
|
||||
Time: ProtoField(8, ScalarType.UINT32),
|
||||
Original: ProtoField(9, ScalarType.UINT32),
|
||||
}
|
||||
};
|
||||
export const IndexNode = {
|
||||
Info: ProtoField(1, ScalarType.BYTES),
|
||||
FileUuid: ProtoField(2, ScalarType.STRING),
|
||||
@ -51,33 +51,33 @@ export const IndexNode = {
|
||||
UploadTime: ProtoField(4, ScalarType.UINT32),
|
||||
Ttl: ProtoField(5, ScalarType.UINT32),
|
||||
subType: ProtoField(6, ScalarType.UINT32),
|
||||
}
|
||||
};
|
||||
export const FileType = {
|
||||
Type: ProtoField(1, ScalarType.UINT32),
|
||||
PicFormat: ProtoField(2, ScalarType.UINT32),
|
||||
VideoFormat: ProtoField(3, ScalarType.UINT32),
|
||||
VoiceFormat: ProtoField(4, ScalarType.UINT32),
|
||||
}
|
||||
};
|
||||
export const DownloadExt = {
|
||||
Pic: ProtoField(1, ScalarType.BYTES),
|
||||
Video: ProtoField(2, ScalarType.BYTES),
|
||||
Ptt: ProtoField(3, ScalarType.BYTES),
|
||||
}
|
||||
};
|
||||
export const VideoDownloadExt = {
|
||||
BusiType: ProtoField(1, ScalarType.UINT32),
|
||||
SceneType: ProtoField(2, ScalarType.UINT32),
|
||||
SubBusiType: ProtoField(3, ScalarType.UINT32),
|
||||
}
|
||||
export const PicDownloadExt = {}
|
||||
export const PttDownloadExt = {}
|
||||
};
|
||||
export const PicDownloadExt = {};
|
||||
export const PttDownloadExt = {};
|
||||
export const PicUrlExtInfo = {
|
||||
OriginalParameter: ProtoField(1, ScalarType.STRING),
|
||||
BigParameter: ProtoField(2, ScalarType.STRING),
|
||||
ThumbParameter: ProtoField(3, ScalarType.STRING),
|
||||
}
|
||||
};
|
||||
export const VideoExtInfo = {
|
||||
VideoCodecFormat: ProtoField(1, ScalarType.UINT32),
|
||||
}
|
||||
};
|
||||
export const MsgInfo = {
|
||||
|
||||
}
|
||||
};
|
||||
|
@ -1,11 +1,11 @@
|
||||
import {PacketClient} from "@/core/packet/client";
|
||||
import {PacketHighwayClient} from "@/core/packet/highway/highwayClient";
|
||||
import {LogWrapper} from "@/common/log";
|
||||
import { PacketClient } from "@/core/packet/client";
|
||||
import { PacketHighwayClient } from "@/core/packet/highway/highwayClient";
|
||||
import { LogWrapper } from "@/common/log";
|
||||
|
||||
export class PacketSession {
|
||||
readonly logger: LogWrapper;
|
||||
readonly client: PacketClient;
|
||||
private highwayClient: PacketHighwayClient
|
||||
private highwayClient: PacketHighwayClient;
|
||||
|
||||
constructor(logger: LogWrapper, client: PacketClient) {
|
||||
this.logger = logger;
|
||||
|
@ -14,7 +14,7 @@ export class Native {
|
||||
if (!this.supportedPlatforms.includes(this.platform)) {
|
||||
throw new Error(`Platform ${this.platform} is not supported`);
|
||||
}
|
||||
let nativeNode = path.join(nodePath, './native/MoeHoo.win32.node');
|
||||
const nativeNode = path.join(nodePath, './native/MoeHoo.win32.node');
|
||||
if (fs.existsSync(nativeNode)) {
|
||||
dlopen(this.MoeHooExport, nativeNode, constants.dlopen.RTLD_LAZY);
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ export class SetSpecialTittle extends BaseAction<Payload, any> {
|
||||
if (!this.core.apis.PacketApi.available) {
|
||||
throw new Error('PacketClient is not init');
|
||||
}
|
||||
let uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||
if(!uid) throw new Error('User not found');
|
||||
await this.core.apis.PacketApi.sendSetSpecialTittlePacket(payload.group_id.toString(), uid, payload.special_title);
|
||||
await this.core.apis.PacketApi.sendSetSpecialTittlePacket(payload.group_id.toString(), uid, payload.special_title);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import {PacketMsgTextElement} from "@/core/packet/msg/element";
|
||||
import {SendTextElement} from "@/core";
|
||||
import { PacketMsgTextElement } from "@/core/packet/msg/element";
|
||||
import { SendTextElement } from "@/core";
|
||||
|
||||
|
||||
const SchemaData = {
|
||||
|
@ -83,7 +83,7 @@ export class GoCQHTTPGetForwardMsgAction extends BaseAction<Payload, any> {
|
||||
}
|
||||
//if (this.obContext.configLoader.configData.messagePostFormat === 'array') {
|
||||
//提取
|
||||
let realmsg = ((await this.parseForward([resMsg]))[0].data.message as OB11MessageNode[])[0].data.message;
|
||||
const realmsg = ((await this.parseForward([resMsg]))[0].data.message as OB11MessageNode[])[0].data.message;
|
||||
//里面都是offline消息 id都是0 没得说话
|
||||
return { message: realmsg };
|
||||
//}
|
||||
|
@ -33,7 +33,7 @@ class GetMsg extends BaseAction<Payload, OB11Message> {
|
||||
throw new Error('消息不存在');
|
||||
}
|
||||
const peer = { guildId: '', peerUid: msgIdWithPeer?.Peer.peerUid, chatType: msgIdWithPeer.Peer.chatType };
|
||||
let orimsg = this.obContext.recallMsgCache.get(msgIdWithPeer.MsgId);
|
||||
const orimsg = this.obContext.recallMsgCache.get(msgIdWithPeer.MsgId);
|
||||
let msg: RawMessage;
|
||||
if (orimsg) {
|
||||
msg = orimsg;
|
||||
|
@ -696,7 +696,7 @@ export class OneBotMsgApi {
|
||||
resMsg.sub_type = 'group';
|
||||
const ret = await this.core.apis.MsgApi.getTempChatInfo(ChatType.KCHATTYPETEMPC2CFROMGROUP, msg.senderUid);
|
||||
if (ret.result === 0) {
|
||||
let member = await this.core.apis.GroupApi.getGroupMember(msg.peerUin, msg.senderUin);
|
||||
const member = await this.core.apis.GroupApi.getGroupMember(msg.peerUin, msg.senderUin);
|
||||
resMsg.group_id = parseInt(ret.tmpChatInfo!.groupCode);
|
||||
resMsg.sender.nickname = member?.nick ?? member?.cardName ?? '临时会话';
|
||||
resMsg.temp_source = resMsg.group_id;
|
||||
|
@ -85,19 +85,19 @@ export class NapCatOneBot11Adapter {
|
||||
if (!this.nativeCore.inited) throw new Error('Native Not Init');
|
||||
this.nativeCore.registerRecallCallback(async (hex: string) => {
|
||||
try {
|
||||
let data = decodeMessage(Buffer.from(hex, 'hex')) as any;
|
||||
const data = decodeMessage(Buffer.from(hex, 'hex')) as any;
|
||||
//data.MsgHead.BodyInner.MsgType SubType
|
||||
let bodyInner = data.msgHead?.bodyInner;
|
||||
const bodyInner = data.msgHead?.bodyInner;
|
||||
//context.logger.log("[appNative] Parse MsgType:" + bodyInner.msgType + " / SubType:" + bodyInner.subType);
|
||||
if (bodyInner && bodyInner.msgType == 732 && bodyInner.subType == 17) {
|
||||
let RecallData = Buffer.from(data.msgHead.noifyData.innerData);
|
||||
const RecallData = Buffer.from(data.msgHead.noifyData.innerData);
|
||||
//跳过 4字节 群号 + 不知道的1字节 +2字节 长度
|
||||
let uid = RecallData.readUint32BE();
|
||||
const uid = RecallData.readUint32BE();
|
||||
const buffer = Buffer.from(RecallData.toString('hex').slice(14), 'hex');
|
||||
let seq: number = decodeRecallGroup(buffer).recallDetails.subDetail.msgSeq;
|
||||
let peer: Peer = { chatType: ChatType.KCHATTYPEGROUP, peerUid: uid.toString() };
|
||||
const seq: number = decodeRecallGroup(buffer).recallDetails.subDetail.msgSeq;
|
||||
const peer: Peer = { chatType: ChatType.KCHATTYPEGROUP, peerUid: uid.toString() };
|
||||
context.logger.log("[Native] 群消息撤回 Peer: " + uid.toString() + " / MsgSeq:" + seq);
|
||||
let msgs = await core.apis.MsgApi.queryMsgsWithFilterExWithSeq(peer, seq.toString());
|
||||
const msgs = await core.apis.MsgApi.queryMsgsWithFilterExWithSeq(peer, seq.toString());
|
||||
this.recallMsgCache.put(msgs.msgList[0].msgId, msgs.msgList[0]);
|
||||
}
|
||||
} catch (error: any) {
|
||||
|
Loading…
Reference in New Issue
Block a user