From 2febee01d928a38bbeaa8652216c7263d1d3cf70 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 13 Mar 2021 13:24:21 +0800 Subject: [PATCH] Fixes #717 --- coolq/bot.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coolq/bot.go b/coolq/bot.go index a8b4e97..6980c2e 100644 --- a/coolq/bot.go +++ b/coolq/bot.go @@ -295,7 +295,10 @@ func (bot *CQBot) SendPrivateMessage(target int64, groupId int64, m *message.Sen id = bot.InsertPrivateMessage(msg) } } else if code, ok := bot.tempMsgCache.Load(target); ok || groupId != 0 { // 临时会话 - if groupId != 0 && !bot.Client.FindGroup(groupId).AdministratorOrOwner() { + if bot.Client.FindGroup(groupId) == nil { + log.Errorf("错误: 找不到群(%v)", groupId) + id = -1 + } else if groupId != 0 && !bot.Client.FindGroup(groupId).AdministratorOrOwner() { log.Errorf("错误: 机器人在群(%v) 为非管理员或群主, 无法主动发起临时会话", groupId) id = -1 } else if groupId != 0 && bot.Client.FindGroup(groupId).FindMember(target) == nil {