mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 11:33:48 +08:00
fix: send temp message
(cherry picked from commit cebf9c25e1262f0093abc317c0c99f93400e7934)
This commit is contained in:
parent
c24a2b327a
commit
2f227842f7
21
coolq/bot.go
21
coolq/bot.go
@ -294,19 +294,20 @@ func (bot *CQBot) SendPrivateMessage(target int64, groupId int64, m *message.Sen
|
||||
if msg != nil {
|
||||
id = bot.InsertPrivateMessage(msg)
|
||||
}
|
||||
} else if code, ok := bot.tempMsgCache.Load(target); ok || groupId != 0 { // 临时会话
|
||||
if bot.Client.FindGroup(groupId) == nil {
|
||||
log.Errorf("错误: 找不到群(%v)", groupId)
|
||||
} else if code, ok := bot.tempMsgCache.Load(target); ok || groupID != 0 { // 临时会话
|
||||
switch {
|
||||
case groupID != 0 && bot.Client.FindGroup(groupID) == nil:
|
||||
log.Errorf("错误: 找不到群(%v)", groupID)
|
||||
id = -1
|
||||
} else if groupId != 0 && !bot.Client.FindGroup(groupId).AdministratorOrOwner() {
|
||||
log.Errorf("错误: 机器人在群(%v) 为非管理员或群主, 无法主动发起临时会话", groupId)
|
||||
case groupID != 0 && !bot.Client.FindGroup(groupID).AdministratorOrOwner():
|
||||
log.Errorf("错误: 机器人在群(%v) 为非管理员或群主, 无法主动发起临时会话", groupID)
|
||||
id = -1
|
||||
} else if groupId != 0 && bot.Client.FindGroup(groupId).FindMember(target) == nil {
|
||||
log.Errorf("错误: 群员(%v) 不在 群(%v), 无法发起临时会话", target, groupId)
|
||||
case groupID != 0 && bot.Client.FindGroup(groupID).FindMember(target) == nil:
|
||||
log.Errorf("错误: 群员(%v) 不在 群(%v), 无法发起临时会话", target, groupID)
|
||||
id = -1
|
||||
} else {
|
||||
if code != nil {
|
||||
groupId = code.(int64)
|
||||
default:
|
||||
if code != nil && groupID == 0 {
|
||||
groupID = code.(int64)
|
||||
}
|
||||
msg := bot.Client.SendTempMessage(groupId, target, m)
|
||||
if msg != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user