diff --git a/coolq/cqcode.go b/coolq/cqcode.go
index 8554d99..8b135f4 100644
--- a/coolq/cqcode.go
+++ b/coolq/cqcode.go
@@ -390,7 +390,7 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
if info.Get("artists.0").Exists() {
artistName = info.Get("artists.0.name").Str
}
- json := fmt.Sprintf("{\"app\": \"com.tencent.structmsg\",\"desc\":\"音乐\",\"view\":\"music\",\"prompt\":\"[分享]%s\",\"ver\":\"0.0.0.1\",\"meta\":{ \"music\": { \"desc\": \"%s\", \"jumpUrl\": \"%s\", \"musicUrl\": \"%s\", \"preview\": \"%s\", \"tag\": \"网易云音乐\", \"title\":\"%s\"}}}", name,artistName, jumpUrl, musicUrl, picUrl, name)
+ json := fmt.Sprintf("{\"app\": \"com.tencent.structmsg\",\"desc\":\"音乐\",\"view\":\"music\",\"prompt\":\"[分享]%s\",\"ver\":\"0.0.0.1\",\"meta\":{ \"music\": { \"desc\": \"%s\", \"jumpUrl\": \"%s\", \"musicUrl\": \"%s\", \"preview\": \"%s\", \"tag\": \"网易云音乐\", \"title\":\"%s\"}}}", name, artistName, jumpUrl, musicUrl, picUrl, name)
return message.NewLightApp(json), nil
}
if d["type"] == "custom" {
@@ -615,10 +615,17 @@ func (bot *CQBot) SendNewPic(elem message.IMessageElement, source string, icon s
xml = fmt.Sprintf(` `, "", gm.FileId, gm.Md5, len(i.Data), "", minwidth, minheigt, maxwidth, maxheight, source, icon)
}
}
+ if i, ok := elem.(*message.GroupImageElement); ok {
+ xml = fmt.Sprintf(` `, "", i.ImageId, i.Md5, 0, "", minwidth, minheigt, maxwidth, maxheight, source, icon)
+ }
+ if i, ok := elem.(*message.FriendImageElement); ok {
+ xml = fmt.Sprintf(` `, "", i.ImageId, i.Md5, 0, "", minwidth, minheigt, maxwidth, maxheight, source, icon)
+ }
if xml != "" {
log.Warn(xml)
XmlMsg := message.NewRichXml(xml, 5)
return XmlMsg, nil
}
+ log.Warnf("elem: %+v", elem)
return nil, errors.New("发送xml图片消息失败")
}