mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
feat: maybe more stable fake forwardMsg
This commit is contained in:
@@ -99,7 +99,7 @@ export class ForwardMsgBuilder {
|
|||||||
senderName: msg.senderName,
|
senderName: msg.senderName,
|
||||||
isGroupMsg: msg.groupId !== undefined,
|
isGroupMsg: msg.groupId !== undefined,
|
||||||
msg: msg.msg.map(m => ({
|
msg: msg.msg.map(m => ({
|
||||||
preview: m.toPreview(),
|
preview: m.valid? m.toPreview() : "[该消息类型暂不支持查看]",
|
||||||
}))
|
}))
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
@@ -36,6 +36,10 @@ export abstract class IPacketMsgElement<T extends PacketSendMsgElement> {
|
|||||||
protected constructor(rawElement: T) {
|
protected constructor(rawElement: T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get valid(): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
buildContent(): Uint8Array | undefined {
|
buildContent(): Uint8Array | undefined {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -265,6 +269,10 @@ export class PacketMsgPicElement extends IPacketMsgElement<SendPicElement> {
|
|||||||
this.picType = element.picElement.picType;
|
this.picType = element.picElement.picType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get valid(): boolean {
|
||||||
|
return !!this.msgInfo;
|
||||||
|
}
|
||||||
|
|
||||||
buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
||||||
if (!this.msgInfo) return [];
|
if (!this.msgInfo) return [];
|
||||||
return [{
|
return [{
|
||||||
@@ -306,6 +314,10 @@ export class PacketMsgVideoElement extends IPacketMsgElement<SendVideoElement> {
|
|||||||
this.thumbHeight = element.videoElement.thumbHeight;
|
this.thumbHeight = element.videoElement.thumbHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get valid(): boolean {
|
||||||
|
return !!this.msgInfo;
|
||||||
|
}
|
||||||
|
|
||||||
buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
||||||
if (!this.msgInfo) return [];
|
if (!this.msgInfo) return [];
|
||||||
return [{
|
return [{
|
||||||
@@ -338,15 +350,20 @@ export class PacketMsgPttElement extends IPacketMsgElement<SendPttElement> {
|
|||||||
this.fileDuration = Math.round(element.pttElement.duration); // TODO: cc
|
this.fileDuration = Math.round(element.pttElement.duration); // TODO: cc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get valid(): boolean {
|
||||||
|
return !!this.msgInfo;
|
||||||
|
}
|
||||||
|
|
||||||
buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
||||||
if (!this.msgInfo) return [];
|
return []
|
||||||
return [{
|
// if (!this.msgInfo) return [];
|
||||||
commonElem: {
|
// return [{
|
||||||
serviceType: 48,
|
// commonElem: {
|
||||||
pbElem: new NapProtoMsg(MsgInfo).encode(this.msgInfo),
|
// serviceType: 48,
|
||||||
businessType: 22,
|
// pbElem: new NapProtoMsg(MsgInfo).encode(this.msgInfo),
|
||||||
}
|
// businessType: 22,
|
||||||
}];
|
// }
|
||||||
|
// }];
|
||||||
}
|
}
|
||||||
|
|
||||||
toPreview(): string {
|
toPreview(): string {
|
||||||
@@ -374,6 +391,10 @@ export class PacketMsgFileElement extends IPacketMsgElement<SendFileElement> {
|
|||||||
this.fileSize = +element.fileElement.fileSize;
|
this.fileSize = +element.fileElement.fileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get valid(): boolean {
|
||||||
|
return this.isGroupFile || Boolean(this._e37_800_rsp);
|
||||||
|
}
|
||||||
|
|
||||||
buildContent(): Uint8Array | undefined {
|
buildContent(): Uint8Array | undefined {
|
||||||
if (this.isGroupFile || !this._e37_800_rsp) return undefined;
|
if (this.isGroupFile || !this._e37_800_rsp) return undefined;
|
||||||
return new NapProtoMsg(FileExtra).encode({
|
return new NapProtoMsg(FileExtra).encode({
|
||||||
|
Reference in New Issue
Block a user