mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 19:43:49 +08:00
commit
67ea5d75ef
15
coolq/api.go
15
coolq/api.go
@ -832,7 +832,12 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, target int64, sourceType
|
|||||||
groupID := target
|
groupID := target
|
||||||
source := message.Source{SourceType: sourceType, PrimaryID: target}
|
source := message.Source{SourceType: sourceType, PrimaryID: target}
|
||||||
if sourceType == message.SourcePrivate {
|
if sourceType == message.SourcePrivate {
|
||||||
groupID = 0
|
// ios 设备的合并转发来源群号不能为 0
|
||||||
|
if len(bot.Client.GroupList) == 0 {
|
||||||
|
groupID = 1
|
||||||
|
} else {
|
||||||
|
groupID = bot.Client.GroupList[1].Uin
|
||||||
|
}
|
||||||
}
|
}
|
||||||
builder := bot.Client.NewForwardMessageBuilder(groupID)
|
builder := bot.Client.NewForwardMessageBuilder(groupID)
|
||||||
|
|
||||||
@ -875,6 +880,10 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, target int64, sourceType
|
|||||||
i := e.Get("data.id").Int()
|
i := e.Get("data.id").Int()
|
||||||
m, _ := db.GetMessageByGlobalID(int32(i))
|
m, _ := db.GetMessageByGlobalID(int32(i))
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
mSource := message.SourcePrivate
|
||||||
|
if m.GetType() == "group" {
|
||||||
|
mSource = message.SourceGroup
|
||||||
|
}
|
||||||
msgTime := m.GetAttribute().Timestamp
|
msgTime := m.GetAttribute().Timestamp
|
||||||
if msgTime == 0 {
|
if msgTime == 0 {
|
||||||
msgTime = ts.Unix()
|
msgTime = ts.Unix()
|
||||||
@ -883,7 +892,7 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, target int64, sourceType
|
|||||||
SenderId: m.GetAttribute().SenderUin,
|
SenderId: m.GetAttribute().SenderUin,
|
||||||
SenderName: m.GetAttribute().SenderName,
|
SenderName: m.GetAttribute().SenderName,
|
||||||
Time: int32(msgTime),
|
Time: int32(msgTime),
|
||||||
Message: resolveElement(bot.ConvertContentMessage(m.GetContent(), message.SourceGroup)),
|
Message: resolveElement(bot.ConvertContentMessage(m.GetContent(), mSource)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Warnf("警告: 引用消息 %v 错误或数据库未开启.", e.Get("data.id").Str)
|
log.Warnf("警告: 引用消息 %v 错误或数据库未开启.", e.Get("data.id").Str)
|
||||||
@ -916,7 +925,7 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, target int64, sourceType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
content := bot.ConvertObjectMessage(c, message.SourceGroup)
|
content := bot.ConvertObjectMessage(c, sourceType)
|
||||||
if uin != 0 && name != "" && len(content) > 0 {
|
if uin != 0 && name != "" && len(content) > 0 {
|
||||||
return &message.ForwardNode{
|
return &message.ForwardNode{
|
||||||
SenderId: uin,
|
SenderId: uin,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user