🎨 byte-string convert

This commit is contained in:
Akiba
2022-06-04 09:21:59 +08:00
parent 7ed9b1f5b4
commit f69fa04863
3 changed files with 9 additions and 12 deletions

View File

@@ -1,8 +1,7 @@
package message
import (
"bytes"
"encoding/json"
"github.com/Akegarasu/blivedm-go/utils"
log "github.com/sirupsen/logrus"
"github.com/tidwall/gjson"
)
@@ -72,9 +71,9 @@ type SuperChat struct {
}
func (s *SuperChat) Parse(data []byte) {
sb := bytes.NewBuffer(data).String()
sb := utils.BytesToString(data)
sd := gjson.Get(sb, "data").String()
err := json.Unmarshal([]byte(sd), s)
err := utils.UnmarshalString(sd, s)
if err != nil {
log.Error("parse superchat failed")
}