1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 03:23:49 +08:00

配合 最新的MiraiGo调整代码

This commit is contained in:
scjtqs 2020-09-03 00:34:20 +08:00
parent b2f46b4bbe
commit 05d8e773f2
2 changed files with 11 additions and 2 deletions

View File

@ -503,11 +503,19 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
template := CQCodeEscapeValue(d["data"])
//println(template)
i, _ := strconv.ParseInt(resId, 10, 64)
msg := message.NewXmlMsg(template, i)
msg := message.NewRichXml(template, i)
return msg, nil
case "json":
resId := d["resid"]
i, _ := strconv.ParseInt(resId, 10, 64)
log.Warnf("json msg=%s", d["data"])
msg := message.NewJsonMsg(CQCodeUnescapeValue(d["data"]))
if i == 0 {
//默认情况下走小程序通道
msg := message.NewLightApp(CQCodeUnescapeValue(d["data"]))
return msg, nil
}
//resid不为0的情况下走富文本通道后续补全透传service Id此处暂时不处理 TODO
msg := message.NewRichJson(CQCodeUnescapeValue(d["data"]))
return msg, nil
default:
return nil, errors.New("unsupported cq code: " + t)

View File

@ -179,6 +179,7 @@ Type: `json`
| 参数名 | 类型 | 说明 |
| ------ | ------ | ------------------------------------------------------------ |
| data | string | json内容json的所有字符串记得实体化处理|
| resid | int32 | 默认不填为0走小程序通道填了走富文本通道发送|
json中的字符串需要进行转义