Commit 05d8e773 authored by scjtqs's avatar scjtqs

配合 最新的MiraiGo调整代码

parent b2f46b4b
...@@ -503,11 +503,19 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message. ...@@ -503,11 +503,19 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
template := CQCodeEscapeValue(d["data"]) template := CQCodeEscapeValue(d["data"])
//println(template) //println(template)
i, _ := strconv.ParseInt(resId, 10, 64) i, _ := strconv.ParseInt(resId, 10, 64)
msg := message.NewXmlMsg(template, i) msg := message.NewRichXml(template, i)
return msg, nil return msg, nil
case "json": case "json":
resId := d["resid"]
i, _ := strconv.ParseInt(resId, 10, 64)
log.Warnf("json msg=%s", d["data"]) 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 return msg, nil
default: default:
return nil, errors.New("unsupported cq code: " + t) return nil, errors.New("unsupported cq code: " + t)
......
...@@ -179,6 +179,7 @@ Type: `json` ...@@ -179,6 +179,7 @@ Type: `json`
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| ------ | ------ | ------------------------------------------------------------ | | ------ | ------ | ------------------------------------------------------------ |
| data | string | json内容,json的所有字符串记得实体化处理| | data | string | json内容,json的所有字符串记得实体化处理|
| resid | int32 | 默认不填为0,走小程序通道,填了走富文本通道发送|
json中的字符串需要进行转义: json中的字符串需要进行转义:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment