This commit is contained in:
手瓜一十雪 2024-10-12 15:34:10 +08:00
parent 968bd7a437
commit 8f4f898675
3 changed files with 30 additions and 4 deletions

View File

@ -53,7 +53,7 @@ export class NTQQGroupApi {
uids, uids,
); );
} }
async sendPacketPoke(group: string, peer: string) { async sendPacketPoke(group: number, peer: number) {
let data = encodeGroupPoke(group, peer); let data = encodeGroupPoke(group, peer);
let hex = Buffer.from(data).toString('hex'); let hex = Buffer.from(data).toString('hex');
let retdata = await this.core.apis.PacketApi.sendPacket('OidbSvcTrpcTcp.0xed3_1', hex, false); let retdata = await this.core.apis.PacketApi.sendPacket('OidbSvcTrpcTcp.0xed3_1', hex, false);

View File

@ -14,11 +14,11 @@ export const OidbSvcTrpcTcp0XED3_1 = new MessageType("oidb_svc_trpctcp_0xed3_1",
{ no: 6, name: "ext", kind: "scalar", T: ScalarType.UINT32 } { no: 6, name: "ext", kind: "scalar", T: ScalarType.UINT32 }
]); ]);
export function encodeGroupPoke(groupUin: string, PeerUin: string) { export function encodeGroupPoke(groupUin: number, PeerUin: number) {
let Body = OidbSvcTrpcTcp0XED3_1.toBinary let Body = OidbSvcTrpcTcp0XED3_1.toBinary
({ ({
uin: parseInt(PeerUin), uin: PeerUin,
groupuin: parseInt(groupUin), groupuin: groupUin,
ext: 0 ext: 0
}); });
//console.log(Body) //console.log(Body)

View File

@ -0,0 +1,26 @@
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
// no_cache get时传字符串
const SchemaData = {
type: 'object',
properties: {
group_id: { type: ['number', 'string'] },
user_id: { type: ['number', 'string'] },
},
required: ['group_id', 'user_id'],
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
export class GroupPoke extends BaseAction<Payload, any> {
actionName = ActionName.GetGroupList;
payloadSchema = SchemaData;
async _handle(payload: Payload) {
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);
}
}