mirror of
https://github.com/AynaLivePlayer/blivedm-go.git
synced 2025-12-06 19:32:49 +08:00
@@ -1,8 +1,10 @@
|
||||
package message
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
// SuperChat
|
||||
@@ -70,8 +72,9 @@ type SuperChat struct {
|
||||
}
|
||||
|
||||
func (s *SuperChat) Parse(data []byte) {
|
||||
// len('{"cmd":"","data":') = 17 , len('SUPER_CHAT_MESSAGE') = 18
|
||||
err := json.Unmarshal(data[17+18:len(data)-1], s)
|
||||
sb := bytes.NewBuffer(data).String()
|
||||
sd := gjson.Get(sb, "data").String()
|
||||
err := json.Unmarshal([]byte(sd), s)
|
||||
if err != nil {
|
||||
log.Error("parse superchat failed")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user