mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat & fix: feat proto & revert NapProto
changes
This commit is contained in:
parent
b4e22a345d
commit
d21da47a7d
@ -55,8 +55,8 @@ export class NTQQGroupApi {
|
||||
);
|
||||
}
|
||||
async sendPocketRkey() {
|
||||
let hex = '08E7A00210CA01221D0A130A05080110CA011206A80602B006011A0208022206080A081408022A006001';
|
||||
let ret = await this.core.apis.PacketApi.sendPacket('OidbSvcTrpcTcp.0x9067_202', hex, true);
|
||||
let u8 = await this.core.apis.PacketApi.buildRkeyPacket()
|
||||
let ret = await this.core.apis.PacketApi.sendPacket('OidbSvcTrpcTcp.0x9067_202', Buffer.from(u8).toString('hex'), true);
|
||||
//console.log('ret: ', ret);
|
||||
}
|
||||
async sendPacketPoke(group: number, peer: number) {
|
||||
|
@ -76,18 +76,20 @@ export class NTQQPacketApi {
|
||||
reqHead: {
|
||||
common: {
|
||||
requestId: 1,
|
||||
command: 2
|
||||
command: 202
|
||||
},
|
||||
scene: {
|
||||
requestType: 2,
|
||||
businessType: 1,
|
||||
sceneType: 0
|
||||
},
|
||||
clent: {
|
||||
client: {
|
||||
agentType: 2
|
||||
}
|
||||
},
|
||||
downloadRKeyReq: [[{ key: 10 }, { key: 20 }], { key: 2 }],
|
||||
downloadRKeyReq: {
|
||||
key: [10, 20, 2]
|
||||
},
|
||||
});
|
||||
let oidb_packet = new NapProtoMsg(OidbSvcTrpcTcpBase).encode({
|
||||
command: 0x9067,
|
||||
@ -149,4 +151,4 @@ export class NTQQPacketApi {
|
||||
}
|
||||
return { status: status, ext_status: 0 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { MessageType, RepeatType, ScalarType } from '@protobuf-ts/runtime';
|
||||
import { MessageType, PartialMessage, RepeatType, ScalarType } from '@protobuf-ts/runtime';
|
||||
import { PartialFieldInfo } from "@protobuf-ts/runtime/build/types/reflection-info";
|
||||
|
||||
type LowerCamelCase<S extends string> = CamelCaseHelper<S, false, true>;
|
||||
@ -122,7 +122,7 @@ export class NapProtoMsg<T extends ProtoMessageType> {
|
||||
no: field.no,
|
||||
name: key,
|
||||
kind: 'message',
|
||||
repeat: field.repeat ? RepeatType.UNPACKED : RepeatType.NO,
|
||||
repeat: field.repeat ? RepeatType.PACKED : RepeatType.NO,
|
||||
T: () => rt,
|
||||
};
|
||||
}
|
||||
@ -131,7 +131,7 @@ export class NapProtoMsg<T extends ProtoMessageType> {
|
||||
}
|
||||
|
||||
encode(data: ProtoStructType<T, true>): Uint8Array {
|
||||
return this._proto_msg.toBinary(data)
|
||||
return this._proto_msg.toBinary(this._proto_msg.create(data as PartialMessage<ProtoStructType<T, boolean>>));
|
||||
}
|
||||
|
||||
decode(data: Uint8Array): ProtoStructType<T, false> {
|
||||
|
@ -4,8 +4,8 @@ import { MultiMediaReqHead } from "./common/Ntv2.RichMedia";
|
||||
|
||||
export const OidbSvcTrpcTcp0X9067_202 = {
|
||||
ReqHead: ProtoField(1, () => MultiMediaReqHead),
|
||||
DownloadRKeyReq: ProtoField(4, () => OidbSvcTrpcTcp0X9067_202Key, true, false),
|
||||
DownloadRKeyReq: ProtoField(4, () => OidbSvcTrpcTcp0X9067_202Key),
|
||||
}
|
||||
export const OidbSvcTrpcTcp0X9067_202Key = {
|
||||
key: ProtoField(1, ScalarType.UINT32)
|
||||
key: ProtoField(1, ScalarType.INT32, false, true),
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export const NTV2RichMediaReq = {
|
||||
export const MultiMediaReqHead = {
|
||||
Common: ProtoField(1, () => CommonHead),
|
||||
Scene: ProtoField(2, () => SceneInfo),
|
||||
Clent: ProtoField(3, () => ClientMeta),
|
||||
Client: ProtoField(3, () => ClientMeta),
|
||||
}
|
||||
export const CommonHead = {
|
||||
RequestId: ProtoField(1, ScalarType.UINT32),
|
||||
@ -19,6 +19,9 @@ export const SceneInfo = {
|
||||
BusinessType: ProtoField(102, ScalarType.UINT32),
|
||||
SceneType: ProtoField(200, ScalarType.UINT32),
|
||||
}
|
||||
export const ClientMeta = {
|
||||
AgentType: ProtoField(1, ScalarType.UINT32),
|
||||
}
|
||||
export const C2CUserInfo = {
|
||||
AccountType: ProtoField(1, ScalarType.UINT32),
|
||||
TargetUid: ProtoField(2, ScalarType.STRING),
|
||||
@ -26,9 +29,6 @@ export const C2CUserInfo = {
|
||||
export const GroupInfo = {
|
||||
GroupUin: ProtoField(1, ScalarType.UINT32),
|
||||
}
|
||||
export const ClientMeta = {
|
||||
AgentType: ProtoField(1, ScalarType.UINT32),
|
||||
}
|
||||
export const DownloadReq = {
|
||||
Node: ProtoField(1, ScalarType.BYTES),
|
||||
Download: ProtoField(2, ScalarType.BYTES),
|
||||
|
@ -21,6 +21,6 @@ export class GroupPoke extends BaseAction<Payload, any> {
|
||||
if (!this.core.apis.PacketApi.PacketClient?.isConnected) {
|
||||
throw new Error('PacketClient is not init');
|
||||
}
|
||||
this.core.apis.GroupApi.sendPacketPoke(+payload.group_id, +payload.user_id);
|
||||
await this.core.apis.GroupApi.sendPacketPoke(+payload.group_id, +payload.user_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user