Skip to content

Commit

Permalink
fix: uploadForwardElement upload image error (#1354)
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Feb 7, 2022
1 parent 8773ff9 commit d33f17e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions coolq/api.go
Expand Up @@ -796,16 +796,17 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, groupID int64) *message.F
var wg sync.WaitGroup
resolveElement := func(elems []message.IMessageElement) []message.IMessageElement {
for i, elem := range elems {
switch elem.(type) {
iescape := i
switch o := elem.(type) {
case *LocalImageElement, *LocalVideoElement:
wg.Add(1)
lazyUpload = append(lazyUpload, func() {
defer wg.Done()
gm, err := bot.uploadMedia(elem, groupID, true)
gm, err := bot.uploadMedia(o, groupID, true)
if err != nil {
log.Warnf("警告: 群 %d %s上传失败: %v", groupID, elem.Type().String(), err)
log.Warnf("警告: 群 %d %s上传失败: %v", groupID, o.Type().String(), err)
} else {
elems[i] = gm
elems[iescape] = gm
}
})
}
Expand Down Expand Up @@ -864,7 +865,7 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, groupID int64) *message.F
}
}
}
content := bot.ConvertObjectMessage(e.Get("data.content"), MessageSourceGroup)
content := bot.ConvertObjectMessage(c, MessageSourceGroup)
if uin != 0 && name != "" && len(content) > 0 {
return &message.ForwardNode{
SenderId: uin,
Expand Down

0 comments on commit d33f17e

Please sign in to comment.