From d4a8ed735ed5ca770312dead5ae96328ac7d06c7 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: Fri, 14 Feb 2025 14:48:36 +0800 Subject: [PATCH] fix: #789 --- src/onebot/action/group/SetGroupBan.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/onebot/action/group/SetGroupBan.ts b/src/onebot/action/group/SetGroupBan.ts index 120dfe45..4fd22f35 100644 --- a/src/onebot/action/group/SetGroupBan.ts +++ b/src/onebot/action/group/SetGroupBan.ts @@ -17,8 +17,10 @@ export default class SetGroupBan extends OneBotAction { async _handle(payload: Payload): Promise { const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString()); if (!uid) throw new Error('uid error'); - await this.core.apis.GroupApi.banMember(payload.group_id.toString(), + // 例如无管理员权限时 result: 120101005 errMsg: 'ERR_NOT_GROUP_ADMIN' + let ret = await this.core.apis.GroupApi.banMember(payload.group_id.toString(), [{ uid: uid, timeStamp: +payload.duration }]); + if (ret.result !== 0) throw new Error(ret.errMsg); return null; } }