mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-26 02:12:50 +08:00
27 lines
828 B
TypeScript
27 lines
828 B
TypeScript
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|
import BaseAction from '../BaseAction';
|
|
import { ActionName } from '../types';
|
|
import { NTQQFriendApi } from '@/core/apis/friend';
|
|
|
|
const SchemaData = {
|
|
type: 'object',
|
|
properties: {
|
|
flag: { type: 'string' },
|
|
approve: { type: ['string', 'boolean'] },
|
|
remark: { type: 'string' }
|
|
},
|
|
required: ['flag']
|
|
} as const satisfies JSONSchema;
|
|
|
|
type Payload = FromSchema<typeof SchemaData>;
|
|
|
|
export default class SetFriendAddRequest extends BaseAction<Payload, null> {
|
|
actionName = ActionName.SetFriendAddRequest;
|
|
PayloadSchema = SchemaData;
|
|
protected async _handle(payload: Payload): Promise<null> {
|
|
const approve = payload.approve?.toString() !== 'false';
|
|
await NTQQFriendApi.handleFriendRequest(payload.flag, approve);
|
|
return null;
|
|
}
|
|
}
|