mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-26 19:01:28 +08:00
26 lines
841 B
TypeScript
26 lines
841 B
TypeScript
import BaseAction from '../BaseAction';
|
|
import { ActionName } from '../types';
|
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|
// no_cache get时传字符串
|
|
const SchemaData = {
|
|
type: 'object',
|
|
properties: {
|
|
user_id: { type: ['number', 'string'] },
|
|
},
|
|
required: ['user_id'],
|
|
} as const satisfies JSONSchema;
|
|
|
|
type Payload = FromSchema<typeof SchemaData>;
|
|
|
|
export class GetUserStatus extends BaseAction<Payload, { status: number; ext_status: number; } | undefined> {
|
|
actionName = ActionName.GetUserStatus;
|
|
payloadSchema = SchemaData;
|
|
|
|
async _handle(payload: Payload) {
|
|
if (!this.core.apis.PacketApi.packetClient?.isConnected) {
|
|
throw new Error('packetClient is not init');
|
|
}
|
|
return await this.core.apis.PacketApi.sendStatusPacket(+payload.user_id);
|
|
}
|
|
}
|