From 20f2e66b1119fca4ac377db1b2d36f0e6c5fcbf8 Mon Sep 17 00:00:00 2001 From: idranme Date: Tue, 10 Sep 2024 16:21:36 +0800 Subject: [PATCH 1/4] chore chore chore --- .gitignore | 3 ++- package.json | 6 +++--- src/common/utils/file.ts | 2 +- src/common/utils/table.ts | 5 ++--- src/ntqqapi/helper/rkey.ts | 2 +- tsconfig.json | 8 ++------ 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index a3d980a..dd4aade 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,6 @@ node_modules dist out -.idea/ .DS_Store +.idea +.vscode diff --git a/package.json b/package.json index 494bd5c..48f3787 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "build-mac": "npm run build && npm run deploy-mac", "deploy-mac": "cp -r dist/* ~/Library/Containers/com.tencent.qq/Data/Documents/LiteLoaderQQNT/plugins/LLOneBot/", "build-win": "npm run build && npm run deploy-win", - "deploy-win": "cmd /c \"xcopy /C /S /Y dist\\* %USERPROFILE%\\documents\\LiteLoaderQQNT\\plugins\\LLOneBot\\\"", + "deploy-win": "cmd /c \"xcopy /C /S /Y dist\\* %LITELOADERQQNT_PROFILE%\\plugins\\LLOneBot\\\"", "format": "prettier -cw .", "check": "tsc" }, @@ -21,7 +21,7 @@ "cordis": "^3.18.0", "cors": "^2.8.5", "cosmokit": "^1.6.2", - "express": "^4.19.2", + "express": "^5.0.0", "fast-xml-parser": "^4.5.0", "file-type": "^19.5.0", "fluent-ffmpeg": "^2.1.3", @@ -37,7 +37,7 @@ "@types/ws": "^8.5.12", "electron": "^31.4.0", "electron-vite": "^2.3.0", - "typescript": "^5.5.4", + "typescript": "^5.6.2", "vite": "^5.4.3", "vite-plugin-cp": "^4.0.8" }, diff --git a/src/common/utils/file.ts b/src/common/utils/file.ts index 50d1542..5af41fd 100644 --- a/src/common/utils/file.ts +++ b/src/common/utils/file.ts @@ -133,7 +133,7 @@ export async function uri2local(uri: string, filename?: string, needExt?: boolea if (type === FileUriType.RemoteURL) { try { - const res = await fetchFile(uri, {'Referer': uri}) + const res = await fetchFile(uri, { 'Referer': uri }) const match = res.url.match(/.+\/([^/?]*)(?=\?)?/) if (match?.[1]) { filename ??= match[1].replace(/[/\\:*?"<>|]/g, '_') diff --git a/src/common/utils/table.ts b/src/common/utils/table.ts index 29738af..bdabe0f 100644 --- a/src/common/utils/table.ts +++ b/src/common/utils/table.ts @@ -16,12 +16,11 @@ export class LimitedHashTable { this.keyToValue.set(key, value) this.valueToKey.set(value, key) while (this.keyToValue.size !== this.valueToKey.size) { - console.log('keyToValue.size !== valueToKey.size Error Atom') this.keyToValue.clear() this.valueToKey.clear() } while (this.keyToValue.size > this.maxSize || this.valueToKey.size > this.maxSize) { - const oldestKey = this.keyToValue.keys().next().value + const oldestKey = this.keyToValue.keys().next().value! this.valueToKey.delete(this.keyToValue.get(oldestKey)!) this.keyToValue.delete(oldestKey) } @@ -56,7 +55,7 @@ export class LimitedHashTable { } //获取最近刚写入的几个值 - getHeads(size: number): { key: K; value: V }[] | undefined { + getHeads(size: number): { key: K, value: V }[] | undefined { const keyList = this.getKeyList() if (keyList.length === 0) { return undefined diff --git a/src/ntqqapi/helper/rkey.ts b/src/ntqqapi/helper/rkey.ts index 9b63a5e..afd091b 100644 --- a/src/ntqqapi/helper/rkey.ts +++ b/src/ntqqapi/helper/rkey.ts @@ -1,4 +1,4 @@ -import { Context } from "cordis" +import { Context } from 'cordis' interface ServerRkeyData { group_rkey: string diff --git a/tsconfig.json b/tsconfig.json index 13c53f1..a383f6f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,11 +24,7 @@ "noEmit": true }, "include": [ - "src/*", - "src/**/*", - "scripts/*" - ], - "exclude": [ - "node_modules" + "src", + "scripts" ] } \ No newline at end of file From 6d82dd1dad86e6b8666e64d8853534ce73d6ded4 Mon Sep 17 00:00:00 2001 From: idranme Date: Tue, 10 Sep 2024 17:16:47 +0800 Subject: [PATCH 2/4] chore --- src/onebot11/action/types.ts | 6 +++--- src/onebot11/event/OB11BaseEvent.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/onebot11/action/types.ts b/src/onebot11/action/types.ts index 13c151b..f128bf8 100644 --- a/src/onebot11/action/types.ts +++ b/src/onebot11/action/types.ts @@ -66,9 +66,9 @@ export enum ActionName { GoCQHTTP_DownloadFile = 'download_file', GoCQHTTP_GetGroupMsgHistory = 'get_group_msg_history', GoCQHTTP_GetForwardMsg = 'get_forward_msg', - GoCQHTTP_GetEssenceMsg = "get_essence_msg_list", - GoCQHTTP_HandleQuickOperation = ".handle_quick_operation", - GetGroupHonorInfo = "get_group_honor_info", + GoCQHTTP_GetEssenceMsg = 'get_essence_msg_list', + GoCQHTTP_HandleQuickOperation = '.handle_quick_operation', + GetGroupHonorInfo = 'get_group_honor_info', GoCQHTTP_SetEssenceMsg = 'set_essence_msg', GoCQHTTP_DelEssenceMsg = 'delete_essence_msg', GoCQHTTP_DelGroupFile = 'delete_group_file', diff --git a/src/onebot11/event/OB11BaseEvent.ts b/src/onebot11/event/OB11BaseEvent.ts index f9a5388..cc7968c 100644 --- a/src/onebot11/event/OB11BaseEvent.ts +++ b/src/onebot11/event/OB11BaseEvent.ts @@ -1,4 +1,4 @@ -import { selfInfo } from "@/common/globalVars" +import { selfInfo } from '@/common/globalVars' export enum EventType { META = 'meta_event', From 67568a662d8ef276fb926d3b3456c220934dab3d Mon Sep 17 00:00:00 2001 From: idranme Date: Wed, 11 Sep 2024 20:48:32 +0800 Subject: [PATCH 3/4] feat: `profile_like` event --- package.json | 7 +- src/ntqqapi/core.ts | 10 + src/ntqqapi/proto/compiled.d.ts | 768 +++++++ src/ntqqapi/proto/compiled.js | 1851 +++++++++++++++++ src/ntqqapi/proto/profileLikeTip.proto | 18 + src/ntqqapi/proto/systemMessage.proto | 30 + src/onebot11/adapter.ts | 14 + .../event/notice/OB11ProfileLikeEvent.ts | 16 + 8 files changed, 2712 insertions(+), 2 deletions(-) create mode 100644 src/ntqqapi/proto/compiled.d.ts create mode 100644 src/ntqqapi/proto/compiled.js create mode 100644 src/ntqqapi/proto/profileLikeTip.proto create mode 100644 src/ntqqapi/proto/systemMessage.proto create mode 100644 src/onebot11/event/notice/OB11ProfileLikeEvent.ts diff --git a/package.json b/package.json index 48f3787..59b1f60 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "build-win": "npm run build && npm run deploy-win", "deploy-win": "cmd /c \"xcopy /C /S /Y dist\\* %LITELOADERQQNT_PROFILE%\\plugins\\LLOneBot\\\"", "format": "prettier -cw .", - "check": "tsc" + "check": "tsc", + "compile:proto": "pbjs -t static-module -w es6 -p ./src/ntqqapi/proto -o ./src/ntqqapi/proto/compiled.js systemMessage.proto profileLikeTip.proto && pbts -o ./src/ntqqapi/proto/compiled.d.ts ./src/ntqqapi/proto/compiled.js" }, "author": "", "license": "MIT", @@ -26,6 +27,7 @@ "file-type": "^19.5.0", "fluent-ffmpeg": "^2.1.3", "minato": "^3.5.1", + "protobufjs": "^7.4.0", "silk-wasm": "^3.6.1", "ws": "^8.18.0" }, @@ -37,8 +39,9 @@ "@types/ws": "^8.5.12", "electron": "^31.4.0", "electron-vite": "^2.3.0", + "protobufjs-cli": "^1.1.3", "typescript": "^5.6.2", - "vite": "^5.4.3", + "vite": "^5.4.4", "vite-plugin-cp": "^4.0.8" }, "packageManager": "yarn@4.4.1" diff --git a/src/ntqqapi/core.ts b/src/ntqqapi/core.ts index 402abba..d4cc923 100644 --- a/src/ntqqapi/core.ts +++ b/src/ntqqapi/core.ts @@ -19,6 +19,7 @@ import { } from './types' import { selfInfo } from '../common/globalVars' import { version } from '../version' +import { invoke } from './ntcall' declare module 'cordis' { interface Context { @@ -31,6 +32,7 @@ declare module 'cordis' { 'nt/group-notify': (input: GroupNotify[]) => void 'nt/friend-request': (input: FriendRequest[]) => void 'nt/group-member-info-updated': (input: { groupCode: string, members: GroupMember[] }) => void + 'nt/system-message-created': (input: Uint8Array) => void } } @@ -219,6 +221,14 @@ class Core extends Service { registerReceiveHook(ReceiveCmdS.FRIEND_REQUEST, payload => { this.ctx.parallel('nt/friend-request', payload.data.buddyReqs) }) + + invoke('nodeIKernelMsgListener/onRecvSysMsg', [], { classNameIsRegister: true }) + + registerReceiveHook<{ + msgBuf: number[] + }>('nodeIKernelMsgListener/onRecvSysMsg', payload => { + this.ctx.parallel('nt/system-message-created', Uint8Array.from(payload.msgBuf)) + }) } } diff --git a/src/ntqqapi/proto/compiled.d.ts b/src/ntqqapi/proto/compiled.d.ts new file mode 100644 index 0000000..6631250 --- /dev/null +++ b/src/ntqqapi/proto/compiled.d.ts @@ -0,0 +1,768 @@ +import * as $protobuf from "protobufjs"; +import Long = require("long"); +/** Namespace SysMsg. */ +export namespace SysMsg { + + /** Properties of a SystemMessage. */ + interface ISystemMessage { + + /** SystemMessage header */ + header?: (SysMsg.ISystemMessageHeader[]|null); + + /** SystemMessage msgSpec */ + msgSpec?: (SysMsg.ISystemMessageMsgSpec[]|null); + + /** SystemMessage bodyWrapper */ + bodyWrapper?: (SysMsg.ISystemMessageBodyWrapper|null); + } + + /** Represents a SystemMessage. */ + class SystemMessage implements ISystemMessage { + + /** + * Constructs a new SystemMessage. + * @param [properties] Properties to set + */ + constructor(properties?: SysMsg.ISystemMessage); + + /** SystemMessage header. */ + public header: SysMsg.ISystemMessageHeader[]; + + /** SystemMessage msgSpec. */ + public msgSpec: SysMsg.ISystemMessageMsgSpec[]; + + /** SystemMessage bodyWrapper. */ + public bodyWrapper?: (SysMsg.ISystemMessageBodyWrapper|null); + + /** + * Creates a new SystemMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns SystemMessage instance + */ + public static create(properties?: SysMsg.ISystemMessage): SysMsg.SystemMessage; + + /** + * Encodes the specified SystemMessage message. Does not implicitly {@link SysMsg.SystemMessage.verify|verify} messages. + * @param message SystemMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: SysMsg.ISystemMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SystemMessage message, length delimited. Does not implicitly {@link SysMsg.SystemMessage.verify|verify} messages. + * @param message SystemMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: SysMsg.ISystemMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SystemMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SystemMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): SysMsg.SystemMessage; + + /** + * Decodes a SystemMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SystemMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): SysMsg.SystemMessage; + + /** + * Verifies a SystemMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SystemMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SystemMessage + */ + public static fromObject(object: { [k: string]: any }): SysMsg.SystemMessage; + + /** + * Creates a plain object from a SystemMessage message. Also converts values to other types if specified. + * @param message SystemMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: SysMsg.SystemMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SystemMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SystemMessage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SystemMessageHeader. */ + interface ISystemMessageHeader { + + /** SystemMessageHeader peerNumber */ + peerNumber?: (number|null); + + /** SystemMessageHeader peerString */ + peerString?: (string|null); + + /** SystemMessageHeader uin */ + uin?: (number|null); + + /** SystemMessageHeader uid */ + uid?: (string|null); + } + + /** Represents a SystemMessageHeader. */ + class SystemMessageHeader implements ISystemMessageHeader { + + /** + * Constructs a new SystemMessageHeader. + * @param [properties] Properties to set + */ + constructor(properties?: SysMsg.ISystemMessageHeader); + + /** SystemMessageHeader peerNumber. */ + public peerNumber: number; + + /** SystemMessageHeader peerString. */ + public peerString: string; + + /** SystemMessageHeader uin. */ + public uin: number; + + /** SystemMessageHeader uid. */ + public uid?: (string|null); + + /** + * Creates a new SystemMessageHeader instance using the specified properties. + * @param [properties] Properties to set + * @returns SystemMessageHeader instance + */ + public static create(properties?: SysMsg.ISystemMessageHeader): SysMsg.SystemMessageHeader; + + /** + * Encodes the specified SystemMessageHeader message. Does not implicitly {@link SysMsg.SystemMessageHeader.verify|verify} messages. + * @param message SystemMessageHeader message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: SysMsg.ISystemMessageHeader, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SystemMessageHeader message, length delimited. Does not implicitly {@link SysMsg.SystemMessageHeader.verify|verify} messages. + * @param message SystemMessageHeader message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: SysMsg.ISystemMessageHeader, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SystemMessageHeader message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SystemMessageHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): SysMsg.SystemMessageHeader; + + /** + * Decodes a SystemMessageHeader message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SystemMessageHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): SysMsg.SystemMessageHeader; + + /** + * Verifies a SystemMessageHeader message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SystemMessageHeader message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SystemMessageHeader + */ + public static fromObject(object: { [k: string]: any }): SysMsg.SystemMessageHeader; + + /** + * Creates a plain object from a SystemMessageHeader message. Also converts values to other types if specified. + * @param message SystemMessageHeader + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: SysMsg.SystemMessageHeader, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SystemMessageHeader to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SystemMessageHeader + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SystemMessageMsgSpec. */ + interface ISystemMessageMsgSpec { + + /** SystemMessageMsgSpec msgType */ + msgType?: (number|null); + + /** SystemMessageMsgSpec subType */ + subType?: (number|null); + + /** SystemMessageMsgSpec subSubType */ + subSubType?: (number|null); + + /** SystemMessageMsgSpec msgSeq */ + msgSeq?: (number|null); + + /** SystemMessageMsgSpec time */ + time?: (number|null); + + /** SystemMessageMsgSpec other */ + other?: (number|null); + } + + /** Represents a SystemMessageMsgSpec. */ + class SystemMessageMsgSpec implements ISystemMessageMsgSpec { + + /** + * Constructs a new SystemMessageMsgSpec. + * @param [properties] Properties to set + */ + constructor(properties?: SysMsg.ISystemMessageMsgSpec); + + /** SystemMessageMsgSpec msgType. */ + public msgType: number; + + /** SystemMessageMsgSpec subType. */ + public subType: number; + + /** SystemMessageMsgSpec subSubType. */ + public subSubType: number; + + /** SystemMessageMsgSpec msgSeq. */ + public msgSeq: number; + + /** SystemMessageMsgSpec time. */ + public time: number; + + /** SystemMessageMsgSpec other. */ + public other: number; + + /** + * Creates a new SystemMessageMsgSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns SystemMessageMsgSpec instance + */ + public static create(properties?: SysMsg.ISystemMessageMsgSpec): SysMsg.SystemMessageMsgSpec; + + /** + * Encodes the specified SystemMessageMsgSpec message. Does not implicitly {@link SysMsg.SystemMessageMsgSpec.verify|verify} messages. + * @param message SystemMessageMsgSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: SysMsg.ISystemMessageMsgSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SystemMessageMsgSpec message, length delimited. Does not implicitly {@link SysMsg.SystemMessageMsgSpec.verify|verify} messages. + * @param message SystemMessageMsgSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: SysMsg.ISystemMessageMsgSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SystemMessageMsgSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SystemMessageMsgSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): SysMsg.SystemMessageMsgSpec; + + /** + * Decodes a SystemMessageMsgSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SystemMessageMsgSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): SysMsg.SystemMessageMsgSpec; + + /** + * Verifies a SystemMessageMsgSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SystemMessageMsgSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SystemMessageMsgSpec + */ + public static fromObject(object: { [k: string]: any }): SysMsg.SystemMessageMsgSpec; + + /** + * Creates a plain object from a SystemMessageMsgSpec message. Also converts values to other types if specified. + * @param message SystemMessageMsgSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: SysMsg.SystemMessageMsgSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SystemMessageMsgSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SystemMessageMsgSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SystemMessageBodyWrapper. */ + interface ISystemMessageBodyWrapper { + + /** SystemMessageBodyWrapper body */ + body?: (Uint8Array|null); + } + + /** Represents a SystemMessageBodyWrapper. */ + class SystemMessageBodyWrapper implements ISystemMessageBodyWrapper { + + /** + * Constructs a new SystemMessageBodyWrapper. + * @param [properties] Properties to set + */ + constructor(properties?: SysMsg.ISystemMessageBodyWrapper); + + /** SystemMessageBodyWrapper body. */ + public body: Uint8Array; + + /** + * Creates a new SystemMessageBodyWrapper instance using the specified properties. + * @param [properties] Properties to set + * @returns SystemMessageBodyWrapper instance + */ + public static create(properties?: SysMsg.ISystemMessageBodyWrapper): SysMsg.SystemMessageBodyWrapper; + + /** + * Encodes the specified SystemMessageBodyWrapper message. Does not implicitly {@link SysMsg.SystemMessageBodyWrapper.verify|verify} messages. + * @param message SystemMessageBodyWrapper message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: SysMsg.ISystemMessageBodyWrapper, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SystemMessageBodyWrapper message, length delimited. Does not implicitly {@link SysMsg.SystemMessageBodyWrapper.verify|verify} messages. + * @param message SystemMessageBodyWrapper message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: SysMsg.ISystemMessageBodyWrapper, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SystemMessageBodyWrapper message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SystemMessageBodyWrapper + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): SysMsg.SystemMessageBodyWrapper; + + /** + * Decodes a SystemMessageBodyWrapper message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SystemMessageBodyWrapper + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): SysMsg.SystemMessageBodyWrapper; + + /** + * Verifies a SystemMessageBodyWrapper message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SystemMessageBodyWrapper message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SystemMessageBodyWrapper + */ + public static fromObject(object: { [k: string]: any }): SysMsg.SystemMessageBodyWrapper; + + /** + * Creates a plain object from a SystemMessageBodyWrapper message. Also converts values to other types if specified. + * @param message SystemMessageBodyWrapper + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: SysMsg.SystemMessageBodyWrapper, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SystemMessageBodyWrapper to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SystemMessageBodyWrapper + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LikeDetail. */ + interface ILikeDetail { + + /** LikeDetail txt */ + txt?: (string|null); + + /** LikeDetail uin */ + uin?: (number|null); + + /** LikeDetail nickname */ + nickname?: (string|null); + } + + /** Represents a LikeDetail. */ + class LikeDetail implements ILikeDetail { + + /** + * Constructs a new LikeDetail. + * @param [properties] Properties to set + */ + constructor(properties?: SysMsg.ILikeDetail); + + /** LikeDetail txt. */ + public txt: string; + + /** LikeDetail uin. */ + public uin: number; + + /** LikeDetail nickname. */ + public nickname: string; + + /** + * Creates a new LikeDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns LikeDetail instance + */ + public static create(properties?: SysMsg.ILikeDetail): SysMsg.LikeDetail; + + /** + * Encodes the specified LikeDetail message. Does not implicitly {@link SysMsg.LikeDetail.verify|verify} messages. + * @param message LikeDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: SysMsg.ILikeDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LikeDetail message, length delimited. Does not implicitly {@link SysMsg.LikeDetail.verify|verify} messages. + * @param message LikeDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: SysMsg.ILikeDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LikeDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LikeDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): SysMsg.LikeDetail; + + /** + * Decodes a LikeDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LikeDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): SysMsg.LikeDetail; + + /** + * Verifies a LikeDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LikeDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LikeDetail + */ + public static fromObject(object: { [k: string]: any }): SysMsg.LikeDetail; + + /** + * Creates a plain object from a LikeDetail message. Also converts values to other types if specified. + * @param message LikeDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: SysMsg.LikeDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LikeDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LikeDetail + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LikeMsg. */ + interface ILikeMsg { + + /** LikeMsg count */ + count?: (number|null); + + /** LikeMsg time */ + time?: (number|null); + + /** LikeMsg detail */ + detail?: (SysMsg.ILikeDetail|null); + } + + /** Represents a LikeMsg. */ + class LikeMsg implements ILikeMsg { + + /** + * Constructs a new LikeMsg. + * @param [properties] Properties to set + */ + constructor(properties?: SysMsg.ILikeMsg); + + /** LikeMsg count. */ + public count: number; + + /** LikeMsg time. */ + public time: number; + + /** LikeMsg detail. */ + public detail?: (SysMsg.ILikeDetail|null); + + /** + * Creates a new LikeMsg instance using the specified properties. + * @param [properties] Properties to set + * @returns LikeMsg instance + */ + public static create(properties?: SysMsg.ILikeMsg): SysMsg.LikeMsg; + + /** + * Encodes the specified LikeMsg message. Does not implicitly {@link SysMsg.LikeMsg.verify|verify} messages. + * @param message LikeMsg message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: SysMsg.ILikeMsg, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LikeMsg message, length delimited. Does not implicitly {@link SysMsg.LikeMsg.verify|verify} messages. + * @param message LikeMsg message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: SysMsg.ILikeMsg, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LikeMsg message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LikeMsg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): SysMsg.LikeMsg; + + /** + * Decodes a LikeMsg message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LikeMsg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): SysMsg.LikeMsg; + + /** + * Verifies a LikeMsg message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LikeMsg message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LikeMsg + */ + public static fromObject(object: { [k: string]: any }): SysMsg.LikeMsg; + + /** + * Creates a plain object from a LikeMsg message. Also converts values to other types if specified. + * @param message LikeMsg + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: SysMsg.LikeMsg, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LikeMsg to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LikeMsg + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ProfileLikeTip. */ + interface IProfileLikeTip { + + /** ProfileLikeTip msg */ + msg?: (SysMsg.ILikeMsg|null); + } + + /** Represents a ProfileLikeTip. */ + class ProfileLikeTip implements IProfileLikeTip { + + /** + * Constructs a new ProfileLikeTip. + * @param [properties] Properties to set + */ + constructor(properties?: SysMsg.IProfileLikeTip); + + /** ProfileLikeTip msg. */ + public msg?: (SysMsg.ILikeMsg|null); + + /** + * Creates a new ProfileLikeTip instance using the specified properties. + * @param [properties] Properties to set + * @returns ProfileLikeTip instance + */ + public static create(properties?: SysMsg.IProfileLikeTip): SysMsg.ProfileLikeTip; + + /** + * Encodes the specified ProfileLikeTip message. Does not implicitly {@link SysMsg.ProfileLikeTip.verify|verify} messages. + * @param message ProfileLikeTip message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: SysMsg.IProfileLikeTip, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProfileLikeTip message, length delimited. Does not implicitly {@link SysMsg.ProfileLikeTip.verify|verify} messages. + * @param message ProfileLikeTip message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: SysMsg.IProfileLikeTip, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProfileLikeTip message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProfileLikeTip + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): SysMsg.ProfileLikeTip; + + /** + * Decodes a ProfileLikeTip message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProfileLikeTip + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): SysMsg.ProfileLikeTip; + + /** + * Verifies a ProfileLikeTip message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProfileLikeTip message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProfileLikeTip + */ + public static fromObject(object: { [k: string]: any }): SysMsg.ProfileLikeTip; + + /** + * Creates a plain object from a ProfileLikeTip message. Also converts values to other types if specified. + * @param message ProfileLikeTip + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: SysMsg.ProfileLikeTip, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProfileLikeTip to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProfileLikeTip + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } +} diff --git a/src/ntqqapi/proto/compiled.js b/src/ntqqapi/proto/compiled.js new file mode 100644 index 0000000..dd98020 --- /dev/null +++ b/src/ntqqapi/proto/compiled.js @@ -0,0 +1,1851 @@ +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +import * as $protobuf from "protobufjs/minimal"; + +// Common aliases +const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +export const SysMsg = $root.SysMsg = (() => { + + /** + * Namespace SysMsg. + * @exports SysMsg + * @namespace + */ + const SysMsg = {}; + + SysMsg.SystemMessage = (function() { + + /** + * Properties of a SystemMessage. + * @memberof SysMsg + * @interface ISystemMessage + * @property {Array.|null} [header] SystemMessage header + * @property {Array.|null} [msgSpec] SystemMessage msgSpec + * @property {SysMsg.ISystemMessageBodyWrapper|null} [bodyWrapper] SystemMessage bodyWrapper + */ + + /** + * Constructs a new SystemMessage. + * @memberof SysMsg + * @classdesc Represents a SystemMessage. + * @implements ISystemMessage + * @constructor + * @param {SysMsg.ISystemMessage=} [properties] Properties to set + */ + function SystemMessage(properties) { + this.header = []; + this.msgSpec = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SystemMessage header. + * @member {Array.} header + * @memberof SysMsg.SystemMessage + * @instance + */ + SystemMessage.prototype.header = $util.emptyArray; + + /** + * SystemMessage msgSpec. + * @member {Array.} msgSpec + * @memberof SysMsg.SystemMessage + * @instance + */ + SystemMessage.prototype.msgSpec = $util.emptyArray; + + /** + * SystemMessage bodyWrapper. + * @member {SysMsg.ISystemMessageBodyWrapper|null|undefined} bodyWrapper + * @memberof SysMsg.SystemMessage + * @instance + */ + SystemMessage.prototype.bodyWrapper = null; + + /** + * Creates a new SystemMessage instance using the specified properties. + * @function create + * @memberof SysMsg.SystemMessage + * @static + * @param {SysMsg.ISystemMessage=} [properties] Properties to set + * @returns {SysMsg.SystemMessage} SystemMessage instance + */ + SystemMessage.create = function create(properties) { + return new SystemMessage(properties); + }; + + /** + * Encodes the specified SystemMessage message. Does not implicitly {@link SysMsg.SystemMessage.verify|verify} messages. + * @function encode + * @memberof SysMsg.SystemMessage + * @static + * @param {SysMsg.ISystemMessage} message SystemMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SystemMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.header != null && message.header.length) + for (let i = 0; i < message.header.length; ++i) + $root.SysMsg.SystemMessageHeader.encode(message.header[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.msgSpec != null && message.msgSpec.length) + for (let i = 0; i < message.msgSpec.length; ++i) + $root.SysMsg.SystemMessageMsgSpec.encode(message.msgSpec[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bodyWrapper != null && Object.hasOwnProperty.call(message, "bodyWrapper")) + $root.SysMsg.SystemMessageBodyWrapper.encode(message.bodyWrapper, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SystemMessage message, length delimited. Does not implicitly {@link SysMsg.SystemMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof SysMsg.SystemMessage + * @static + * @param {SysMsg.ISystemMessage} message SystemMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SystemMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SystemMessage message from the specified reader or buffer. + * @function decode + * @memberof SysMsg.SystemMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {SysMsg.SystemMessage} SystemMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SystemMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.SysMsg.SystemMessage(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.header && message.header.length)) + message.header = []; + message.header.push($root.SysMsg.SystemMessageHeader.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.msgSpec && message.msgSpec.length)) + message.msgSpec = []; + message.msgSpec.push($root.SysMsg.SystemMessageMsgSpec.decode(reader, reader.uint32())); + break; + } + case 3: { + message.bodyWrapper = $root.SysMsg.SystemMessageBodyWrapper.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SystemMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof SysMsg.SystemMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {SysMsg.SystemMessage} SystemMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SystemMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SystemMessage message. + * @function verify + * @memberof SysMsg.SystemMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SystemMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.header != null && message.hasOwnProperty("header")) { + if (!Array.isArray(message.header)) + return "header: array expected"; + for (let i = 0; i < message.header.length; ++i) { + let error = $root.SysMsg.SystemMessageHeader.verify(message.header[i]); + if (error) + return "header." + error; + } + } + if (message.msgSpec != null && message.hasOwnProperty("msgSpec")) { + if (!Array.isArray(message.msgSpec)) + return "msgSpec: array expected"; + for (let i = 0; i < message.msgSpec.length; ++i) { + let error = $root.SysMsg.SystemMessageMsgSpec.verify(message.msgSpec[i]); + if (error) + return "msgSpec." + error; + } + } + if (message.bodyWrapper != null && message.hasOwnProperty("bodyWrapper")) { + let error = $root.SysMsg.SystemMessageBodyWrapper.verify(message.bodyWrapper); + if (error) + return "bodyWrapper." + error; + } + return null; + }; + + /** + * Creates a SystemMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof SysMsg.SystemMessage + * @static + * @param {Object.} object Plain object + * @returns {SysMsg.SystemMessage} SystemMessage + */ + SystemMessage.fromObject = function fromObject(object) { + if (object instanceof $root.SysMsg.SystemMessage) + return object; + let message = new $root.SysMsg.SystemMessage(); + if (object.header) { + if (!Array.isArray(object.header)) + throw TypeError(".SysMsg.SystemMessage.header: array expected"); + message.header = []; + for (let i = 0; i < object.header.length; ++i) { + if (typeof object.header[i] !== "object") + throw TypeError(".SysMsg.SystemMessage.header: object expected"); + message.header[i] = $root.SysMsg.SystemMessageHeader.fromObject(object.header[i]); + } + } + if (object.msgSpec) { + if (!Array.isArray(object.msgSpec)) + throw TypeError(".SysMsg.SystemMessage.msgSpec: array expected"); + message.msgSpec = []; + for (let i = 0; i < object.msgSpec.length; ++i) { + if (typeof object.msgSpec[i] !== "object") + throw TypeError(".SysMsg.SystemMessage.msgSpec: object expected"); + message.msgSpec[i] = $root.SysMsg.SystemMessageMsgSpec.fromObject(object.msgSpec[i]); + } + } + if (object.bodyWrapper != null) { + if (typeof object.bodyWrapper !== "object") + throw TypeError(".SysMsg.SystemMessage.bodyWrapper: object expected"); + message.bodyWrapper = $root.SysMsg.SystemMessageBodyWrapper.fromObject(object.bodyWrapper); + } + return message; + }; + + /** + * Creates a plain object from a SystemMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof SysMsg.SystemMessage + * @static + * @param {SysMsg.SystemMessage} message SystemMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SystemMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.header = []; + object.msgSpec = []; + } + if (options.defaults) + object.bodyWrapper = null; + if (message.header && message.header.length) { + object.header = []; + for (let j = 0; j < message.header.length; ++j) + object.header[j] = $root.SysMsg.SystemMessageHeader.toObject(message.header[j], options); + } + if (message.msgSpec && message.msgSpec.length) { + object.msgSpec = []; + for (let j = 0; j < message.msgSpec.length; ++j) + object.msgSpec[j] = $root.SysMsg.SystemMessageMsgSpec.toObject(message.msgSpec[j], options); + } + if (message.bodyWrapper != null && message.hasOwnProperty("bodyWrapper")) + object.bodyWrapper = $root.SysMsg.SystemMessageBodyWrapper.toObject(message.bodyWrapper, options); + return object; + }; + + /** + * Converts this SystemMessage to JSON. + * @function toJSON + * @memberof SysMsg.SystemMessage + * @instance + * @returns {Object.} JSON object + */ + SystemMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SystemMessage + * @function getTypeUrl + * @memberof SysMsg.SystemMessage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SystemMessage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/SysMsg.SystemMessage"; + }; + + return SystemMessage; + })(); + + SysMsg.SystemMessageHeader = (function() { + + /** + * Properties of a SystemMessageHeader. + * @memberof SysMsg + * @interface ISystemMessageHeader + * @property {number|null} [peerNumber] SystemMessageHeader peerNumber + * @property {string|null} [peerString] SystemMessageHeader peerString + * @property {number|null} [uin] SystemMessageHeader uin + * @property {string|null} [uid] SystemMessageHeader uid + */ + + /** + * Constructs a new SystemMessageHeader. + * @memberof SysMsg + * @classdesc Represents a SystemMessageHeader. + * @implements ISystemMessageHeader + * @constructor + * @param {SysMsg.ISystemMessageHeader=} [properties] Properties to set + */ + function SystemMessageHeader(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SystemMessageHeader peerNumber. + * @member {number} peerNumber + * @memberof SysMsg.SystemMessageHeader + * @instance + */ + SystemMessageHeader.prototype.peerNumber = 0; + + /** + * SystemMessageHeader peerString. + * @member {string} peerString + * @memberof SysMsg.SystemMessageHeader + * @instance + */ + SystemMessageHeader.prototype.peerString = ""; + + /** + * SystemMessageHeader uin. + * @member {number} uin + * @memberof SysMsg.SystemMessageHeader + * @instance + */ + SystemMessageHeader.prototype.uin = 0; + + /** + * SystemMessageHeader uid. + * @member {string|null|undefined} uid + * @memberof SysMsg.SystemMessageHeader + * @instance + */ + SystemMessageHeader.prototype.uid = null; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SystemMessageHeader.prototype, "_uid", { + get: $util.oneOfGetter($oneOfFields = ["uid"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SystemMessageHeader instance using the specified properties. + * @function create + * @memberof SysMsg.SystemMessageHeader + * @static + * @param {SysMsg.ISystemMessageHeader=} [properties] Properties to set + * @returns {SysMsg.SystemMessageHeader} SystemMessageHeader instance + */ + SystemMessageHeader.create = function create(properties) { + return new SystemMessageHeader(properties); + }; + + /** + * Encodes the specified SystemMessageHeader message. Does not implicitly {@link SysMsg.SystemMessageHeader.verify|verify} messages. + * @function encode + * @memberof SysMsg.SystemMessageHeader + * @static + * @param {SysMsg.ISystemMessageHeader} message SystemMessageHeader message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SystemMessageHeader.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.peerNumber != null && Object.hasOwnProperty.call(message, "peerNumber")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.peerNumber); + if (message.peerString != null && Object.hasOwnProperty.call(message, "peerString")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.peerString); + if (message.uin != null && Object.hasOwnProperty.call(message, "uin")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.uin); + if (message.uid != null && Object.hasOwnProperty.call(message, "uid")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.uid); + return writer; + }; + + /** + * Encodes the specified SystemMessageHeader message, length delimited. Does not implicitly {@link SysMsg.SystemMessageHeader.verify|verify} messages. + * @function encodeDelimited + * @memberof SysMsg.SystemMessageHeader + * @static + * @param {SysMsg.ISystemMessageHeader} message SystemMessageHeader message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SystemMessageHeader.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SystemMessageHeader message from the specified reader or buffer. + * @function decode + * @memberof SysMsg.SystemMessageHeader + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {SysMsg.SystemMessageHeader} SystemMessageHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SystemMessageHeader.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.SysMsg.SystemMessageHeader(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.peerNumber = reader.uint32(); + break; + } + case 2: { + message.peerString = reader.string(); + break; + } + case 5: { + message.uin = reader.uint32(); + break; + } + case 6: { + message.uid = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SystemMessageHeader message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof SysMsg.SystemMessageHeader + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {SysMsg.SystemMessageHeader} SystemMessageHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SystemMessageHeader.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SystemMessageHeader message. + * @function verify + * @memberof SysMsg.SystemMessageHeader + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SystemMessageHeader.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.peerNumber != null && message.hasOwnProperty("peerNumber")) + if (!$util.isInteger(message.peerNumber)) + return "peerNumber: integer expected"; + if (message.peerString != null && message.hasOwnProperty("peerString")) + if (!$util.isString(message.peerString)) + return "peerString: string expected"; + if (message.uin != null && message.hasOwnProperty("uin")) + if (!$util.isInteger(message.uin)) + return "uin: integer expected"; + if (message.uid != null && message.hasOwnProperty("uid")) { + properties._uid = 1; + if (!$util.isString(message.uid)) + return "uid: string expected"; + } + return null; + }; + + /** + * Creates a SystemMessageHeader message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof SysMsg.SystemMessageHeader + * @static + * @param {Object.} object Plain object + * @returns {SysMsg.SystemMessageHeader} SystemMessageHeader + */ + SystemMessageHeader.fromObject = function fromObject(object) { + if (object instanceof $root.SysMsg.SystemMessageHeader) + return object; + let message = new $root.SysMsg.SystemMessageHeader(); + if (object.peerNumber != null) + message.peerNumber = object.peerNumber >>> 0; + if (object.peerString != null) + message.peerString = String(object.peerString); + if (object.uin != null) + message.uin = object.uin >>> 0; + if (object.uid != null) + message.uid = String(object.uid); + return message; + }; + + /** + * Creates a plain object from a SystemMessageHeader message. Also converts values to other types if specified. + * @function toObject + * @memberof SysMsg.SystemMessageHeader + * @static + * @param {SysMsg.SystemMessageHeader} message SystemMessageHeader + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SystemMessageHeader.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.peerNumber = 0; + object.peerString = ""; + object.uin = 0; + } + if (message.peerNumber != null && message.hasOwnProperty("peerNumber")) + object.peerNumber = message.peerNumber; + if (message.peerString != null && message.hasOwnProperty("peerString")) + object.peerString = message.peerString; + if (message.uin != null && message.hasOwnProperty("uin")) + object.uin = message.uin; + if (message.uid != null && message.hasOwnProperty("uid")) { + object.uid = message.uid; + if (options.oneofs) + object._uid = "uid"; + } + return object; + }; + + /** + * Converts this SystemMessageHeader to JSON. + * @function toJSON + * @memberof SysMsg.SystemMessageHeader + * @instance + * @returns {Object.} JSON object + */ + SystemMessageHeader.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SystemMessageHeader + * @function getTypeUrl + * @memberof SysMsg.SystemMessageHeader + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SystemMessageHeader.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/SysMsg.SystemMessageHeader"; + }; + + return SystemMessageHeader; + })(); + + SysMsg.SystemMessageMsgSpec = (function() { + + /** + * Properties of a SystemMessageMsgSpec. + * @memberof SysMsg + * @interface ISystemMessageMsgSpec + * @property {number|null} [msgType] SystemMessageMsgSpec msgType + * @property {number|null} [subType] SystemMessageMsgSpec subType + * @property {number|null} [subSubType] SystemMessageMsgSpec subSubType + * @property {number|null} [msgSeq] SystemMessageMsgSpec msgSeq + * @property {number|null} [time] SystemMessageMsgSpec time + * @property {number|null} [other] SystemMessageMsgSpec other + */ + + /** + * Constructs a new SystemMessageMsgSpec. + * @memberof SysMsg + * @classdesc Represents a SystemMessageMsgSpec. + * @implements ISystemMessageMsgSpec + * @constructor + * @param {SysMsg.ISystemMessageMsgSpec=} [properties] Properties to set + */ + function SystemMessageMsgSpec(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SystemMessageMsgSpec msgType. + * @member {number} msgType + * @memberof SysMsg.SystemMessageMsgSpec + * @instance + */ + SystemMessageMsgSpec.prototype.msgType = 0; + + /** + * SystemMessageMsgSpec subType. + * @member {number} subType + * @memberof SysMsg.SystemMessageMsgSpec + * @instance + */ + SystemMessageMsgSpec.prototype.subType = 0; + + /** + * SystemMessageMsgSpec subSubType. + * @member {number} subSubType + * @memberof SysMsg.SystemMessageMsgSpec + * @instance + */ + SystemMessageMsgSpec.prototype.subSubType = 0; + + /** + * SystemMessageMsgSpec msgSeq. + * @member {number} msgSeq + * @memberof SysMsg.SystemMessageMsgSpec + * @instance + */ + SystemMessageMsgSpec.prototype.msgSeq = 0; + + /** + * SystemMessageMsgSpec time. + * @member {number} time + * @memberof SysMsg.SystemMessageMsgSpec + * @instance + */ + SystemMessageMsgSpec.prototype.time = 0; + + /** + * SystemMessageMsgSpec other. + * @member {number} other + * @memberof SysMsg.SystemMessageMsgSpec + * @instance + */ + SystemMessageMsgSpec.prototype.other = 0; + + /** + * Creates a new SystemMessageMsgSpec instance using the specified properties. + * @function create + * @memberof SysMsg.SystemMessageMsgSpec + * @static + * @param {SysMsg.ISystemMessageMsgSpec=} [properties] Properties to set + * @returns {SysMsg.SystemMessageMsgSpec} SystemMessageMsgSpec instance + */ + SystemMessageMsgSpec.create = function create(properties) { + return new SystemMessageMsgSpec(properties); + }; + + /** + * Encodes the specified SystemMessageMsgSpec message. Does not implicitly {@link SysMsg.SystemMessageMsgSpec.verify|verify} messages. + * @function encode + * @memberof SysMsg.SystemMessageMsgSpec + * @static + * @param {SysMsg.ISystemMessageMsgSpec} message SystemMessageMsgSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SystemMessageMsgSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.msgType != null && Object.hasOwnProperty.call(message, "msgType")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.msgType); + if (message.subType != null && Object.hasOwnProperty.call(message, "subType")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.subType); + if (message.subSubType != null && Object.hasOwnProperty.call(message, "subSubType")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.subSubType); + if (message.msgSeq != null && Object.hasOwnProperty.call(message, "msgSeq")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.msgSeq); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.time); + if (message.other != null && Object.hasOwnProperty.call(message, "other")) + writer.uint32(/* id 13, wireType 0 =*/104).uint32(message.other); + return writer; + }; + + /** + * Encodes the specified SystemMessageMsgSpec message, length delimited. Does not implicitly {@link SysMsg.SystemMessageMsgSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof SysMsg.SystemMessageMsgSpec + * @static + * @param {SysMsg.ISystemMessageMsgSpec} message SystemMessageMsgSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SystemMessageMsgSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SystemMessageMsgSpec message from the specified reader or buffer. + * @function decode + * @memberof SysMsg.SystemMessageMsgSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {SysMsg.SystemMessageMsgSpec} SystemMessageMsgSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SystemMessageMsgSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.SysMsg.SystemMessageMsgSpec(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.msgType = reader.uint32(); + break; + } + case 2: { + message.subType = reader.uint32(); + break; + } + case 3: { + message.subSubType = reader.uint32(); + break; + } + case 5: { + message.msgSeq = reader.uint32(); + break; + } + case 6: { + message.time = reader.uint32(); + break; + } + case 13: { + message.other = reader.uint32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SystemMessageMsgSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof SysMsg.SystemMessageMsgSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {SysMsg.SystemMessageMsgSpec} SystemMessageMsgSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SystemMessageMsgSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SystemMessageMsgSpec message. + * @function verify + * @memberof SysMsg.SystemMessageMsgSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SystemMessageMsgSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.msgType != null && message.hasOwnProperty("msgType")) + if (!$util.isInteger(message.msgType)) + return "msgType: integer expected"; + if (message.subType != null && message.hasOwnProperty("subType")) + if (!$util.isInteger(message.subType)) + return "subType: integer expected"; + if (message.subSubType != null && message.hasOwnProperty("subSubType")) + if (!$util.isInteger(message.subSubType)) + return "subSubType: integer expected"; + if (message.msgSeq != null && message.hasOwnProperty("msgSeq")) + if (!$util.isInteger(message.msgSeq)) + return "msgSeq: integer expected"; + if (message.time != null && message.hasOwnProperty("time")) + if (!$util.isInteger(message.time)) + return "time: integer expected"; + if (message.other != null && message.hasOwnProperty("other")) + if (!$util.isInteger(message.other)) + return "other: integer expected"; + return null; + }; + + /** + * Creates a SystemMessageMsgSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof SysMsg.SystemMessageMsgSpec + * @static + * @param {Object.} object Plain object + * @returns {SysMsg.SystemMessageMsgSpec} SystemMessageMsgSpec + */ + SystemMessageMsgSpec.fromObject = function fromObject(object) { + if (object instanceof $root.SysMsg.SystemMessageMsgSpec) + return object; + let message = new $root.SysMsg.SystemMessageMsgSpec(); + if (object.msgType != null) + message.msgType = object.msgType >>> 0; + if (object.subType != null) + message.subType = object.subType >>> 0; + if (object.subSubType != null) + message.subSubType = object.subSubType >>> 0; + if (object.msgSeq != null) + message.msgSeq = object.msgSeq >>> 0; + if (object.time != null) + message.time = object.time >>> 0; + if (object.other != null) + message.other = object.other >>> 0; + return message; + }; + + /** + * Creates a plain object from a SystemMessageMsgSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof SysMsg.SystemMessageMsgSpec + * @static + * @param {SysMsg.SystemMessageMsgSpec} message SystemMessageMsgSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SystemMessageMsgSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.msgType = 0; + object.subType = 0; + object.subSubType = 0; + object.msgSeq = 0; + object.time = 0; + object.other = 0; + } + if (message.msgType != null && message.hasOwnProperty("msgType")) + object.msgType = message.msgType; + if (message.subType != null && message.hasOwnProperty("subType")) + object.subType = message.subType; + if (message.subSubType != null && message.hasOwnProperty("subSubType")) + object.subSubType = message.subSubType; + if (message.msgSeq != null && message.hasOwnProperty("msgSeq")) + object.msgSeq = message.msgSeq; + if (message.time != null && message.hasOwnProperty("time")) + object.time = message.time; + if (message.other != null && message.hasOwnProperty("other")) + object.other = message.other; + return object; + }; + + /** + * Converts this SystemMessageMsgSpec to JSON. + * @function toJSON + * @memberof SysMsg.SystemMessageMsgSpec + * @instance + * @returns {Object.} JSON object + */ + SystemMessageMsgSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SystemMessageMsgSpec + * @function getTypeUrl + * @memberof SysMsg.SystemMessageMsgSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SystemMessageMsgSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/SysMsg.SystemMessageMsgSpec"; + }; + + return SystemMessageMsgSpec; + })(); + + SysMsg.SystemMessageBodyWrapper = (function() { + + /** + * Properties of a SystemMessageBodyWrapper. + * @memberof SysMsg + * @interface ISystemMessageBodyWrapper + * @property {Uint8Array|null} [body] SystemMessageBodyWrapper body + */ + + /** + * Constructs a new SystemMessageBodyWrapper. + * @memberof SysMsg + * @classdesc Represents a SystemMessageBodyWrapper. + * @implements ISystemMessageBodyWrapper + * @constructor + * @param {SysMsg.ISystemMessageBodyWrapper=} [properties] Properties to set + */ + function SystemMessageBodyWrapper(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SystemMessageBodyWrapper body. + * @member {Uint8Array} body + * @memberof SysMsg.SystemMessageBodyWrapper + * @instance + */ + SystemMessageBodyWrapper.prototype.body = $util.newBuffer([]); + + /** + * Creates a new SystemMessageBodyWrapper instance using the specified properties. + * @function create + * @memberof SysMsg.SystemMessageBodyWrapper + * @static + * @param {SysMsg.ISystemMessageBodyWrapper=} [properties] Properties to set + * @returns {SysMsg.SystemMessageBodyWrapper} SystemMessageBodyWrapper instance + */ + SystemMessageBodyWrapper.create = function create(properties) { + return new SystemMessageBodyWrapper(properties); + }; + + /** + * Encodes the specified SystemMessageBodyWrapper message. Does not implicitly {@link SysMsg.SystemMessageBodyWrapper.verify|verify} messages. + * @function encode + * @memberof SysMsg.SystemMessageBodyWrapper + * @static + * @param {SysMsg.ISystemMessageBodyWrapper} message SystemMessageBodyWrapper message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SystemMessageBodyWrapper.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.body); + return writer; + }; + + /** + * Encodes the specified SystemMessageBodyWrapper message, length delimited. Does not implicitly {@link SysMsg.SystemMessageBodyWrapper.verify|verify} messages. + * @function encodeDelimited + * @memberof SysMsg.SystemMessageBodyWrapper + * @static + * @param {SysMsg.ISystemMessageBodyWrapper} message SystemMessageBodyWrapper message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SystemMessageBodyWrapper.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SystemMessageBodyWrapper message from the specified reader or buffer. + * @function decode + * @memberof SysMsg.SystemMessageBodyWrapper + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {SysMsg.SystemMessageBodyWrapper} SystemMessageBodyWrapper + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SystemMessageBodyWrapper.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.SysMsg.SystemMessageBodyWrapper(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.body = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SystemMessageBodyWrapper message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof SysMsg.SystemMessageBodyWrapper + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {SysMsg.SystemMessageBodyWrapper} SystemMessageBodyWrapper + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SystemMessageBodyWrapper.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SystemMessageBodyWrapper message. + * @function verify + * @memberof SysMsg.SystemMessageBodyWrapper + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SystemMessageBodyWrapper.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.body != null && message.hasOwnProperty("body")) + if (!(message.body && typeof message.body.length === "number" || $util.isString(message.body))) + return "body: buffer expected"; + return null; + }; + + /** + * Creates a SystemMessageBodyWrapper message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof SysMsg.SystemMessageBodyWrapper + * @static + * @param {Object.} object Plain object + * @returns {SysMsg.SystemMessageBodyWrapper} SystemMessageBodyWrapper + */ + SystemMessageBodyWrapper.fromObject = function fromObject(object) { + if (object instanceof $root.SysMsg.SystemMessageBodyWrapper) + return object; + let message = new $root.SysMsg.SystemMessageBodyWrapper(); + if (object.body != null) + if (typeof object.body === "string") + $util.base64.decode(object.body, message.body = $util.newBuffer($util.base64.length(object.body)), 0); + else if (object.body.length >= 0) + message.body = object.body; + return message; + }; + + /** + * Creates a plain object from a SystemMessageBodyWrapper message. Also converts values to other types if specified. + * @function toObject + * @memberof SysMsg.SystemMessageBodyWrapper + * @static + * @param {SysMsg.SystemMessageBodyWrapper} message SystemMessageBodyWrapper + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SystemMessageBodyWrapper.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.body = ""; + else { + object.body = []; + if (options.bytes !== Array) + object.body = $util.newBuffer(object.body); + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = options.bytes === String ? $util.base64.encode(message.body, 0, message.body.length) : options.bytes === Array ? Array.prototype.slice.call(message.body) : message.body; + return object; + }; + + /** + * Converts this SystemMessageBodyWrapper to JSON. + * @function toJSON + * @memberof SysMsg.SystemMessageBodyWrapper + * @instance + * @returns {Object.} JSON object + */ + SystemMessageBodyWrapper.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SystemMessageBodyWrapper + * @function getTypeUrl + * @memberof SysMsg.SystemMessageBodyWrapper + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SystemMessageBodyWrapper.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/SysMsg.SystemMessageBodyWrapper"; + }; + + return SystemMessageBodyWrapper; + })(); + + SysMsg.LikeDetail = (function() { + + /** + * Properties of a LikeDetail. + * @memberof SysMsg + * @interface ILikeDetail + * @property {string|null} [txt] LikeDetail txt + * @property {number|null} [uin] LikeDetail uin + * @property {string|null} [nickname] LikeDetail nickname + */ + + /** + * Constructs a new LikeDetail. + * @memberof SysMsg + * @classdesc Represents a LikeDetail. + * @implements ILikeDetail + * @constructor + * @param {SysMsg.ILikeDetail=} [properties] Properties to set + */ + function LikeDetail(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LikeDetail txt. + * @member {string} txt + * @memberof SysMsg.LikeDetail + * @instance + */ + LikeDetail.prototype.txt = ""; + + /** + * LikeDetail uin. + * @member {number} uin + * @memberof SysMsg.LikeDetail + * @instance + */ + LikeDetail.prototype.uin = 0; + + /** + * LikeDetail nickname. + * @member {string} nickname + * @memberof SysMsg.LikeDetail + * @instance + */ + LikeDetail.prototype.nickname = ""; + + /** + * Creates a new LikeDetail instance using the specified properties. + * @function create + * @memberof SysMsg.LikeDetail + * @static + * @param {SysMsg.ILikeDetail=} [properties] Properties to set + * @returns {SysMsg.LikeDetail} LikeDetail instance + */ + LikeDetail.create = function create(properties) { + return new LikeDetail(properties); + }; + + /** + * Encodes the specified LikeDetail message. Does not implicitly {@link SysMsg.LikeDetail.verify|verify} messages. + * @function encode + * @memberof SysMsg.LikeDetail + * @static + * @param {SysMsg.ILikeDetail} message LikeDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LikeDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.txt != null && Object.hasOwnProperty.call(message, "txt")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.txt); + if (message.uin != null && Object.hasOwnProperty.call(message, "uin")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.uin); + if (message.nickname != null && Object.hasOwnProperty.call(message, "nickname")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.nickname); + return writer; + }; + + /** + * Encodes the specified LikeDetail message, length delimited. Does not implicitly {@link SysMsg.LikeDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof SysMsg.LikeDetail + * @static + * @param {SysMsg.ILikeDetail} message LikeDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LikeDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LikeDetail message from the specified reader or buffer. + * @function decode + * @memberof SysMsg.LikeDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {SysMsg.LikeDetail} LikeDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LikeDetail.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.SysMsg.LikeDetail(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.txt = reader.string(); + break; + } + case 3: { + message.uin = reader.uint32(); + break; + } + case 5: { + message.nickname = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LikeDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof SysMsg.LikeDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {SysMsg.LikeDetail} LikeDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LikeDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LikeDetail message. + * @function verify + * @memberof SysMsg.LikeDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LikeDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.txt != null && message.hasOwnProperty("txt")) + if (!$util.isString(message.txt)) + return "txt: string expected"; + if (message.uin != null && message.hasOwnProperty("uin")) + if (!$util.isInteger(message.uin)) + return "uin: integer expected"; + if (message.nickname != null && message.hasOwnProperty("nickname")) + if (!$util.isString(message.nickname)) + return "nickname: string expected"; + return null; + }; + + /** + * Creates a LikeDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof SysMsg.LikeDetail + * @static + * @param {Object.} object Plain object + * @returns {SysMsg.LikeDetail} LikeDetail + */ + LikeDetail.fromObject = function fromObject(object) { + if (object instanceof $root.SysMsg.LikeDetail) + return object; + let message = new $root.SysMsg.LikeDetail(); + if (object.txt != null) + message.txt = String(object.txt); + if (object.uin != null) + message.uin = object.uin >>> 0; + if (object.nickname != null) + message.nickname = String(object.nickname); + return message; + }; + + /** + * Creates a plain object from a LikeDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof SysMsg.LikeDetail + * @static + * @param {SysMsg.LikeDetail} message LikeDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LikeDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.txt = ""; + object.uin = 0; + object.nickname = ""; + } + if (message.txt != null && message.hasOwnProperty("txt")) + object.txt = message.txt; + if (message.uin != null && message.hasOwnProperty("uin")) + object.uin = message.uin; + if (message.nickname != null && message.hasOwnProperty("nickname")) + object.nickname = message.nickname; + return object; + }; + + /** + * Converts this LikeDetail to JSON. + * @function toJSON + * @memberof SysMsg.LikeDetail + * @instance + * @returns {Object.} JSON object + */ + LikeDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LikeDetail + * @function getTypeUrl + * @memberof SysMsg.LikeDetail + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LikeDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/SysMsg.LikeDetail"; + }; + + return LikeDetail; + })(); + + SysMsg.LikeMsg = (function() { + + /** + * Properties of a LikeMsg. + * @memberof SysMsg + * @interface ILikeMsg + * @property {number|null} [count] LikeMsg count + * @property {number|null} [time] LikeMsg time + * @property {SysMsg.ILikeDetail|null} [detail] LikeMsg detail + */ + + /** + * Constructs a new LikeMsg. + * @memberof SysMsg + * @classdesc Represents a LikeMsg. + * @implements ILikeMsg + * @constructor + * @param {SysMsg.ILikeMsg=} [properties] Properties to set + */ + function LikeMsg(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LikeMsg count. + * @member {number} count + * @memberof SysMsg.LikeMsg + * @instance + */ + LikeMsg.prototype.count = 0; + + /** + * LikeMsg time. + * @member {number} time + * @memberof SysMsg.LikeMsg + * @instance + */ + LikeMsg.prototype.time = 0; + + /** + * LikeMsg detail. + * @member {SysMsg.ILikeDetail|null|undefined} detail + * @memberof SysMsg.LikeMsg + * @instance + */ + LikeMsg.prototype.detail = null; + + /** + * Creates a new LikeMsg instance using the specified properties. + * @function create + * @memberof SysMsg.LikeMsg + * @static + * @param {SysMsg.ILikeMsg=} [properties] Properties to set + * @returns {SysMsg.LikeMsg} LikeMsg instance + */ + LikeMsg.create = function create(properties) { + return new LikeMsg(properties); + }; + + /** + * Encodes the specified LikeMsg message. Does not implicitly {@link SysMsg.LikeMsg.verify|verify} messages. + * @function encode + * @memberof SysMsg.LikeMsg + * @static + * @param {SysMsg.ILikeMsg} message LikeMsg message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LikeMsg.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.count); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.time); + if (message.detail != null && Object.hasOwnProperty.call(message, "detail")) + $root.SysMsg.LikeDetail.encode(message.detail, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LikeMsg message, length delimited. Does not implicitly {@link SysMsg.LikeMsg.verify|verify} messages. + * @function encodeDelimited + * @memberof SysMsg.LikeMsg + * @static + * @param {SysMsg.ILikeMsg} message LikeMsg message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LikeMsg.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LikeMsg message from the specified reader or buffer. + * @function decode + * @memberof SysMsg.LikeMsg + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {SysMsg.LikeMsg} LikeMsg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LikeMsg.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.SysMsg.LikeMsg(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.count = reader.uint32(); + break; + } + case 2: { + message.time = reader.uint32(); + break; + } + case 3: { + message.detail = $root.SysMsg.LikeDetail.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LikeMsg message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof SysMsg.LikeMsg + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {SysMsg.LikeMsg} LikeMsg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LikeMsg.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LikeMsg message. + * @function verify + * @memberof SysMsg.LikeMsg + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LikeMsg.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count)) + return "count: integer expected"; + if (message.time != null && message.hasOwnProperty("time")) + if (!$util.isInteger(message.time)) + return "time: integer expected"; + if (message.detail != null && message.hasOwnProperty("detail")) { + let error = $root.SysMsg.LikeDetail.verify(message.detail); + if (error) + return "detail." + error; + } + return null; + }; + + /** + * Creates a LikeMsg message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof SysMsg.LikeMsg + * @static + * @param {Object.} object Plain object + * @returns {SysMsg.LikeMsg} LikeMsg + */ + LikeMsg.fromObject = function fromObject(object) { + if (object instanceof $root.SysMsg.LikeMsg) + return object; + let message = new $root.SysMsg.LikeMsg(); + if (object.count != null) + message.count = object.count >>> 0; + if (object.time != null) + message.time = object.time >>> 0; + if (object.detail != null) { + if (typeof object.detail !== "object") + throw TypeError(".SysMsg.LikeMsg.detail: object expected"); + message.detail = $root.SysMsg.LikeDetail.fromObject(object.detail); + } + return message; + }; + + /** + * Creates a plain object from a LikeMsg message. Also converts values to other types if specified. + * @function toObject + * @memberof SysMsg.LikeMsg + * @static + * @param {SysMsg.LikeMsg} message LikeMsg + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LikeMsg.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.count = 0; + object.time = 0; + object.detail = null; + } + if (message.count != null && message.hasOwnProperty("count")) + object.count = message.count; + if (message.time != null && message.hasOwnProperty("time")) + object.time = message.time; + if (message.detail != null && message.hasOwnProperty("detail")) + object.detail = $root.SysMsg.LikeDetail.toObject(message.detail, options); + return object; + }; + + /** + * Converts this LikeMsg to JSON. + * @function toJSON + * @memberof SysMsg.LikeMsg + * @instance + * @returns {Object.} JSON object + */ + LikeMsg.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LikeMsg + * @function getTypeUrl + * @memberof SysMsg.LikeMsg + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LikeMsg.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/SysMsg.LikeMsg"; + }; + + return LikeMsg; + })(); + + SysMsg.ProfileLikeTip = (function() { + + /** + * Properties of a ProfileLikeTip. + * @memberof SysMsg + * @interface IProfileLikeTip + * @property {SysMsg.ILikeMsg|null} [msg] ProfileLikeTip msg + */ + + /** + * Constructs a new ProfileLikeTip. + * @memberof SysMsg + * @classdesc Represents a ProfileLikeTip. + * @implements IProfileLikeTip + * @constructor + * @param {SysMsg.IProfileLikeTip=} [properties] Properties to set + */ + function ProfileLikeTip(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProfileLikeTip msg. + * @member {SysMsg.ILikeMsg|null|undefined} msg + * @memberof SysMsg.ProfileLikeTip + * @instance + */ + ProfileLikeTip.prototype.msg = null; + + /** + * Creates a new ProfileLikeTip instance using the specified properties. + * @function create + * @memberof SysMsg.ProfileLikeTip + * @static + * @param {SysMsg.IProfileLikeTip=} [properties] Properties to set + * @returns {SysMsg.ProfileLikeTip} ProfileLikeTip instance + */ + ProfileLikeTip.create = function create(properties) { + return new ProfileLikeTip(properties); + }; + + /** + * Encodes the specified ProfileLikeTip message. Does not implicitly {@link SysMsg.ProfileLikeTip.verify|verify} messages. + * @function encode + * @memberof SysMsg.ProfileLikeTip + * @static + * @param {SysMsg.IProfileLikeTip} message ProfileLikeTip message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProfileLikeTip.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.msg != null && Object.hasOwnProperty.call(message, "msg")) + $root.SysMsg.LikeMsg.encode(message.msg, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProfileLikeTip message, length delimited. Does not implicitly {@link SysMsg.ProfileLikeTip.verify|verify} messages. + * @function encodeDelimited + * @memberof SysMsg.ProfileLikeTip + * @static + * @param {SysMsg.IProfileLikeTip} message ProfileLikeTip message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProfileLikeTip.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProfileLikeTip message from the specified reader or buffer. + * @function decode + * @memberof SysMsg.ProfileLikeTip + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {SysMsg.ProfileLikeTip} ProfileLikeTip + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProfileLikeTip.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.SysMsg.ProfileLikeTip(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 14: { + message.msg = $root.SysMsg.LikeMsg.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProfileLikeTip message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof SysMsg.ProfileLikeTip + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {SysMsg.ProfileLikeTip} ProfileLikeTip + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProfileLikeTip.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProfileLikeTip message. + * @function verify + * @memberof SysMsg.ProfileLikeTip + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProfileLikeTip.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.msg != null && message.hasOwnProperty("msg")) { + let error = $root.SysMsg.LikeMsg.verify(message.msg); + if (error) + return "msg." + error; + } + return null; + }; + + /** + * Creates a ProfileLikeTip message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof SysMsg.ProfileLikeTip + * @static + * @param {Object.} object Plain object + * @returns {SysMsg.ProfileLikeTip} ProfileLikeTip + */ + ProfileLikeTip.fromObject = function fromObject(object) { + if (object instanceof $root.SysMsg.ProfileLikeTip) + return object; + let message = new $root.SysMsg.ProfileLikeTip(); + if (object.msg != null) { + if (typeof object.msg !== "object") + throw TypeError(".SysMsg.ProfileLikeTip.msg: object expected"); + message.msg = $root.SysMsg.LikeMsg.fromObject(object.msg); + } + return message; + }; + + /** + * Creates a plain object from a ProfileLikeTip message. Also converts values to other types if specified. + * @function toObject + * @memberof SysMsg.ProfileLikeTip + * @static + * @param {SysMsg.ProfileLikeTip} message ProfileLikeTip + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProfileLikeTip.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.msg = null; + if (message.msg != null && message.hasOwnProperty("msg")) + object.msg = $root.SysMsg.LikeMsg.toObject(message.msg, options); + return object; + }; + + /** + * Converts this ProfileLikeTip to JSON. + * @function toJSON + * @memberof SysMsg.ProfileLikeTip + * @instance + * @returns {Object.} JSON object + */ + ProfileLikeTip.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ProfileLikeTip + * @function getTypeUrl + * @memberof SysMsg.ProfileLikeTip + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProfileLikeTip.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/SysMsg.ProfileLikeTip"; + }; + + return ProfileLikeTip; + })(); + + return SysMsg; +})(); + +export { $root as default }; diff --git a/src/ntqqapi/proto/profileLikeTip.proto b/src/ntqqapi/proto/profileLikeTip.proto new file mode 100644 index 0000000..7043c30 --- /dev/null +++ b/src/ntqqapi/proto/profileLikeTip.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package SysMsg; + +message LikeDetail { + string txt = 1; + uint32 uin = 3; + string nickname = 5; +} + +message LikeMsg { + uint32 count = 1; + uint32 time = 2; + LikeDetail detail = 3; +} + +message ProfileLikeTip { + LikeMsg msg = 14; +} \ No newline at end of file diff --git a/src/ntqqapi/proto/systemMessage.proto b/src/ntqqapi/proto/systemMessage.proto new file mode 100644 index 0000000..08f9dc3 --- /dev/null +++ b/src/ntqqapi/proto/systemMessage.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package SysMsg; + +message SystemMessage { + repeated SystemMessageHeader header = 1; + repeated SystemMessageMsgSpec msgSpec = 2; + SystemMessageBodyWrapper bodyWrapper = 3; +} + +message SystemMessageHeader { + uint32 peerNumber = 1; + string peerString = 2; + uint32 uin = 5; + optional string uid = 6; +} + +message SystemMessageMsgSpec { + uint32 msgType = 1; + uint32 subType = 2; + uint32 subSubType = 3; + uint32 msgSeq = 5; + uint32 time = 6; + //uint64 msgId = 12; + uint32 other = 13; +} + +message SystemMessageBodyWrapper { + bytes body = 2; + // Find the first [08], or ignore the first 7 bytes? +} \ No newline at end of file diff --git a/src/onebot11/adapter.ts b/src/onebot11/adapter.ts index b3a2bf3..5b9fd32 100644 --- a/src/onebot11/adapter.ts +++ b/src/onebot11/adapter.ts @@ -27,6 +27,8 @@ import { initActionMap } from './action' import { llonebotError } from '../common/globalVars' import { OB11GroupCardEvent } from './event/notice/OB11GroupCardEvent' import { OB11GroupAdminNoticeEvent } from './event/notice/OB11GroupAdminNoticeEvent' +import { OB11ProfileLikeEvent } from './event/notice/OB11ProfileLikeEvent' +import { SysMsg } from '@/ntqqapi/proto/compiled' declare module 'cordis' { interface Context { @@ -410,6 +412,18 @@ class OneBot11Adapter extends Service { this.ctx.on('nt/group-member-info-updated', input => { this.handleGroupMemberInfoUpdated(input.groupCode, input.members) }) + this.ctx.on('nt/system-message-created', input => { + const sysMsg = SysMsg.SystemMessage.decode(input) + const { msgType, subType, subSubType } = sysMsg.msgSpec[0] ?? {} + if (msgType === 528 && subType === 39 && subSubType === 39) { + const tip = SysMsg.ProfileLikeTip.decode(sysMsg.bodyWrapper!.body!.slice(12)) + const detail = tip.msg?.detail + if (!detail) return + const [times] = detail.txt?.match(/\d+/) ?? ['0'] + const profileLikeEvent = new OB11ProfileLikeEvent(detail.uin!, detail.nickname!, +times) + this.dispatch(profileLikeEvent) + } + }) } } diff --git a/src/onebot11/event/notice/OB11ProfileLikeEvent.ts b/src/onebot11/event/notice/OB11ProfileLikeEvent.ts new file mode 100644 index 0000000..2ea20c7 --- /dev/null +++ b/src/onebot11/event/notice/OB11ProfileLikeEvent.ts @@ -0,0 +1,16 @@ +import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent' + +export class OB11ProfileLikeEvent extends OB11BaseNoticeEvent { + notice_type = 'notify' + sub_type = 'profile_like' + operator_id: number + operator_nick: string + times: number + + constructor(operatorId: number, operatorNick: string, times: number) { + super() + this.operator_id = operatorId + this.operator_nick = operatorNick + this.times = times + } +} \ No newline at end of file From 692ba5163e9438a620d2d365e0ce5891efb3d966 Mon Sep 17 00:00:00 2001 From: idranme Date: Wed, 11 Sep 2024 20:52:16 +0800 Subject: [PATCH 4/4] chore: v3.32.3 --- manifest.json | 2 +- src/version.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index b8b0d09..109db1f 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "LLOneBot", "slug": "LLOneBot", "description": "实现 OneBot 11 协议,用于 QQ 机器人开发", - "version": "3.32.2", + "version": "3.32.3", "icon": "./icon.webp", "authors": [ { diff --git a/src/version.ts b/src/version.ts index 7327089..8a9b11b 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const version = '3.32.2' +export const version = '3.32.3'