From bdec16266e298a26b71b83281bb8e3cf1d03e8bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Wed, 6 Nov 2024 14:42:05 +0800 Subject: [PATCH] fix: #498 --- src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts b/src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts index e770cb09..ea1b4c53 100644 --- a/src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts +++ b/src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts @@ -6,10 +6,15 @@ const SchemaData = { type: 'object', properties: { friend_id: { type: ['string', 'number'] }, + user_id: { type: ['string', 'number'] }, temp_block: { type: 'boolean' }, temp_both_del: { type: 'boolean' }, }, - required: ['friend_id'], + oneOf: [ + { required: ['friend_id'] }, + { required: ['user_id'] }, + ], + } as const satisfies JSONSchema; type Payload = FromSchema; @@ -18,7 +23,8 @@ export class GoCQHTTPDeleteFriend extends BaseAction { payloadSchema = SchemaData; async _handle(payload: Payload) { - const uid = await this.core.apis.UserApi.getUidByUinV2(payload.friend_id.toString()); + const uin = payload.friend_id ?? payload.user_id ?? ''; + const uid = await this.core.apis.UserApi.getUidByUinV2(uin.toString()); if (!uid) { return {