feat: adjust packetElement & packetMsg

This commit is contained in:
pk5ls20 2024-10-18 16:57:55 +08:00
parent dfdca11155
commit 10c404d455
No known key found for this signature in database
GPG Key ID: 6370ED7A169F493A
2 changed files with 8 additions and 5 deletions

View File

@ -19,7 +19,6 @@ import {
SendFileElement,
SendMarkdownElement,
SendMarketFaceElement,
SendMessageElement,
SendPicElement,
SendPttElement,
SendReplyElement,
@ -28,13 +27,13 @@ import {
SendVideoElement
} from "@/core";
import {MsgInfo} from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
import {PacketMsg} from "@/core/packet/msg/message";
import {PacketMsg, PacketSendMsgElement} from "@/core/packet/msg/message";
// raw <-> packet
// TODO: check ob11 -> raw impl!
// TODO: parse to raw element
// TODO: SendStructLongMsgElement
export abstract class IPacketMsgElement<T extends SendMessageElement | SendStructLongMsgElement> {
export abstract class IPacketMsgElement<T extends PacketSendMsgElement> {
protected constructor(rawElement: T) {
}
@ -149,6 +148,7 @@ export class PacketMsgReplyElement extends IPacketMsgElement<SendReplyElement> {
targetUin: number;
targetUid: string;
time: number;
elems: PacketMsg[];
constructor(element: SendReplyElement) {
super(element);
@ -158,6 +158,7 @@ export class PacketMsgReplyElement extends IPacketMsgElement<SendReplyElement> {
this.targetUin = Number(element.replyElement.senderUin ?? 0);
this.targetUid = element.replyElement.senderUidStr ?? '';
this.time = Number(element.replyElement.replyMsgTime ?? 0);
this.elems = []; // TODO: in replyElement.sourceMsgTextElems
}
get isGroupReply(): boolean {

View File

@ -1,5 +1,7 @@
import {IPacketMsgElement} from "@/core/packet/msg/element";
import {SendMessageElement} from "@/core";
import {SendMessageElement, SendStructLongMsgElement} from "@/core";
export type PacketSendMsgElement = SendMessageElement | SendStructLongMsgElement
export interface PacketMsg {
seq?: number;
@ -9,5 +11,5 @@ export interface PacketMsg {
senderUin: number;
senderName: string;
time: number;
msg: IPacketMsgElement<SendMessageElement>[]
msg: IPacketMsgElement<PacketSendMsgElement>[]
}