This commit is contained in:
手瓜一十雪 2024-09-11 20:01:36 +08:00
commit c4f73d0eb8
11 changed files with 144 additions and 885 deletions

View File

@ -57,6 +57,7 @@
"image-size": "^1.1.1",
"json-schema-to-ts": "^3.1.0",
"log4js": "^6.9.1",
"protobufjs": "~7.4.0",
"qrcode-terminal": "^0.12.0",
"silk-wasm": "^3.6.1",
"strtok3": "8.0.1",

View File

@ -0,0 +1,18 @@
syntax = "proto3";
package SysMessage;
message likeDetail {
string txt = 1;
int64 uin = 3;
string nickname = 5;
}
message likeMsg {
int32 times = 1;
int32 time = 2;
likeDetail detail = 3;
}
message profileLikeTip {
likeMsg msg = 14;
}

View File

@ -1,341 +0,0 @@
// @generated by protobuf-ts 2.9.4
// @generated from protobuf file "EmojiLikeToOthers.proto" (package "SysMessage", syntax proto3)
// tslint:disable
import type {
BinaryReadOptions,
BinaryWriteOptions,
IBinaryReader,
IBinaryWriter,
PartialMessage,
} from '@protobuf-ts/runtime';
import { MessageType, reflectionMergePartial, UnknownFieldHandler, WireType } from '@protobuf-ts/runtime';
/**
* @generated from protobuf message SysMessage.EmojiLikeToOthersWrapper1
*/
export interface EmojiLikeToOthersWrapper1 {
/**
* @generated from protobuf field: SysMessage.EmojiLikeToOthersWrapper2 wrapper = 1;
*/
wrapper?: EmojiLikeToOthersWrapper2;
}
/**
* @generated from protobuf message SysMessage.EmojiLikeToOthersWrapper2
*/
export interface EmojiLikeToOthersWrapper2 {
/**
* @generated from protobuf field: SysMessage.EmojiLikeToOthersWrapper3 body = 1;
*/
body?: EmojiLikeToOthersWrapper3;
}
/**
* @generated from protobuf message SysMessage.EmojiLikeToOthersWrapper3
*/
export interface EmojiLikeToOthersWrapper3 {
/**
* @generated from protobuf field: SysMessage.EmojiLikeToOthersMsgSpec msgSpec = 2;
*/
msgSpec?: EmojiLikeToOthersMsgSpec;
/**
* @generated from protobuf field: SysMessage.EmojiLikeToOthersAttributes attributes = 3;
*/
attributes?: EmojiLikeToOthersAttributes;
}
/**
* @generated from protobuf message SysMessage.EmojiLikeToOthersMsgSpec
*/
export interface EmojiLikeToOthersMsgSpec {
/**
* @generated from protobuf field: uint32 msgSeq = 1;
*/
msgSeq: number;
}
/**
* @generated from protobuf message SysMessage.EmojiLikeToOthersAttributes
*/
export interface EmojiLikeToOthersAttributes {
/**
* @generated from protobuf field: string emojiId = 1;
*/
emojiId: string;
/**
* @generated from protobuf field: string senderUid = 4;
*/
senderUid: string;
/**
* @generated from protobuf field: SysMessage.EmojiLikeToOthersAttributes.Operation operation = 5;
*/
operation: EmojiLikeToOthersAttributes_Operation;
}
/**
* @generated from protobuf enum SysMessage.EmojiLikeToOthersAttributes.Operation
*/
export enum EmojiLikeToOthersAttributes_Operation {
/**
* @generated from protobuf enum value: FALLBACK = 0;
*/
FALLBACK = 0,
/**
* @generated from protobuf enum value: LIKE = 1;
*/
LIKE = 1,
/**
* @generated from protobuf enum value: UNLIKE = 2;
*/
UNLIKE = 2
}
// @generated message type with reflection information, may provide speed optimized methods
class EmojiLikeToOthersWrapper1$Type extends MessageType<EmojiLikeToOthersWrapper1> {
constructor() {
super("SysMessage.EmojiLikeToOthersWrapper1", [
{ no: 1, name: "wrapper", kind: "message", T: () => EmojiLikeToOthersWrapper2 }
]);
}
create(value?: PartialMessage<EmojiLikeToOthersWrapper1>): EmojiLikeToOthersWrapper1 {
const message = globalThis.Object.create((this.messagePrototype!));
if (value !== undefined)
reflectionMergePartial<EmojiLikeToOthersWrapper1>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EmojiLikeToOthersWrapper1): EmojiLikeToOthersWrapper1 {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* SysMessage.EmojiLikeToOthersWrapper2 wrapper */ 1:
message.wrapper = EmojiLikeToOthersWrapper2.internalBinaryRead(reader, reader.uint32(), options, message.wrapper);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: EmojiLikeToOthersWrapper1, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* SysMessage.EmojiLikeToOthersWrapper2 wrapper = 1; */
if (message.wrapper)
EmojiLikeToOthersWrapper2.internalBinaryWrite(message.wrapper, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.EmojiLikeToOthersWrapper1
*/
export const EmojiLikeToOthersWrapper1 = new EmojiLikeToOthersWrapper1$Type();
// @generated message type with reflection information, may provide speed optimized methods
class EmojiLikeToOthersWrapper2$Type extends MessageType<EmojiLikeToOthersWrapper2> {
constructor() {
super("SysMessage.EmojiLikeToOthersWrapper2", [
{ no: 1, name: "body", kind: "message", T: () => EmojiLikeToOthersWrapper3 }
]);
}
create(value?: PartialMessage<EmojiLikeToOthersWrapper2>): EmojiLikeToOthersWrapper2 {
const message = globalThis.Object.create((this.messagePrototype!));
if (value !== undefined)
reflectionMergePartial<EmojiLikeToOthersWrapper2>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EmojiLikeToOthersWrapper2): EmojiLikeToOthersWrapper2 {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* SysMessage.EmojiLikeToOthersWrapper3 body */ 1:
message.body = EmojiLikeToOthersWrapper3.internalBinaryRead(reader, reader.uint32(), options, message.body);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: EmojiLikeToOthersWrapper2, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* SysMessage.EmojiLikeToOthersWrapper3 body = 1; */
if (message.body)
EmojiLikeToOthersWrapper3.internalBinaryWrite(message.body, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.EmojiLikeToOthersWrapper2
*/
export const EmojiLikeToOthersWrapper2 = new EmojiLikeToOthersWrapper2$Type();
// @generated message type with reflection information, may provide speed optimized methods
class EmojiLikeToOthersWrapper3$Type extends MessageType<EmojiLikeToOthersWrapper3> {
constructor() {
super("SysMessage.EmojiLikeToOthersWrapper3", [
{ no: 2, name: "msgSpec", kind: "message", T: () => EmojiLikeToOthersMsgSpec },
{ no: 3, name: "attributes", kind: "message", T: () => EmojiLikeToOthersAttributes }
]);
}
create(value?: PartialMessage<EmojiLikeToOthersWrapper3>): EmojiLikeToOthersWrapper3 {
const message = globalThis.Object.create((this.messagePrototype!));
if (value !== undefined)
reflectionMergePartial<EmojiLikeToOthersWrapper3>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EmojiLikeToOthersWrapper3): EmojiLikeToOthersWrapper3 {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* SysMessage.EmojiLikeToOthersMsgSpec msgSpec */ 2:
message.msgSpec = EmojiLikeToOthersMsgSpec.internalBinaryRead(reader, reader.uint32(), options, message.msgSpec);
break;
case /* SysMessage.EmojiLikeToOthersAttributes attributes */ 3:
message.attributes = EmojiLikeToOthersAttributes.internalBinaryRead(reader, reader.uint32(), options, message.attributes);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: EmojiLikeToOthersWrapper3, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* SysMessage.EmojiLikeToOthersMsgSpec msgSpec = 2; */
if (message.msgSpec)
EmojiLikeToOthersMsgSpec.internalBinaryWrite(message.msgSpec, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
/* SysMessage.EmojiLikeToOthersAttributes attributes = 3; */
if (message.attributes)
EmojiLikeToOthersAttributes.internalBinaryWrite(message.attributes, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.EmojiLikeToOthersWrapper3
*/
export const EmojiLikeToOthersWrapper3 = new EmojiLikeToOthersWrapper3$Type();
// @generated message type with reflection information, may provide speed optimized methods
class EmojiLikeToOthersMsgSpec$Type extends MessageType<EmojiLikeToOthersMsgSpec> {
constructor() {
super("SysMessage.EmojiLikeToOthersMsgSpec", [
{ no: 1, name: "msgSeq", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
]);
}
create(value?: PartialMessage<EmojiLikeToOthersMsgSpec>): EmojiLikeToOthersMsgSpec {
const message = globalThis.Object.create((this.messagePrototype!));
message.msgSeq = 0;
if (value !== undefined)
reflectionMergePartial<EmojiLikeToOthersMsgSpec>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EmojiLikeToOthersMsgSpec): EmojiLikeToOthersMsgSpec {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* uint32 msgSeq */ 1:
message.msgSeq = reader.uint32();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: EmojiLikeToOthersMsgSpec, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* uint32 msgSeq = 1; */
if (message.msgSeq !== 0)
writer.tag(1, WireType.Varint).uint32(message.msgSeq);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.EmojiLikeToOthersMsgSpec
*/
export const EmojiLikeToOthersMsgSpec = new EmojiLikeToOthersMsgSpec$Type();
// @generated message type with reflection information, may provide speed optimized methods
class EmojiLikeToOthersAttributes$Type extends MessageType<EmojiLikeToOthersAttributes> {
constructor() {
super("SysMessage.EmojiLikeToOthersAttributes", [
{ no: 1, name: "emojiId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 4, name: "senderUid", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 5, name: "operation", kind: "enum", T: () => ["SysMessage.EmojiLikeToOthersAttributes.Operation", EmojiLikeToOthersAttributes_Operation] }
]);
}
create(value?: PartialMessage<EmojiLikeToOthersAttributes>): EmojiLikeToOthersAttributes {
const message = globalThis.Object.create((this.messagePrototype!));
message.emojiId = "";
message.senderUid = "";
message.operation = 0;
if (value !== undefined)
reflectionMergePartial<EmojiLikeToOthersAttributes>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EmojiLikeToOthersAttributes): EmojiLikeToOthersAttributes {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* string emojiId */ 1:
message.emojiId = reader.string();
break;
case /* string senderUid */ 4:
message.senderUid = reader.string();
break;
case /* SysMessage.EmojiLikeToOthersAttributes.Operation operation */ 5:
message.operation = reader.int32();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: EmojiLikeToOthersAttributes, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* string emojiId = 1; */
if (message.emojiId !== "")
writer.tag(1, WireType.LengthDelimited).string(message.emojiId);
/* string senderUid = 4; */
if (message.senderUid !== "")
writer.tag(4, WireType.LengthDelimited).string(message.senderUid);
/* SysMessage.EmojiLikeToOthersAttributes.Operation operation = 5; */
if (message.operation !== 0)
writer.tag(5, WireType.Varint).int32(message.operation);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.EmojiLikeToOthersAttributes
*/
export const EmojiLikeToOthersAttributes = new EmojiLikeToOthersAttributes$Type();

View File

@ -1,104 +0,0 @@
// @generated by protobuf-ts 2.9.4
// @generated from protobuf file "GreyTipWrapper.proto" (package "SysMessage", syntax proto3)
// tslint:disable
import type {
BinaryReadOptions,
BinaryWriteOptions,
IBinaryReader,
IBinaryWriter,
PartialMessage,
} from '@protobuf-ts/runtime';
import { MessageType, reflectionMergePartial, UnknownFieldHandler, WireType } from '@protobuf-ts/runtime';
/**
* @generated from protobuf message SysMessage.GreyTipWrapper
*/
export interface GreyTipWrapper {
/**
* @generated from protobuf field: uint32 subTypeId = 1;
*/
subTypeId: number;
/**
* @generated from protobuf field: uint32 groupCode = 4;
*/
groupCode: number;
/**
* @generated from protobuf field: uint32 subTypeIdMinusOne = 13;
*/
subTypeIdMinusOne: number;
/**
* @generated from protobuf field: bytes rest = 44;
*/
rest: Uint8Array;
}
// @generated message type with reflection information, may provide speed optimized methods
class GreyTipWrapper$Type extends MessageType<GreyTipWrapper> {
constructor() {
super("SysMessage.GreyTipWrapper", [
{ no: 1, name: "subTypeId", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 4, name: "groupCode", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 13, name: "subTypeIdMinusOne", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 44, name: "rest", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
]);
}
create(value?: PartialMessage<GreyTipWrapper>): GreyTipWrapper {
const message = globalThis.Object.create((this.messagePrototype!));
message.subTypeId = 0;
message.groupCode = 0;
message.subTypeIdMinusOne = 0;
message.rest = new Uint8Array(0);
if (value !== undefined)
reflectionMergePartial<GreyTipWrapper>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GreyTipWrapper): GreyTipWrapper {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* uint32 subTypeId */ 1:
message.subTypeId = reader.uint32();
break;
case /* uint32 groupCode */ 4:
message.groupCode = reader.uint32();
break;
case /* uint32 subTypeIdMinusOne */ 13:
message.subTypeIdMinusOne = reader.uint32();
break;
case /* bytes rest */ 44:
message.rest = reader.bytes();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: GreyTipWrapper, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* uint32 subTypeId = 1; */
if (message.subTypeId !== 0)
writer.tag(1, WireType.Varint).uint32(message.subTypeId);
/* uint32 groupCode = 4; */
if (message.groupCode !== 0)
writer.tag(4, WireType.Varint).uint32(message.groupCode);
/* uint32 subTypeIdMinusOne = 13; */
if (message.subTypeIdMinusOne !== 0)
writer.tag(13, WireType.Varint).uint32(message.subTypeIdMinusOne);
/* bytes rest = 44; */
if (message.rest.length)
writer.tag(44, WireType.LengthDelimited).bytes(message.rest);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.GreyTipWrapper
*/
export const GreyTipWrapper = new GreyTipWrapper$Type();

View File

@ -0,0 +1,83 @@
import * as pb from 'protobufjs';
// Proto: from src/core/proto/ProfileLike.proto
// Auther: Mlikiowa
export interface LikeDetailType {
txt: string;
uin: pb.Long;
nickname: string;
}
export interface LikeMsgType {
times: number;
time: number;
detail: LikeDetailType;
}
export interface ProfileLikeTipType {
msg: LikeMsgType;
}
export interface SysMessageHeaderType {
id: string;
timestamp: number;
sender: string;
}
export interface SysMessageMsgSpecType {
msgType: number;
subType: number;
subSubType: number;
msgSeq: number;
time: number;
msgId: pb.Long;
other: number;
}
export interface SysMessageBodyWrapperType {
wrappedBody: Uint8Array;
}
export interface SysMessageType {
header: SysMessageHeaderType[];
msgSpec: SysMessageMsgSpecType[];
bodyWrapper: SysMessageBodyWrapperType;
}
export const SysMessageHeader = new pb.Type("SysMessageHeader")
.add(new pb.Field("PeerNumber", 1, "uint32"))
.add(new pb.Field("PeerString", 2, "string"))
.add(new pb.Field("Uin", 5, "uint32"))
.add(new pb.Field("Uid", 6, "string", "optional"));
export const SysMessageMsgSpec = new pb.Type("SysMessageMsgSpec")
.add(new pb.Field("msgType", 1, "uint32"))
.add(new pb.Field("subType", 2, "uint32"))
.add(new pb.Field("subSubType", 3, "uint32"))
.add(new pb.Field("msgSeq", 5, "uint32"))
.add(new pb.Field("time", 6, "uint32"))
.add(new pb.Field("msgId", 12, "uint64"))
.add(new pb.Field("other", 13, "uint32"));
export const SysMessageBodyWrapper = new pb.Type("SysMessageBodyWrapper")
.add(new pb.Field("wrappedBody", 2, "bytes"));
export const SysMessage = new pb.Type("SysMessage")
.add(SysMessageHeader)
.add(SysMessageMsgSpec)
.add(SysMessageBodyWrapper)
.add(new pb.Field("header", 1, "SysMessageHeader", "repeated"))
.add(new pb.Field("msgSpec", 2, "SysMessageMsgSpec", "repeated"))
.add(new pb.Field("bodyWrapper", 3, "SysMessageBodyWrapper"));
export const likeDetail = new pb.Type("likeDetail")
.add(new pb.Field("txt", 1, "string"))
.add(new pb.Field("uin", 3, "int64"))
.add(new pb.Field("nickname", 5, "string"));
export const likeMsg = new pb.Type("likeMsg")
.add(likeDetail)
.add(new pb.Field("times", 1, "int32"))
.add(new pb.Field("time", 2, "int32"))
.add(new pb.Field("detail", 3, "likeDetail"));
export const profileLikeTip = new pb.Type("profileLikeTip")
.add(likeMsg)
.add(new pb.Field("msg", 14, "likeMsg"));

View File

@ -1,435 +0,0 @@
// @generated by protobuf-ts 2.9.4
// @generated from protobuf file "SysMessage.proto" (package "SysMessage", syntax proto3)
// tslint:disable
import type {
BinaryReadOptions,
BinaryWriteOptions,
IBinaryReader,
IBinaryWriter,
PartialMessage,
} from '@protobuf-ts/runtime';
import { MessageType, reflectionMergePartial, UnknownFieldHandler, WireType } from '@protobuf-ts/runtime';
/**
* @generated from protobuf message SysMessage.SysMessage
*/
export interface SysMessage {
/**
* @generated from protobuf field: repeated SysMessage.SysMessageHeader header = 1;
*/
header: SysMessageHeader[];
/**
* @generated from protobuf field: repeated SysMessage.SysMessageMsgSpec msgSpec = 2;
*/
msgSpec: SysMessageMsgSpec[];
/**
* @generated from protobuf field: SysMessage.SysMessageBodyWrapper bodyWrapper = 3;
*/
bodyWrapper?: SysMessageBodyWrapper;
}
/**
* @generated from protobuf message SysMessage.SysMessageHeader
*/
export interface SysMessageHeader {
/**
* @generated from protobuf field: uint32 PeerNumber = 1 [json_name = "PeerNumber"];
*/
peerNumber: number;
/**
* @generated from protobuf field: string PeerString = 2 [json_name = "PeerString"];
*/
peerString: string;
/**
* @generated from protobuf field: uint32 Uin = 5 [json_name = "Uin"];
*/
uin: number;
/**
* @generated from protobuf field: optional string Uid = 6 [json_name = "Uid"];
*/
uid?: string;
}
/**
* @generated from protobuf message SysMessage.SysMessageMsgSpec
*/
export interface SysMessageMsgSpec {
/**
* @generated from protobuf field: uint32 msgType = 1;
*/
msgType: number;
/**
* @generated from protobuf field: uint32 subType = 2;
*/
subType: number;
/**
* @generated from protobuf field: uint32 subSubType = 3;
*/
subSubType: number;
/**
* @generated from protobuf field: uint32 msgSeq = 5;
*/
msgSeq: number;
/**
* @generated from protobuf field: uint32 time = 6;
*/
time: number;
/**
* @generated from protobuf field: uint64 msgId = 12;
*/
msgId: bigint;
/**
* @generated from protobuf field: uint32 other = 13;
*/
other: number;
}
/**
* @generated from protobuf message SysMessage.SysMessageBodyWrapper
*/
export interface SysMessageBodyWrapper {
/**
* @generated from protobuf field: bytes wrappedBody = 2;
*/
wrappedBody: Uint8Array; // Find the first [08], or ignore the first 7 bytes?
// And it becomes another ProtoBuf message.
}
/**
* @generated from protobuf message SysMessage.KeyValuePair
*/
export interface KeyValuePair {
/**
* @generated from protobuf field: string key = 1;
*/
key: string;
/**
* @generated from protobuf field: string value = 2;
*/
value: string;
}
// @generated message type with reflection information, may provide speed optimized methods
class SysMessage$Type extends MessageType<SysMessage> {
constructor() {
super("SysMessage.SysMessage", [
{ no: 1, name: "header", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => SysMessageHeader },
{ no: 2, name: "msgSpec", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => SysMessageMsgSpec },
{ no: 3, name: "bodyWrapper", kind: "message", T: () => SysMessageBodyWrapper }
]);
}
create(value?: PartialMessage<SysMessage>): SysMessage {
const message = globalThis.Object.create((this.messagePrototype!));
message.header = [];
message.msgSpec = [];
if (value !== undefined)
reflectionMergePartial<SysMessage>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SysMessage): SysMessage {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* repeated SysMessage.SysMessageHeader header */ 1:
message.header.push(SysMessageHeader.internalBinaryRead(reader, reader.uint32(), options));
break;
case /* repeated SysMessage.SysMessageMsgSpec msgSpec */ 2:
message.msgSpec.push(SysMessageMsgSpec.internalBinaryRead(reader, reader.uint32(), options));
break;
case /* SysMessage.SysMessageBodyWrapper bodyWrapper */ 3:
message.bodyWrapper = SysMessageBodyWrapper.internalBinaryRead(reader, reader.uint32(), options, message.bodyWrapper);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: SysMessage, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* repeated SysMessage.SysMessageHeader header = 1; */
for (let i = 0; i < message.header.length; i++)
SysMessageHeader.internalBinaryWrite(message.header[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* repeated SysMessage.SysMessageMsgSpec msgSpec = 2; */
for (let i = 0; i < message.msgSpec.length; i++)
SysMessageMsgSpec.internalBinaryWrite(message.msgSpec[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
/* SysMessage.SysMessageBodyWrapper bodyWrapper = 3; */
if (message.bodyWrapper)
SysMessageBodyWrapper.internalBinaryWrite(message.bodyWrapper, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.SysMessage
*/
export const SysMessage = new SysMessage$Type();
// @generated message type with reflection information, may provide speed optimized methods
class SysMessageHeader$Type extends MessageType<SysMessageHeader> {
constructor() {
super("SysMessage.SysMessageHeader", [
{ no: 1, name: "PeerNumber", kind: "scalar", jsonName: "PeerNumber", T: 13 /*ScalarType.UINT32*/ },
{ no: 2, name: "PeerString", kind: "scalar", jsonName: "PeerString", T: 9 /*ScalarType.STRING*/ },
{ no: 5, name: "Uin", kind: "scalar", jsonName: "Uin", T: 13 /*ScalarType.UINT32*/ },
{ no: 6, name: "Uid", kind: "scalar", jsonName: "Uid", opt: true, T: 9 /*ScalarType.STRING*/ }
]);
}
create(value?: PartialMessage<SysMessageHeader>): SysMessageHeader {
const message = globalThis.Object.create((this.messagePrototype!));
message.peerNumber = 0;
message.peerString = "";
message.uin = 0;
if (value !== undefined)
reflectionMergePartial<SysMessageHeader>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SysMessageHeader): SysMessageHeader {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* uint32 PeerNumber = 1 [json_name = "PeerNumber"];*/ 1:
message.peerNumber = reader.uint32();
break;
case /* string PeerString = 2 [json_name = "PeerString"];*/ 2:
message.peerString = reader.string();
break;
case /* uint32 Uin = 5 [json_name = "Uin"];*/ 5:
message.uin = reader.uint32();
break;
case /* optional string Uid = 6 [json_name = "Uid"];*/ 6:
message.uid = reader.string();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: SysMessageHeader, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* uint32 PeerNumber = 1 [json_name = "PeerNumber"]; */
if (message.peerNumber !== 0)
writer.tag(1, WireType.Varint).uint32(message.peerNumber);
/* string PeerString = 2 [json_name = "PeerString"]; */
if (message.peerString !== "")
writer.tag(2, WireType.LengthDelimited).string(message.peerString);
/* uint32 Uin = 5 [json_name = "Uin"]; */
if (message.uin !== 0)
writer.tag(5, WireType.Varint).uint32(message.uin);
/* optional string Uid = 6 [json_name = "Uid"]; */
if (message.uid !== undefined)
writer.tag(6, WireType.LengthDelimited).string(message.uid);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.SysMessageHeader
*/
export const SysMessageHeader = new SysMessageHeader$Type();
// @generated message type with reflection information, may provide speed optimized methods
class SysMessageMsgSpec$Type extends MessageType<SysMessageMsgSpec> {
constructor() {
super("SysMessage.SysMessageMsgSpec", [
{ no: 1, name: "msgType", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 2, name: "subType", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 3, name: "subSubType", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 5, name: "msgSeq", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 6, name: "time", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 12, name: "msgId", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 13, name: "other", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
]);
}
create(value?: PartialMessage<SysMessageMsgSpec>): SysMessageMsgSpec {
const message = globalThis.Object.create((this.messagePrototype!));
message.msgType = 0;
message.subType = 0;
message.subSubType = 0;
message.msgSeq = 0;
message.time = 0;
message.msgId = 0n;
message.other = 0;
if (value !== undefined)
reflectionMergePartial<SysMessageMsgSpec>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SysMessageMsgSpec): SysMessageMsgSpec {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* uint32 msgType */ 1:
message.msgType = reader.uint32();
break;
case /* uint32 subType */ 2:
message.subType = reader.uint32();
break;
case /* uint32 subSubType */ 3:
message.subSubType = reader.uint32();
break;
case /* uint32 msgSeq */ 5:
message.msgSeq = reader.uint32();
break;
case /* uint32 time */ 6:
message.time = reader.uint32();
break;
case /* uint64 msgId */ 12:
message.msgId = reader.uint64().toBigInt();
break;
case /* uint32 other */ 13:
message.other = reader.uint32();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: SysMessageMsgSpec, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* uint32 msgType = 1; */
if (message.msgType !== 0)
writer.tag(1, WireType.Varint).uint32(message.msgType);
/* uint32 subType = 2; */
if (message.subType !== 0)
writer.tag(2, WireType.Varint).uint32(message.subType);
/* uint32 subSubType = 3; */
if (message.subSubType !== 0)
writer.tag(3, WireType.Varint).uint32(message.subSubType);
/* uint32 msgSeq = 5; */
if (message.msgSeq !== 0)
writer.tag(5, WireType.Varint).uint32(message.msgSeq);
/* uint32 time = 6; */
if (message.time !== 0)
writer.tag(6, WireType.Varint).uint32(message.time);
/* uint64 msgId = 12; */
if (message.msgId !== 0n)
writer.tag(12, WireType.Varint).uint64(message.msgId);
/* uint32 other = 13; */
if (message.other !== 0)
writer.tag(13, WireType.Varint).uint32(message.other);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.SysMessageMsgSpec
*/
export const SysMessageMsgSpec = new SysMessageMsgSpec$Type();
// @generated message type with reflection information, may provide speed optimized methods
class SysMessageBodyWrapper$Type extends MessageType<SysMessageBodyWrapper> {
constructor() {
super("SysMessage.SysMessageBodyWrapper", [
{ no: 2, name: "wrappedBody", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
]);
}
create(value?: PartialMessage<SysMessageBodyWrapper>): SysMessageBodyWrapper {
const message = globalThis.Object.create((this.messagePrototype!));
message.wrappedBody = new Uint8Array(0);
if (value !== undefined)
reflectionMergePartial<SysMessageBodyWrapper>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SysMessageBodyWrapper): SysMessageBodyWrapper {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* bytes wrappedBody */ 2:
message.wrappedBody = reader.bytes();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: SysMessageBodyWrapper, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* bytes wrappedBody = 2; */
if (message.wrappedBody.length)
writer.tag(2, WireType.LengthDelimited).bytes(message.wrappedBody);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.SysMessageBodyWrapper
*/
export const SysMessageBodyWrapper = new SysMessageBodyWrapper$Type();
// @generated message type with reflection information, may provide speed optimized methods
class KeyValuePair$Type extends MessageType<KeyValuePair> {
constructor() {
super("SysMessage.KeyValuePair", [
{ no: 1, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "value", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value?: PartialMessage<KeyValuePair>): KeyValuePair {
const message = globalThis.Object.create((this.messagePrototype!));
message.key = "";
message.value = "";
if (value !== undefined)
reflectionMergePartial<KeyValuePair>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: KeyValuePair): KeyValuePair {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* string key */ 1:
message.key = reader.string();
break;
case /* string value */ 2:
message.value = reader.string();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: KeyValuePair, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* string key = 1; */
if (message.key !== "")
writer.tag(1, WireType.LengthDelimited).string(message.key);
/* string value = 2; */
if (message.value !== "")
writer.tag(2, WireType.LengthDelimited).string(message.value);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message SysMessage.KeyValuePair
*/
export const KeyValuePair = new KeyValuePair$Type();

View File

@ -0,0 +1,19 @@
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
import { NapCatCore } from '@/core';
export class OB11ProfileLikeEvent extends OB11BaseNoticeEvent {
notice_type = 'notify';
sub_type = 'profile_like';
operator_id: number;
operator_nick: string;
times: number;
time: number;
constructor(core: NapCatCore, operatorId: number, operatorNick: string, times: number, time: number) {
super(core);
this.operator_id = operatorId;
this.operator_nick = operatorNick;
this.times = times;
this.time = time;
}
}

View File

@ -43,6 +43,9 @@ import { OB11FriendRecallNoticeEvent } from '@/onebot/event/notice/OB11FriendRec
import { OB11GroupRecallNoticeEvent } from '@/onebot/event/notice/OB11GroupRecallNoticeEvent';
import { LRUCache } from '@/common/lru-cache';
import { NodeIKernelRecentContactListener } from '@/core/listeners/NodeIKernelRecentContactListener';
import { OB11ProfileLikeEvent } from './event/notice/OB11ProfileLikeEvent';
import { profileLikeTip, ProfileLikeTipType, SysMessage, SysMessageMsgSpecType, SysMessageType } from '@/core/proto/ProfileLike';
import { Message } from 'protobufjs';
//OneBot实现类
export class NapCatOneBot11Adapter {
@ -237,14 +240,29 @@ export class NapCatOneBot11Adapter {
private initMsgListener() {
const msgListener = new NodeIKernelMsgListener();
/*
msgListener.onRecvSysMsg = async () => {
const sysMsg = SysMessage.fromBinary(Uint8Array.from(msg));
msgListener.onRecvSysMsg = async (msg) => {
const sysMsg = SysMessage.decode(Uint8Array.from(msg)) as unknown as SysMessageType;
if (sysMsg.msgSpec.length === 0) {
return;
}
const { msgType, subType, subSubType } = sysMsg.msgSpec[0];
if (msgType === 528 && subType === 39 && subSubType === 39) {
const likeTip = profileLikeTip.decode(Uint8Array.from(sysMsg.bodyWrapper.wrappedBody.slice(12))) as unknown as ProfileLikeTipType;
this.core.context.logger.logDebug("收到点赞通知消息");
const likeMsg = likeTip.msg;
if (!likeMsg) return;
const detail = likeMsg.detail;
if (!detail) return;
const times = detail.txt.match(/\d+/) ?? "0";
await this.networkManager.emitEvent(new OB11ProfileLikeEvent(
this.core,
Number(detail.uin),
detail.nickname,
parseInt(times[0], 10),
likeMsg.time,
)).catch(e => this.context.logger.logError('处理被点赞事件失败', e));
};
/*
if (msgType === 732 && subType === 16 && subSubType === 16) {
const greyTip = GreyTipWrapper.fromBinary(Uint8Array.from(sysMsg.bodyWrapper!.wrappedBody.slice(7)));
if (greyTip.subTypeId === 36) {
@ -265,8 +283,8 @@ export class NapCatOneBot11Adapter {
eventOrEmpty && await this.networkManager.emitEvent(eventOrEmpty);
}
}
*/
};
*/
msgListener.onInputStatusPush = async data => {
const uin = await this.core.apis.UserApi.getUinByUidV2(data.fromUin);