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

cq:json 消息的初步支持

This commit is contained in:
scjtqs 2020-08-31 00:34:38 +08:00
parent d25674a9ef
commit 710a8588b7

View File

@ -502,10 +502,11 @@ 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 := global.NewXmlMsg(template, i) msg := message.NewXmlMsg(template, i)
return msg, nil return msg, nil
case "json": case "json":
msg := global.NewJsonMsg(d["data"]) log.Warnf("json msg=%s", d["data"])
msg := message.NewJsonMsg(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)