mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-06 03:53:50 +08:00
fix #238.
This commit is contained in:
parent
a9001d5c9e
commit
6565a19aaa
15
coolq/api.go
15
coolq/api.go
@ -198,11 +198,24 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupId int64, m gjson.Result) MSG {
|
|||||||
name := e.Get("data.name").Str
|
name := e.Get("data.name").Str
|
||||||
content := bot.ConvertObjectMessage(e.Get("data.content"), true)
|
content := bot.ConvertObjectMessage(e.Get("data.content"), true)
|
||||||
if uin != 0 && name != "" && len(content) > 0 {
|
if uin != 0 && name != "" && len(content) > 0 {
|
||||||
|
var newElem []message.IMessageElement
|
||||||
|
for _, elem := range content {
|
||||||
|
if img, ok := elem.(*message.ImageElement); ok {
|
||||||
|
gm, err := bot.Client.UploadGroupImage(groupId, img.Data)
|
||||||
|
if err != nil {
|
||||||
|
log.Warnf("警告:群 %v 图片上传失败: %v", groupId, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
newElem = append(newElem, gm)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
newElem = append(newElem, elem)
|
||||||
|
}
|
||||||
nodes = append(nodes, &message.ForwardNode{
|
nodes = append(nodes, &message.ForwardNode{
|
||||||
SenderId: uin,
|
SenderId: uin,
|
||||||
SenderName: name,
|
SenderName: name,
|
||||||
Time: int32(ts.Unix()),
|
Time: int32(ts.Unix()),
|
||||||
Message: content,
|
Message: newElem,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user