mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat & fix: revert assert import & support MFace
element
This commit is contained in:
parent
698e095364
commit
dfdca11155
@ -1,4 +1,4 @@
|
|||||||
import * as assert from "node:assert";
|
import assert from "node:assert";
|
||||||
|
|
||||||
export class Frame{
|
export class Frame{
|
||||||
static pack(head: Buffer, body: Buffer): Buffer {
|
static pack(head: Buffer, body: Buffer): Buffer {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as assert from "node:assert";
|
import assert from "node:assert";
|
||||||
import * as zlib from "node:zlib";
|
import * as zlib from "node:zlib";
|
||||||
import * as crypto from "node:crypto";
|
import * as crypto from "node:crypto";
|
||||||
import {NapProtoEncodeStructType, NapProtoMsg} from "@/core/packet/proto/NapProto";
|
import {NapProtoEncodeStructType, NapProtoMsg} from "@/core/packet/proto/NapProto";
|
||||||
@ -18,6 +18,7 @@ import {
|
|||||||
SendFaceElement,
|
SendFaceElement,
|
||||||
SendFileElement,
|
SendFileElement,
|
||||||
SendMarkdownElement,
|
SendMarkdownElement,
|
||||||
|
SendMarketFaceElement,
|
||||||
SendMessageElement,
|
SendMessageElement,
|
||||||
SendPicElement,
|
SendPicElement,
|
||||||
SendPttElement,
|
SendPttElement,
|
||||||
@ -246,6 +247,44 @@ export class PacketMsgFaceElement extends IPacketMsgElement<SendFaceElement> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class PacketMarkFaceElement extends IPacketMsgElement<SendMarketFaceElement> {
|
||||||
|
emojiName: string;
|
||||||
|
emojiId: string;
|
||||||
|
emojiPackageId: number;
|
||||||
|
emojiKey: string;
|
||||||
|
|
||||||
|
constructor(element: SendMarketFaceElement) {
|
||||||
|
super(element);
|
||||||
|
this.emojiName = element.marketFaceElement.faceName;
|
||||||
|
this.emojiId = element.marketFaceElement.emojiId;
|
||||||
|
this.emojiPackageId = element.marketFaceElement.emojiPackageId;
|
||||||
|
this.emojiKey = element.marketFaceElement.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
buildElement(): NapProtoEncodeStructType<typeof Elem>[] {
|
||||||
|
return [{
|
||||||
|
marketFace: {
|
||||||
|
faceName: this.emojiName,
|
||||||
|
itemType: 6,
|
||||||
|
faceInfo: 1,
|
||||||
|
faceId: Buffer.from(this.emojiId, 'hex'),
|
||||||
|
tabId: this.emojiPackageId,
|
||||||
|
subType: 3,
|
||||||
|
key: this.emojiKey,
|
||||||
|
imageWidth: 300,
|
||||||
|
imageHeight: 300,
|
||||||
|
pbReserve: {
|
||||||
|
field8: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
toPreview(): string {
|
||||||
|
return this.emojiName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class PacketMsgVideoElement extends IPacketMsgElement<SendVideoElement> {
|
export class PacketMsgVideoElement extends IPacketMsgElement<SendVideoElement> {
|
||||||
constructor(element: SendVideoElement) {
|
constructor(element: SendVideoElement) {
|
||||||
super(element);
|
super(element);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ScalarType } from "@protobuf-ts/runtime";
|
import {ScalarType} from "@protobuf-ts/runtime";
|
||||||
import { ProtoField } from "../NapProto";
|
import {ProtoField} from "../NapProto";
|
||||||
|
|
||||||
export const Elem = {
|
export const Elem = {
|
||||||
text: ProtoField(1, () => Text, true),
|
text: ProtoField(1, () => Text, true),
|
||||||
@ -101,21 +101,25 @@ export const TransElem = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const MarketFace = {
|
export const MarketFace = {
|
||||||
faceName: ProtoField(1, ScalarType.BYTES),
|
faceName: ProtoField(1, ScalarType.STRING),
|
||||||
itemType: ProtoField(2, ScalarType.INT32),
|
itemType: ProtoField(2, ScalarType.INT32),
|
||||||
faceInfo: ProtoField(3, ScalarType.INT32),
|
faceInfo: ProtoField(3, ScalarType.INT32),
|
||||||
faceId: ProtoField(4, ScalarType.BYTES),
|
faceId: ProtoField(4, ScalarType.BYTES),
|
||||||
tabId: ProtoField(5, ScalarType.INT32),
|
tabId: ProtoField(5, ScalarType.INT32),
|
||||||
subType: ProtoField(6, ScalarType.INT32),
|
subType: ProtoField(6, ScalarType.INT32),
|
||||||
key: ProtoField(7, ScalarType.BYTES),
|
key: ProtoField(7, ScalarType.STRING),
|
||||||
param: ProtoField(8, ScalarType.BYTES),
|
param: ProtoField(8, ScalarType.BYTES),
|
||||||
mediaType: ProtoField(9, ScalarType.INT32),
|
mediaType: ProtoField(9, ScalarType.INT32),
|
||||||
imageWidth: ProtoField(10, ScalarType.INT32),
|
imageWidth: ProtoField(10, ScalarType.INT32),
|
||||||
imageHeight: ProtoField(11, ScalarType.INT32),
|
imageHeight: ProtoField(11, ScalarType.INT32),
|
||||||
mobileparam: ProtoField(12, ScalarType.BYTES),
|
mobileparam: ProtoField(12, ScalarType.BYTES),
|
||||||
pbReserve: ProtoField(13, ScalarType.BYTES),
|
pbReserve: ProtoField(13, () => MarketFacePbRes),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const MarketFacePbRes = {
|
||||||
|
field8: ProtoField(8, ScalarType.INT32)
|
||||||
|
}
|
||||||
|
|
||||||
export const CustomFace = {
|
export const CustomFace = {
|
||||||
guid: ProtoField(1, ScalarType.BYTES),
|
guid: ProtoField(1, ScalarType.BYTES),
|
||||||
filePath: ProtoField(2, ScalarType.STRING),
|
filePath: ProtoField(2, ScalarType.STRING),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user