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

fix: send temp message

This commit is contained in:
Kanri 2021-04-02 12:40:46 +08:00 committed by GitHub
parent daec9cf12c
commit cebf9c25e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)