From a3ad233cd99143916fe94459296da0dadd61f1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Tue, 1 Aug 2023 08:55:59 +0800 Subject: [PATCH] fix: group not found report (#2312) (#2337) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决以下问题: 当群组踢人时,该人不在群内,返回“群聊不存在”的BUG https://github.com/Mrs4s/go-cqhttp/issues/1774#issue-1459854639 Co-authored-by: PSoul --- coolq/api.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coolq/api.go b/coolq/api.go index a1e6fc0..39815e2 100644 --- a/coolq/api.go +++ b/coolq/api.go @@ -1149,7 +1149,9 @@ func (bot *CQBot) CQDelGroupMemo(groupID int64, fid string) global.MSG { // @rename(msg->message, block->reject_add_request) func (bot *CQBot) CQSetGroupKick(groupID int64, userID int64, msg string, block bool) global.MSG { if g := bot.Client.FindGroup(groupID); g != nil { - if m := g.FindMember(userID); m != nil { + if m := g.FindMember(userID); m == nil { + return Failed(100, "MEMBER_IS_NOT_IN_GROUP", "人员不存在") + } else { err := m.Kick(msg, block) if err != nil { return Failed(100, "NOT_MANAGEABLE", "机器人权限不足")