mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
@@ -6,13 +6,14 @@ import {
|
|||||||
PacketMsgFileElement,
|
PacketMsgFileElement,
|
||||||
PacketMsgPicElement,
|
PacketMsgPicElement,
|
||||||
PacketMsgPttElement,
|
PacketMsgPttElement,
|
||||||
PacketMsgVideoElement
|
PacketMsgReplyElement,
|
||||||
|
PacketMsgVideoElement,
|
||||||
} from '@/core/packet/message/element';
|
} from '@/core/packet/message/element';
|
||||||
import { ChatType, MsgSourceType, NTMsgType, RawMessage } from '@/core';
|
import { ChatType, MsgSourceType, NTMsgType, RawMessage } from '@/core';
|
||||||
import { MiniAppRawData, MiniAppReqParams } from '@/core/packet/entities/miniApp';
|
import { MiniAppRawData, MiniAppReqParams } from '@/core/packet/entities/miniApp';
|
||||||
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
||||||
import { NapProtoDecodeStructType, NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoDecodeStructType, NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
import { IndexNode, LongMsgResult, MsgInfo } from '@/core/packet/transformer/proto';
|
import { IndexNode, LongMsgResult, MsgInfo, PushMsgBody } from '@/core/packet/transformer/proto';
|
||||||
import { OidbPacket } from '@/core/packet/transformer/base';
|
import { OidbPacket } from '@/core/packet/transformer/base';
|
||||||
import { ImageOcrResult } from '@/core/packet/entities/ocrResult';
|
import { ImageOcrResult } from '@/core/packet/entities/ocrResult';
|
||||||
import { gunzipSync } from 'zlib';
|
import { gunzipSync } from 'zlib';
|
||||||
@@ -76,22 +77,24 @@ export class PacketOperationContext {
|
|||||||
async UploadResources(msg: PacketMsg[], groupUin: number = 0) {
|
async UploadResources(msg: PacketMsg[], groupUin: number = 0) {
|
||||||
const chatType = groupUin ? ChatType.KCHATTYPEGROUP : ChatType.KCHATTYPEC2C;
|
const chatType = groupUin ? ChatType.KCHATTYPEGROUP : ChatType.KCHATTYPEC2C;
|
||||||
const peerUid = groupUin ? String(groupUin) : this.context.napcore.basicInfo.uid;
|
const peerUid = groupUin ? String(groupUin) : this.context.napcore.basicInfo.uid;
|
||||||
const reqList = msg.flatMap(m =>
|
const reqList = msg.flatMap((m) =>
|
||||||
m.msg.map(e => {
|
m.msg
|
||||||
if (e instanceof PacketMsgPicElement) {
|
.map((e) => {
|
||||||
return this.context.highway.uploadImage({ chatType, peerUid }, e);
|
if (e instanceof PacketMsgPicElement) {
|
||||||
} else if (e instanceof PacketMsgVideoElement) {
|
return this.context.highway.uploadImage({ chatType, peerUid }, e);
|
||||||
return this.context.highway.uploadVideo({ chatType, peerUid }, e);
|
} else if (e instanceof PacketMsgVideoElement) {
|
||||||
} else if (e instanceof PacketMsgPttElement) {
|
return this.context.highway.uploadVideo({ chatType, peerUid }, e);
|
||||||
return this.context.highway.uploadPtt({ chatType, peerUid }, e);
|
} else if (e instanceof PacketMsgPttElement) {
|
||||||
} else if (e instanceof PacketMsgFileElement) {
|
return this.context.highway.uploadPtt({ chatType, peerUid }, e);
|
||||||
return this.context.highway.uploadFile({ chatType, peerUid }, e);
|
} else if (e instanceof PacketMsgFileElement) {
|
||||||
}
|
return this.context.highway.uploadFile({ chatType, peerUid }, e);
|
||||||
return null;
|
}
|
||||||
}).filter(Boolean)
|
return null;
|
||||||
|
})
|
||||||
|
.filter(Boolean)
|
||||||
);
|
);
|
||||||
const res = await Promise.allSettled(reqList);
|
const res = await Promise.allSettled(reqList);
|
||||||
this.context.logger.info(`上传资源${res.length}个,失败${res.filter(r => r.status === 'rejected').length}个`);
|
this.context.logger.info(`上传资源${res.length}个,失败${res.filter((r) => r.status === 'rejected').length}个`);
|
||||||
res.forEach((result, index) => {
|
res.forEach((result, index) => {
|
||||||
if (result.status === 'rejected') {
|
if (result.status === 'rejected') {
|
||||||
this.context.logger.error(`上传第${index + 1}个资源失败:${result.reason.stack}`);
|
this.context.logger.error(`上传第${index + 1}个资源失败:${result.reason.stack}`);
|
||||||
@@ -100,10 +103,13 @@ export class PacketOperationContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async UploadImage(img: PacketMsgPicElement) {
|
async UploadImage(img: PacketMsgPicElement) {
|
||||||
await this.context.highway.uploadImage({
|
await this.context.highway.uploadImage(
|
||||||
chatType: ChatType.KCHATTYPEC2C,
|
{
|
||||||
peerUid: this.context.napcore.basicInfo.uid
|
chatType: ChatType.KCHATTYPEC2C,
|
||||||
}, img);
|
peerUid: this.context.napcore.basicInfo.uid,
|
||||||
|
},
|
||||||
|
img
|
||||||
|
);
|
||||||
const index = img.msgInfo?.msgInfoBody?.at(0)?.index;
|
const index = img.msgInfo?.msgInfoBody?.at(0)?.index;
|
||||||
if (!index) {
|
if (!index) {
|
||||||
throw new Error('img.msgInfo?.msgInfoBody![0].index! is undefined');
|
throw new Error('img.msgInfo?.msgInfoBody![0].index! is undefined');
|
||||||
@@ -137,24 +143,66 @@ export class PacketOperationContext {
|
|||||||
coordinates: item.polygon.coordinates.map((c) => {
|
coordinates: item.polygon.coordinates.map((c) => {
|
||||||
return {
|
return {
|
||||||
x: c.x,
|
x: c.x,
|
||||||
y: c.y
|
y: c.y,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
language: res.ocrRspBody.language
|
language: res.ocrRspBody.language,
|
||||||
} as ImageOcrResult;
|
} as ImageOcrResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
async UploadForwardMsg(msg: PacketMsg[], groupUin: number = 0) {
|
private async SendPreprocess(msg: PacketMsg[], groupUin: number = 0) {
|
||||||
|
const ps = msg.map((m) => {
|
||||||
|
return m.msg.map(async(e) => {
|
||||||
|
if (e instanceof PacketMsgReplyElement && !e.targetElems) {
|
||||||
|
this.context.logger.debug(`Cannot find reply element's targetElems, prepare to fetch it...`);
|
||||||
|
if (!e.targetPeer?.peerUid) {
|
||||||
|
this.context.logger.error(`targetPeer is undefined!`);
|
||||||
|
}
|
||||||
|
let targetMsg: NapProtoEncodeStructType<typeof PushMsgBody>[] | undefined;
|
||||||
|
if (e.isGroupReply) {
|
||||||
|
targetMsg = await this.FetchGroupMessage(+(e.targetPeer?.peerUid ?? 0), e.targetMessageSeq, e.targetMessageSeq);
|
||||||
|
} else {
|
||||||
|
targetMsg = await this.FetchC2CMessage(await this.context.napcore.basicInfo.uin2uid(e.targetUin), e.targetMessageSeq, e.targetMessageSeq);
|
||||||
|
}
|
||||||
|
e.targetElems = targetMsg.at(0)?.body?.richText?.elems;
|
||||||
|
e.targetSourceMsg = targetMsg.at(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).flat();
|
||||||
|
await Promise.all(ps)
|
||||||
await this.UploadResources(msg, groupUin);
|
await this.UploadResources(msg, groupUin);
|
||||||
|
}
|
||||||
|
|
||||||
|
async FetchGroupMessage(groupUin: number, startSeq: number, endSeq: number): Promise<NapProtoDecodeStructType<typeof PushMsgBody>[]> {
|
||||||
|
const req = trans.FetchGroupMessage.build(groupUin, startSeq, endSeq);
|
||||||
|
const resp = await this.context.client.sendOidbPacket(req, true);
|
||||||
|
const res = trans.FetchGroupMessage.parse(resp);
|
||||||
|
return res.body.messages
|
||||||
|
}
|
||||||
|
|
||||||
|
async FetchC2CMessage(targetUid: string, startSeq: number, endSeq: number): Promise<NapProtoDecodeStructType<typeof PushMsgBody>[]> {
|
||||||
|
const req = trans.FetchC2CMessage.build(targetUid, startSeq, endSeq);
|
||||||
|
const resp = await this.context.client.sendOidbPacket(req, true);
|
||||||
|
const res = trans.FetchC2CMessage.parse(resp);
|
||||||
|
return res.messages
|
||||||
|
}
|
||||||
|
|
||||||
|
async UploadForwardMsg(msg: PacketMsg[], groupUin: number = 0) {
|
||||||
|
await this.SendPreprocess(msg, groupUin);
|
||||||
const req = trans.UploadForwardMsg.build(this.context.napcore.basicInfo.uid, msg, groupUin);
|
const req = trans.UploadForwardMsg.build(this.context.napcore.basicInfo.uid, msg, groupUin);
|
||||||
const resp = await this.context.client.sendOidbPacket(req, true);
|
const resp = await this.context.client.sendOidbPacket(req, true);
|
||||||
const res = trans.UploadForwardMsg.parse(resp);
|
const res = trans.UploadForwardMsg.parse(resp);
|
||||||
return res.result.resId;
|
return res.result.resId;
|
||||||
}
|
}
|
||||||
|
|
||||||
async MoveGroupFile(groupUin: number, fileUUID: string, currentParentDirectory: string, targetParentDirectory: string) {
|
async MoveGroupFile(
|
||||||
|
groupUin: number,
|
||||||
|
fileUUID: string,
|
||||||
|
currentParentDirectory: string,
|
||||||
|
targetParentDirectory: string
|
||||||
|
) {
|
||||||
const req = trans.MoveGroupFile.build(groupUin, fileUUID, currentParentDirectory, targetParentDirectory);
|
const req = trans.MoveGroupFile.build(groupUin, fileUUID, currentParentDirectory, targetParentDirectory);
|
||||||
const resp = await this.context.client.sendOidbPacket(req, true);
|
const resp = await this.context.client.sendOidbPacket(req, true);
|
||||||
const res = trans.MoveGroupFile.parse(resp);
|
const res = trans.MoveGroupFile.parse(resp);
|
||||||
@@ -203,12 +251,17 @@ export class PacketOperationContext {
|
|||||||
return res.content.map((item) => {
|
return res.content.map((item) => {
|
||||||
return {
|
return {
|
||||||
category: item.category,
|
category: item.category,
|
||||||
voices: item.voices
|
voices: item.voices,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetAiVoice(groupUin: number, voiceId: string, text: string, chatType: AIVoiceChatType): Promise<NapProtoDecodeStructType<typeof MsgInfo>> {
|
async GetAiVoice(
|
||||||
|
groupUin: number,
|
||||||
|
voiceId: string,
|
||||||
|
text: string,
|
||||||
|
chatType: AIVoiceChatType
|
||||||
|
): Promise<NapProtoDecodeStructType<typeof MsgInfo>> {
|
||||||
let reqTime = 0;
|
let reqTime = 0;
|
||||||
const reqMaxTime = 30;
|
const reqMaxTime = 30;
|
||||||
const sessionId = crypto.randomBytes(4).readUInt32BE(0);
|
const sessionId = crypto.randomBytes(4).readUInt32BE(0);
|
||||||
@@ -236,6 +289,7 @@ export class PacketOperationContext {
|
|||||||
if (!main?.actionData.msgBody) {
|
if (!main?.actionData.msgBody) {
|
||||||
throw new Error('msgBody is empty');
|
throw new Error('msgBody is empty');
|
||||||
}
|
}
|
||||||
|
this.context.logger.debug('rawChains ', inflate.toString('hex'));
|
||||||
|
|
||||||
const messagesPromises = main.actionData.msgBody.map(async (msg) => {
|
const messagesPromises = main.actionData.msgBody.map(async (msg) => {
|
||||||
if (!msg?.body?.richText?.elems) {
|
if (!msg?.body?.richText?.elems) {
|
||||||
@@ -251,12 +305,12 @@ export class PacketOperationContext {
|
|||||||
const groupUin = msg?.responseHead.grp?.groupUin ?? 0;
|
const groupUin = msg?.responseHead.grp?.groupUin ?? 0;
|
||||||
element.picElement = {
|
element.picElement = {
|
||||||
...element.picElement,
|
...element.picElement,
|
||||||
originImageUrl: await this.GetGroupImageUrl(groupUin, index!)
|
originImageUrl: await this.GetGroupImageUrl(groupUin, index!),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
element.picElement = {
|
element.picElement = {
|
||||||
...element.picElement,
|
...element.picElement,
|
||||||
originImageUrl: await this.GetImageUrl(this.context.napcore.basicInfo.uid, index!)
|
originImageUrl: await this.GetImageUrl(this.context.napcore.basicInfo.uid, index!),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return element;
|
return element;
|
||||||
@@ -269,7 +323,7 @@ export class PacketOperationContext {
|
|||||||
elements: elements,
|
elements: elements,
|
||||||
guildId: '',
|
guildId: '',
|
||||||
isOnlineMsg: false,
|
isOnlineMsg: false,
|
||||||
msgId: '7467703692092974645', // TODO: no necessary
|
msgId: '7467703692092974645', // TODO: no necessary
|
||||||
msgRandom: '0',
|
msgRandom: '0',
|
||||||
msgSeq: String(msg.contentHead.sequence ?? 0),
|
msgSeq: String(msg.contentHead.sequence ?? 0),
|
||||||
msgTime: String(msg.contentHead.timeStamp ?? 0),
|
msgTime: String(msg.contentHead.timeStamp ?? 0),
|
||||||
|
@@ -24,12 +24,15 @@ export class PacketMsgBuilder {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
responseHead: {
|
responseHead: {
|
||||||
fromUid: '',
|
|
||||||
fromUin: node.senderUin,
|
fromUin: node.senderUin,
|
||||||
toUid: node.groupId ? undefined : selfUid,
|
type: 0,
|
||||||
|
sigMap: 0,
|
||||||
|
toUin: 0,
|
||||||
|
fromUid: '',
|
||||||
forward: node.groupId ? undefined : {
|
forward: node.groupId ? undefined : {
|
||||||
friendName: node.senderName,
|
friendName: node.senderName,
|
||||||
},
|
},
|
||||||
|
toUid: node.groupId ? undefined : selfUid,
|
||||||
grp: node.groupId ? {
|
grp: node.groupId ? {
|
||||||
groupUin: node.groupId,
|
groupUin: node.groupId,
|
||||||
memberName: node.senderName,
|
memberName: node.senderName,
|
||||||
@@ -40,16 +43,13 @@ export class PacketMsgBuilder {
|
|||||||
type: node.groupId ? 82 : 9,
|
type: node.groupId ? 82 : 9,
|
||||||
subType: node.groupId ? undefined : 4,
|
subType: node.groupId ? undefined : 4,
|
||||||
divSeq: node.groupId ? undefined : 4,
|
divSeq: node.groupId ? undefined : 4,
|
||||||
msgId: crypto.randomBytes(4).readUInt32LE(0),
|
autoReply: 0,
|
||||||
sequence: crypto.randomBytes(4).readUInt32LE(0),
|
sequence: crypto.randomBytes(4).readUInt32LE(0),
|
||||||
timeStamp: +node.time.toString().substring(0, 10),
|
timeStamp: +node.time.toString().substring(0, 10),
|
||||||
field7: BigInt(1),
|
|
||||||
field8: 0,
|
|
||||||
field9: 0,
|
|
||||||
forward: {
|
forward: {
|
||||||
field1: 0,
|
field1: 0,
|
||||||
field2: 0,
|
field2: 0,
|
||||||
field3: node.groupId ? 0 : 2,
|
field3: node.groupId ? 1 : 2,
|
||||||
unknownBase64: avatar,
|
unknownBase64: avatar,
|
||||||
avatar: avatar
|
avatar: avatar
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,7 @@ import {
|
|||||||
MsgInfo,
|
MsgInfo,
|
||||||
NotOnlineImage,
|
NotOnlineImage,
|
||||||
OidbSvcTrpcTcp0XE37_800Response,
|
OidbSvcTrpcTcp0XE37_800Response,
|
||||||
|
PushMsgBody,
|
||||||
QBigFaceExtra,
|
QBigFaceExtra,
|
||||||
QSmallFaceExtra,
|
QSmallFaceExtra,
|
||||||
} from '@/core/packet/transformer/proto';
|
} from '@/core/packet/transformer/proto';
|
||||||
@@ -29,7 +30,8 @@ import {
|
|||||||
SendReplyElement,
|
SendReplyElement,
|
||||||
SendMultiForwardMsgElement,
|
SendMultiForwardMsgElement,
|
||||||
SendTextElement,
|
SendTextElement,
|
||||||
SendVideoElement
|
SendVideoElement,
|
||||||
|
Peer
|
||||||
} from '@/core';
|
} from '@/core';
|
||||||
import {ForwardMsgBuilder} from '@/common/forward-msg-builder';
|
import {ForwardMsgBuilder} from '@/common/forward-msg-builder';
|
||||||
import {PacketMsg, PacketSendMsgElement} from '@/core/packet/message/message';
|
import {PacketMsg, PacketSendMsgElement} from '@/core/packet/message/message';
|
||||||
@@ -146,41 +148,40 @@ export class PacketMsgAtElement extends PacketMsgTextElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PacketMsgReplyElement extends IPacketMsgElement<SendReplyElement> {
|
export class PacketMsgReplyElement extends IPacketMsgElement<SendReplyElement> {
|
||||||
messageId: bigint;
|
time: number;
|
||||||
messageSeq: number;
|
targetMessageId: bigint;
|
||||||
messageClientSeq: number;
|
targetMessageSeq: number;
|
||||||
|
targetMessageClientSeq: number;
|
||||||
targetUin: number;
|
targetUin: number;
|
||||||
targetUid: string;
|
targetUid: string;
|
||||||
time: number;
|
targetElems?: NapProtoEncodeStructType<typeof Elem>[];
|
||||||
elems: PacketMsg[];
|
targetSourceMsg?: NapProtoEncodeStructType<typeof PushMsgBody>;
|
||||||
|
targetPeer?: Peer;
|
||||||
|
|
||||||
constructor(element: SendReplyElement) {
|
constructor(element: SendReplyElement) {
|
||||||
super(element);
|
super(element);
|
||||||
this.messageId = BigInt(element.replyElement.replayMsgId ?? 0);
|
this.time = +(element.replyElement.replyMsgTime ?? Math.floor(Date.now() / 1000));
|
||||||
this.messageSeq = +(element.replyElement.replayMsgSeq ?? 0);
|
this.targetMessageId = BigInt(element.replyElement.replayMsgId ?? 0);
|
||||||
this.messageClientSeq = +(element.replyElement.replyMsgClientSeq ?? 0);
|
this.targetMessageSeq = +(element.replyElement.replayMsgSeq ?? 0);
|
||||||
|
this.targetMessageClientSeq = +(element.replyElement.replyMsgClientSeq ?? 0);
|
||||||
this.targetUin = +(element.replyElement.senderUin ?? 0);
|
this.targetUin = +(element.replyElement.senderUin ?? 0);
|
||||||
this.targetUid = element.replyElement.senderUidStr ?? '';
|
this.targetUid = element.replyElement.senderUidStr ?? '';
|
||||||
this.time = +(element.replyElement.replyMsgTime ?? 0);
|
this.targetPeer = element.replyElement._replyMsgPeer;
|
||||||
this.elems = []; // TODO: in replyElement.sourceMsgTextElems
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get isGroupReply(): boolean {
|
get isGroupReply(): boolean {
|
||||||
return this.messageClientSeq === 0;
|
return this.targetMessageClientSeq === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
override buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
override buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
||||||
return [{
|
return [{
|
||||||
srcMsg: {
|
srcMsg: {
|
||||||
origSeqs: [this.isGroupReply ? this.messageClientSeq : this.messageSeq],
|
origSeqs: [this.isGroupReply ? this.targetMessageSeq : this.targetMessageClientSeq],
|
||||||
senderUin: BigInt(this.targetUin),
|
senderUin: BigInt(this.targetUin),
|
||||||
time: this.time,
|
time: this.time,
|
||||||
elems: [], // TODO: in replyElement.sourceMsgTextElems
|
elems: this.targetElems ?? [],
|
||||||
pbReserve: {
|
sourceMsg: new NapProtoMsg(PushMsgBody).encode(this.targetSourceMsg ?? {}),
|
||||||
messageId: this.messageId,
|
toUin: BigInt(0),
|
||||||
},
|
|
||||||
toUin: BigInt(this.targetUin),
|
|
||||||
type: 1,
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
27
src/core/packet/transformer/message/FetchC2CMessage.ts
Normal file
27
src/core/packet/transformer/message/FetchC2CMessage.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
|
import { OidbPacket, PacketHexStrBuilder, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
|
|
||||||
|
class FetchC2CMessage extends PacketTransformer<typeof proto.SsoGetC2cMsgResponse> {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
build(targetUid: string, startSeq: number, endSeq: number): OidbPacket {
|
||||||
|
const req = new NapProtoMsg(proto.SsoGetC2cMsg).encode({
|
||||||
|
friendUid: targetUid,
|
||||||
|
startSequence: startSeq,
|
||||||
|
endSequence: endSeq,
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
cmd: 'trpc.msg.register_proxy.RegisterProxy.SsoGetC2cMsg',
|
||||||
|
data: PacketHexStrBuilder(req)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
parse(data: Buffer) {
|
||||||
|
return new NapProtoMsg(proto.SsoGetC2cMsgResponse).decode(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new FetchC2CMessage();
|
30
src/core/packet/transformer/message/FetchGroupMessage.ts
Normal file
30
src/core/packet/transformer/message/FetchGroupMessage.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import * as proto from '@/core/packet/transformer/proto';
|
||||||
|
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
||||||
|
import { OidbPacket, PacketHexStrBuilder, PacketTransformer } from '@/core/packet/transformer/base';
|
||||||
|
|
||||||
|
class FetchGroupMessage extends PacketTransformer<typeof proto.SsoGetGroupMsgResponse> {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
build(groupUin: number, startSeq: number, endSeq: number): OidbPacket {
|
||||||
|
const req = new NapProtoMsg(proto.SsoGetGroupMsg).encode({
|
||||||
|
info: {
|
||||||
|
groupUin: groupUin,
|
||||||
|
startSequence: startSeq,
|
||||||
|
endSequence: endSeq
|
||||||
|
},
|
||||||
|
direction: true
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
cmd: 'trpc.msg.register_proxy.RegisterProxy.SsoGetGroupMsg',
|
||||||
|
data: PacketHexStrBuilder(req)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
parse(data: Buffer) {
|
||||||
|
return new NapProtoMsg(proto.SsoGetGroupMsgResponse).decode(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new FetchGroupMessage();
|
@@ -1,2 +1,4 @@
|
|||||||
export { default as UploadForwardMsg } from './UploadForwardMsg';
|
export { default as UploadForwardMsg } from './UploadForwardMsg';
|
||||||
|
export { default as FetchGroupMessage } from './FetchGroupMessage';
|
||||||
|
export { default as FetchC2CMessage } from './FetchC2CMessage';
|
||||||
export { default as DownloadForwardMsg } from './DownloadForwardMsg';
|
export { default as DownloadForwardMsg } from './DownloadForwardMsg';
|
@@ -13,13 +13,15 @@ import {
|
|||||||
export const ContentHead = {
|
export const ContentHead = {
|
||||||
type: ProtoField(1, ScalarType.UINT32),
|
type: ProtoField(1, ScalarType.UINT32),
|
||||||
subType: ProtoField(2, ScalarType.UINT32, true),
|
subType: ProtoField(2, ScalarType.UINT32, true),
|
||||||
divSeq: ProtoField(3, ScalarType.UINT32, true),
|
c2cCmd: ProtoField(3, ScalarType.UINT32, true),
|
||||||
msgId: ProtoField(4, ScalarType.UINT32, true),
|
ranDom: ProtoField(4, ScalarType.UINT32, true),
|
||||||
sequence: ProtoField(5, ScalarType.UINT32, true),
|
sequence: ProtoField(5, ScalarType.UINT32, true),
|
||||||
timeStamp: ProtoField(6, ScalarType.UINT32, true),
|
timeStamp: ProtoField(6, ScalarType.UINT32, true),
|
||||||
field7: ProtoField(7, ScalarType.UINT64, true),
|
pkgNum: ProtoField(7, ScalarType.UINT64, true),
|
||||||
field8: ProtoField(8, ScalarType.UINT32, true),
|
pkgIndex: ProtoField(8, ScalarType.UINT32, true),
|
||||||
field9: ProtoField(9, ScalarType.UINT32, true),
|
divSeq: ProtoField(9, ScalarType.UINT32, true),
|
||||||
|
autoReply: ProtoField(10, ScalarType.UINT32),
|
||||||
|
ntMsgSeq: ProtoField(10, ScalarType.UINT32, true),
|
||||||
newId: ProtoField(12, ScalarType.UINT64, true),
|
newId: ProtoField(12, ScalarType.UINT64, true),
|
||||||
forward: ProtoField(15, () => ForwardHead, true),
|
forward: ProtoField(15, () => ForwardHead, true),
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,15 @@
|
|||||||
import { ElementType, MessageElement, NTGrayTipElementSubTypeV2, PicSubType, PicType, TipAioOpGrayTipElement, TipGroupElement, NTVideoType, FaceType } from './msg';
|
import {
|
||||||
|
ElementType,
|
||||||
|
MessageElement,
|
||||||
|
NTGrayTipElementSubTypeV2,
|
||||||
|
PicSubType,
|
||||||
|
PicType,
|
||||||
|
TipAioOpGrayTipElement,
|
||||||
|
TipGroupElement,
|
||||||
|
NTVideoType,
|
||||||
|
FaceType,
|
||||||
|
Peer
|
||||||
|
} from './msg';
|
||||||
|
|
||||||
type ElementFullBase = Omit<MessageElement, 'elementType' | 'elementId' | 'extBufForUI'>;
|
type ElementFullBase = Omit<MessageElement, 'elementType' | 'elementId' | 'extBufForUI'>;
|
||||||
|
|
||||||
@@ -213,6 +224,9 @@ export interface ReplyElement {
|
|||||||
senderUidStr?: string;
|
senderUidStr?: string;
|
||||||
replyMsgTime?: string;
|
replyMsgTime?: string;
|
||||||
replyMsgClientSeq?: string;
|
replyMsgClientSeq?: string;
|
||||||
|
// HACK: Attributes that were not originally available,
|
||||||
|
// but were added due to NTQQ and NapCat's internal implementation, are used to supplement NapCat
|
||||||
|
_replyMsgPeer?: Peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CalendarElement {
|
export interface CalendarElement {
|
||||||
|
@@ -501,6 +501,7 @@ export interface RawMessage {
|
|||||||
elements: MessageElement[];// 消息元素
|
elements: MessageElement[];// 消息元素
|
||||||
sourceType: MsgSourceType;// 消息来源类型
|
sourceType: MsgSourceType;// 消息来源类型
|
||||||
isOnlineMsg: boolean;// 是否为在线消息
|
isOnlineMsg: boolean;// 是否为在线消息
|
||||||
|
clientSeq?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -467,6 +467,8 @@ export class OneBotMsgApi {
|
|||||||
replayMsgId: replyMsg.msgId, // raw.msgId
|
replayMsgId: replyMsg.msgId, // raw.msgId
|
||||||
senderUin: replyMsg.senderUin,
|
senderUin: replyMsg.senderUin,
|
||||||
senderUinStr: replyMsg.senderUin,
|
senderUinStr: replyMsg.senderUin,
|
||||||
|
replyMsgClientSeq: replyMsg.clientSeq,
|
||||||
|
_replyMsgPeer: replyMsgM.Peer
|
||||||
},
|
},
|
||||||
} :
|
} :
|
||||||
undefined;
|
undefined;
|
||||||
|
Reference in New Issue
Block a user