From cebf9c25e1262f0093abc317c0c99f93400e7934 Mon Sep 17 00:00:00 2001 From: Kanri Date: Fri, 2 Apr 2021 12:40:46 +0800 Subject: [PATCH] fix: send temp message --- coolq/bot.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coolq/bot.go b/coolq/bot.go index 1ef417f..afafa59 100644 --- a/coolq/bot.go +++ b/coolq/bot.go @@ -299,7 +299,7 @@ func (bot *CQBot) SendPrivateMessage(target int64, groupID int64, m *message.Sen } } else if code, ok := bot.tempMsgCache.Load(target); ok || groupID != 0 { // 临时会话 switch { - case bot.Client.FindGroup(groupID) == nil: + case groupID != 0 && bot.Client.FindGroup(groupID) == nil: log.Errorf("错误: 找不到群(%v)", groupID) id = -1 case groupID != 0 && !bot.Client.FindGroup(groupID).AdministratorOrOwner(): @@ -309,7 +309,7 @@ func (bot *CQBot) SendPrivateMessage(target int64, groupID int64, m *message.Sen log.Errorf("错误: 群员(%v) 不在 群(%v), 无法发起临时会话", target, groupID) id = -1 default: - if code != nil { + if code != nil && groupID == 0 { groupID = code.(int64) } msg := bot.Client.SendTempMessage(groupID, target, m)