This commit is contained in:
idranme 2024-09-14 19:56:46 +08:00
parent 6be0c11ca2
commit cad09b2ed1
No known key found for this signature in database
GPG Key ID: 926F7B5B668E495F
4 changed files with 207 additions and 20 deletions

@ -363,11 +363,63 @@ export namespace SysMsg {
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a ProfileLikeSubTip. */
interface IProfileLikeSubTip {
/** ProfileLikeSubTip msg */
msg?: (SysMsg.ILikeMsg|null);
}
/** Represents a ProfileLikeSubTip. */
class ProfileLikeSubTip implements IProfileLikeSubTip {
/**
* Constructs a new ProfileLikeSubTip.
* @param [properties] Properties to set
*/
constructor(properties?: SysMsg.IProfileLikeSubTip);
/** ProfileLikeSubTip msg. */
public msg?: (SysMsg.ILikeMsg|null);
/**
* Decodes a ProfileLikeSubTip message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns ProfileLikeSubTip
* @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.ProfileLikeSubTip;
/**
* Decodes a ProfileLikeSubTip message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns ProfileLikeSubTip
* @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.ProfileLikeSubTip;
/**
* Gets the default type url for ProfileLikeSubTip
* @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);
/** ProfileLikeTip msgType */
msgType?: (number|null);
/** ProfileLikeTip subType */
subType?: (number|null);
/** ProfileLikeTip content */
content?: (SysMsg.IProfileLikeSubTip|null);
}
/** Represents a ProfileLikeTip. */
@ -379,8 +431,14 @@ export namespace SysMsg {
*/
constructor(properties?: SysMsg.IProfileLikeTip);
/** ProfileLikeTip msg. */
public msg?: (SysMsg.ILikeMsg|null);
/** ProfileLikeTip msgType. */
public msgType: number;
/** ProfileLikeTip subType. */
public subType: number;
/** ProfileLikeTip content. */
public content?: (SysMsg.IProfileLikeSubTip|null);
/**
* Decodes a ProfileLikeTip message from the specified reader or buffer.

@ -789,13 +789,111 @@ export const SysMsg = $root.SysMsg = (() => {
return LikeMsg;
})();
SysMsg.ProfileLikeSubTip = (function() {
/**
* Properties of a ProfileLikeSubTip.
* @memberof SysMsg
* @interface IProfileLikeSubTip
* @property {SysMsg.ILikeMsg|null} [msg] ProfileLikeSubTip msg
*/
/**
* Constructs a new ProfileLikeSubTip.
* @memberof SysMsg
* @classdesc Represents a ProfileLikeSubTip.
* @implements IProfileLikeSubTip
* @constructor
* @param {SysMsg.IProfileLikeSubTip=} [properties] Properties to set
*/
function ProfileLikeSubTip(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]];
}
/**
* ProfileLikeSubTip msg.
* @member {SysMsg.ILikeMsg|null|undefined} msg
* @memberof SysMsg.ProfileLikeSubTip
* @instance
*/
ProfileLikeSubTip.prototype.msg = null;
/**
* Decodes a ProfileLikeSubTip message from the specified reader or buffer.
* @function decode
* @memberof SysMsg.ProfileLikeSubTip
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {SysMsg.ProfileLikeSubTip} ProfileLikeSubTip
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ProfileLikeSubTip.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.ProfileLikeSubTip();
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 ProfileLikeSubTip message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof SysMsg.ProfileLikeSubTip
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {SysMsg.ProfileLikeSubTip} ProfileLikeSubTip
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ProfileLikeSubTip.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Gets the default type url for ProfileLikeSubTip
* @function getTypeUrl
* @memberof SysMsg.ProfileLikeSubTip
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
ProfileLikeSubTip.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/SysMsg.ProfileLikeSubTip";
};
return ProfileLikeSubTip;
})();
SysMsg.ProfileLikeTip = (function() {
/**
* Properties of a ProfileLikeTip.
* @memberof SysMsg
* @interface IProfileLikeTip
* @property {SysMsg.ILikeMsg|null} [msg] ProfileLikeTip msg
* @property {number|null} [msgType] ProfileLikeTip msgType
* @property {number|null} [subType] ProfileLikeTip subType
* @property {SysMsg.IProfileLikeSubTip|null} [content] ProfileLikeTip content
*/
/**
@ -814,12 +912,28 @@ export const SysMsg = $root.SysMsg = (() => {
}
/**
* ProfileLikeTip msg.
* @member {SysMsg.ILikeMsg|null|undefined} msg
* ProfileLikeTip msgType.
* @member {number} msgType
* @memberof SysMsg.ProfileLikeTip
* @instance
*/
ProfileLikeTip.prototype.msg = null;
ProfileLikeTip.prototype.msgType = 0;
/**
* ProfileLikeTip subType.
* @member {number} subType
* @memberof SysMsg.ProfileLikeTip
* @instance
*/
ProfileLikeTip.prototype.subType = 0;
/**
* ProfileLikeTip content.
* @member {SysMsg.IProfileLikeSubTip|null|undefined} content
* @memberof SysMsg.ProfileLikeTip
* @instance
*/
ProfileLikeTip.prototype.content = null;
/**
* Decodes a ProfileLikeTip message from the specified reader or buffer.
@ -839,8 +953,16 @@ export const SysMsg = $root.SysMsg = (() => {
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 14: {
message.msg = $root.SysMsg.LikeMsg.decode(reader, reader.uint32());
case 1: {
message.msgType = reader.uint32();
break;
}
case 2: {
message.subType = reader.uint32();
break;
}
case 203: {
message.content = $root.SysMsg.ProfileLikeSubTip.decode(reader, reader.uint32());
break;
}
default:

@ -2,17 +2,23 @@ syntax = "proto3";
package SysMsg;
message LikeDetail {
string txt = 1;
uint32 uin = 3;
string nickname = 5;
string txt = 1;
uint32 uin = 3;
string nickname = 5;
}
message LikeMsg {
uint32 count = 1;
uint32 time = 2;
LikeDetail detail = 3;
uint32 count = 1;
uint32 time = 2;
LikeDetail detail = 3;
}
message ProfileLikeSubTip {
LikeMsg msg = 14;
}
message ProfileLikeTip {
LikeMsg msg = 14;
}
uint32 msgType = 1;
uint32 subType = 2;
ProfileLikeSubTip content = 203;
}

@ -419,8 +419,9 @@ class OneBot11Adapter extends Service {
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
const tip = SysMsg.ProfileLikeTip.decode(sysMsg.bodyWrapper!.body!)
if (tip.msgType !== 0 || tip.subType !== 203) return
const detail = tip.content?.msg?.detail
if (!detail) return
const [times] = detail.txt?.match(/\d+/) ?? ['0']
const profileLikeEvent = new OB11ProfileLikeEvent(detail.uin!, detail.nickname!, +times)