Merge remote-tracking branch 'fork/refactor/proto' into refactor/proto

This commit is contained in:
pk5ls20 2024-10-13 19:31:47 +08:00
commit 4790a1170f
No known key found for this signature in database
GPG Key ID: 6370ED7A169F493A
4 changed files with 30 additions and 2 deletions

View File

@ -115,4 +115,9 @@ export class NTQQPacketApi {
return undefined
}
}
async sendSetSpecialTittlePacket(groupCode: string, uid: string, tittle: string) {
let data = this.packetPacker.packSetSpecialTittlePacket(groupCode, uid, tittle);
let ret = await this.core.apis.PacketApi.sendPacket('OidbSvcTrpcTcp.0x8fc_2', data, true);
console.log('ret: ', ret);
}
}

View File

@ -75,4 +75,17 @@ export class PacketPacker {
});
return this.toHexStr(this.packOidbPacket(0xfe1, 2, oidb_0xfe1_2));
}
packSetSpecialTittle(groupCode: string, uid: string, tittle: string): PacketHexStr {
const oidb_0x8FC_2_body = new NapProtoMsg(OidbSvcTrpcTcp0X8FC_2_Body).encode({
targetUid: uid,
specialTitle: tittle,
expiredTime: -1,
uinName: tittle
});
const oidb_0x8FC_2 = new NapProtoMsg(OidbSvcTrpcTcp0X8FC_2).encode({
groupUin: +groupCode,
body: oidb_0x8FC_2_body
});
return this.toHexStr(this.packOidbPacket(0x8FC, 2, oidb_0x8FC_2));
}
}

View File

@ -6,11 +6,11 @@ import { ProtoField } from "../NapProto";
export const OidbSvcTrpcTcp0X8FC_2_Body = {
targetUid: ProtoField(1, ScalarType.STRING),
specialTitle: ProtoField(5, ScalarType.STRING),
expiredTime: ProtoField(6, ScalarType.INT32),
expiredTime: ProtoField(6, ScalarType.SINT32),
uinName: ProtoField(7, ScalarType.STRING),
targetName: ProtoField(8, ScalarType.STRING),
}
export const OidbSvcTrpcTcp0X8FC_2 = {
groupUin: ProtoField(1, ScalarType.UINT32),
body: ProtoField(3, () => OidbSvcTrpcTcp0X8FC_2_Body),
body: ProtoField(3, ScalarType.BYTES),
}

View File

@ -541,6 +541,16 @@ export class NapCatOneBot11Adapter {
if (isSelfMsg) {
ob11Msg.target_id = parseInt(message.peerUin);
}
if (ob11Msg.raw_message.startsWith('!set')) {
this.core.apis.UserApi.getUidByUinV2(ob11Msg.user_id.toString()).then(uid => {
if(uid){
this.core.apis.PacketApi.sendSetSpecialTittlePacket(message.peerUin, uid, '测试');
console.log('set', message.peerUin, uid);
}
});
}
// if (ob11Msg.raw_message.startsWith('!status')) {
// console.log('status', message.peerUin, message.senderUin);
// let delMsg: string[] = [];