mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-06 20:13:50 +08:00
fix forward img & video upload.
This commit is contained in:
parent
ef713bc59c
commit
1f7dcc4e91
11
coolq/api.go
11
coolq/api.go
@ -303,7 +303,7 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupId int64, m gjson.Result) MSG {
|
|||||||
var newElem []message.IMessageElement
|
var newElem []message.IMessageElement
|
||||||
for _, elem := range content {
|
for _, elem := range content {
|
||||||
if img, ok := elem.(*LocalImageElement); ok {
|
if img, ok := elem.(*LocalImageElement); ok {
|
||||||
gm, err := bot.Client.UploadGroupImage(groupId, img.Stream)
|
gm, err := bot.UploadLocalImageAsGroup(groupId, img)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("警告:群 %v 图片上传失败: %v", groupId, err)
|
log.Warnf("警告:群 %v 图片上传失败: %v", groupId, err)
|
||||||
continue
|
continue
|
||||||
@ -311,6 +311,15 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupId int64, m gjson.Result) MSG {
|
|||||||
newElem = append(newElem, gm)
|
newElem = append(newElem, gm)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if video, ok := elem.(*LocalVideoElement); ok {
|
||||||
|
gm, err := bot.UploadLocalVideo(groupId, video)
|
||||||
|
if err != nil {
|
||||||
|
log.Warnf("警告:群 %v 视频上传失败: %v", groupId, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
newElem = append(newElem, gm)
|
||||||
|
continue
|
||||||
|
}
|
||||||
newElem = append(newElem, elem)
|
newElem = append(newElem, elem)
|
||||||
}
|
}
|
||||||
nodes = append(nodes, &message.ForwardNode{
|
nodes = append(nodes, &message.ForwardNode{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user