mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
commit
dda1caf672
1
go.mod
1
go.mod
@ -4,5 +4,6 @@ go 1.14
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang/protobuf v1.4.2
|
github.com/golang/protobuf v1.4.2
|
||||||
|
github.com/tidwall/gjson v1.6.1 // indirect
|
||||||
google.golang.org/protobuf v1.25.0
|
google.golang.org/protobuf v1.25.0
|
||||||
)
|
)
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/Mrs4s/MiraiGo/client/pb/msg"
|
"github.com/Mrs4s/MiraiGo/client/pb/msg"
|
||||||
"github.com/Mrs4s/MiraiGo/utils"
|
"github.com/Mrs4s/MiraiGo/utils"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
@ -502,6 +503,15 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
|
|||||||
if elem.RichMsg.ServiceId == 33 {
|
if elem.RichMsg.ServiceId == 33 {
|
||||||
continue // 前面一个 elem 已经解析到链接
|
continue // 前面一个 elem 已经解析到链接
|
||||||
}
|
}
|
||||||
|
if isOk := strings.Contains(content, "<?xml"); isOk {
|
||||||
|
res = append(res, NewRichXml(content, int64(elem.RichMsg.ServiceId)))
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
if gjson.Valid(content) {
|
||||||
|
res = append(res, NewRichJson(content))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
res = append(res, NewText(content))
|
res = append(res, NewText(content))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user