1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 03:23:49 +08:00

fix: group not found report (#2312) (#2337)

解决以下问题:
当群组踢人时,该人不在群内,返回“群聊不存在”的BUG

https://github.com/Mrs4s/go-cqhttp/issues/1774#issue-1459854639

Co-authored-by: PSoul <psoul1@163.com>
This commit is contained in:
源文雨 2023-08-01 08:55:59 +08:00 committed by GitHub
parent aa3a5d28da
commit a3ad233cd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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", "机器人权限不足")