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

Merge pull request #778 from Yiwen-Chan/dev

fix: send temp message
This commit is contained in:
Mrs4s 2021-04-02 12:54:17 +08:00 committed by GitHub
commit f0bcc8071e
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 { // 临时会话 } else if code, ok := bot.tempMsgCache.Load(target); ok || groupID != 0 { // 临时会话
switch { switch {
case bot.Client.FindGroup(groupID) == nil: case groupID != 0 && bot.Client.FindGroup(groupID) == nil:
log.Errorf("错误: 找不到群(%v)", groupID) log.Errorf("错误: 找不到群(%v)", groupID)
id = -1 id = -1
case groupID != 0 && !bot.Client.FindGroup(groupID).AdministratorOrOwner(): 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) log.Errorf("错误: 群员(%v) 不在 群(%v), 无法发起临时会话", target, groupID)
id = -1 id = -1
default: default:
if code != nil { if code != nil && groupID == 0 {
groupID = code.(int64) groupID = code.(int64)
} }
msg := bot.Client.SendTempMessage(groupID, target, m) msg := bot.Client.SendTempMessage(groupID, target, m)