Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed Oct 12, 2024
1 parent 968bd7a commit 8f4f898
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/apis/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class NTQQGroupApi {
uids,
);
}
async sendPacketPoke(group: string, peer: string) {
async sendPacketPoke(group: number, peer: number) {
let data = encodeGroupPoke(group, peer);
let hex = Buffer.from(data).toString('hex');
let retdata = await this.core.apis.PacketApi.sendPacket('OidbSvcTrpcTcp.0xed3_1', hex, false);
Expand Down
6 changes: 3 additions & 3 deletions src/core/proto/Poke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export const OidbSvcTrpcTcp0XED3_1 = new MessageType("oidb_svc_trpctcp_0xed3_1",
{ 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
({
uin: parseInt(PeerUin),
groupuin: parseInt(groupUin),
uin: PeerUin,
groupuin: groupUin,
ext: 0
});
//console.log(Body)
Expand Down
26 changes: 26 additions & 0 deletions src/onebot/action/group/GroupPoke.ts
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 8f4f898

Please sign in to comment.