mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-27 03:11:21 +08:00
* feat: pnpm new * Refactor build and release workflows, update dependencies Switch build scripts and workflows from npm to pnpm, update build and artifact paths, and simplify release workflow by removing version detection and changelog steps. Add new dependencies (silk-wasm, express, ws, node-pty-prebuilt-multiarch), update exports in package.json files, and add vite config for napcat-framework. Also, rename manifest.json for framework package and fix static asset copying in shell build config.
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { Static, Type } from '@sinclair/typebox';
|
|
|
|
const SchemaData = Type.Object({
|
|
friend_id: Type.Optional(Type.Union([Type.String(), Type.Number()])),
|
|
user_id: Type.Optional(Type.Union([Type.String(), Type.Number()])),
|
|
temp_block: Type.Optional(Type.Boolean()),
|
|
temp_both_del: Type.Optional(Type.Boolean()),
|
|
});
|
|
|
|
type Payload = Static<typeof SchemaData>;
|
|
|
|
export class GoCQHTTPDeleteFriend extends OneBotAction<Payload, unknown> {
|
|
override actionName = ActionName.GoCQHTTP_DeleteFriend;
|
|
override payloadSchema = SchemaData;
|
|
|
|
async _handle (payload: Payload) {
|
|
const uin = payload.friend_id ?? payload.user_id ?? '';
|
|
const uid = await this.core.apis.UserApi.getUidByUinV2(uin.toString());
|
|
|
|
if (!uid) {
|
|
return {
|
|
valid: false,
|
|
message: '好友不存在',
|
|
};
|
|
}
|
|
const isBuddy = await this.core.apis.FriendApi.isBuddy(uid);
|
|
if (!isBuddy) {
|
|
return {
|
|
valid: false,
|
|
message: '不是好友',
|
|
};
|
|
}
|
|
return await this.core.apis.FriendApi.delBuudy(uid, payload.temp_block, payload.temp_both_del);
|
|
}
|
|
}
|