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

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);
}
}