]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Fix ws消息 修复SC SUPER_CHAT_MESSAGE_JPN 弃用
authorqydysky <32743305+qydysky@users.noreply.github.com>
Mon, 6 Mar 2023 14:54:36 +0000 (22:54 +0800)
committerqydysky <32743305+qydysky@users.noreply.github.com>
Mon, 6 Mar 2023 14:54:36 +0000 (22:54 +0800)
Reply/Msg.go
Reply/Reply.go
Reply/ws_msg/SUPER_CHAT_MESSAGE.go [new file with mode: 0644]

index a826a685865ca48621e4c2e04a31cfd818223453..7fb4c0b159b4c6815616d34b92647e25ca1f7482 100644 (file)
@@ -86,8 +86,8 @@ var Msg_map = map[string]func(replyF, string){
        "LIVE":                              replyF.live,               //开播
        "SUPER_CHAT_ENTRANCE":               nil,                       //SC入口
        "SUPER_CHAT_MESSAGE_DELETE":         nil,                       //SC删除
-       "SUPER_CHAT_MESSAGE":                nil,                       //replyF.super_chat_message,//SC
-       "SUPER_CHAT_MESSAGE_JPN":            replyF.super_chat_message, //SC
+       "SUPER_CHAT_MESSAGE":                replyF.super_chat_message, //SC
+       "SUPER_CHAT_MESSAGE_JPN":            nil,                       //replyF.super_chat_message, //SC
        "PANEL":                             nil,                       //replyF.panel,//排行榜 被HOT_RANK_CHANGED替代
        "ENTRY_EFFECT":                      replyF.entry_effect,       //进入特效
        "ROOM_REAL_TIME_MESSAGE_UPDATE":     nil,                       //replyF.roominfo,//粉丝数
index 8a3aaf03ff7c6b37d26b401af395c8af76cd7b00..a384c2bb20cb1898634d2f46500a0c39eeb29650 100644 (file)
@@ -795,18 +795,18 @@ func (replyF) live(s string) {
 }
 
 // Msg-超级留言处理
-var sc_buf = make(map[string]struct{})
+var sc_buf = make(map[int]struct{})
 
 func (replyF) super_chat_message(s string) {
        msglog := msglog.Base_add("礼")
 
-       var j ws_msg.SUPER_CHAT_MESSAGE_JPN
+       var j ws_msg.SUPER_CHAT_MESSAGE
        if e := json.Unmarshal([]byte(s), &j); e != nil {
                msglog.L(`E: `, e)
        }
 
        id := j.Data.ID
-       if id != "" {
+       if id != 0 {
                if _, ok := sc_buf[id]; ok {
                        return
                }
@@ -816,7 +816,7 @@ func (replyF) super_chat_message(s string) {
                                break
                        }
                        { //copy map
-                               tmp := make(map[string]struct{})
+                               tmp := make(map[int]struct{})
                                for k, v := range sc_buf {
                                        tmp[k] = v
                                }
@@ -828,7 +828,6 @@ func (replyF) super_chat_message(s string) {
        uname := j.Data.UserInfo.Uname
        price := j.Data.Price
        message := j.Data.Message
-       message_jpn := j.Data.MessageJpn
 
        var sh = []interface{}{"SC: "}
 
@@ -852,24 +851,21 @@ func (replyF) super_chat_message(s string) {
                c.C.Danmu_Main_mq.Push_tag(`tts`, Danmu_mq_t{ //传入消息队列
                        uid: `0superchat`,
                        m: map[string]string{
-                               `{uname}`:       uname,
-                               `{price}`:       strconv.Itoa(price),
-                               `{message}`:     message,
-                               `{message_jpn}`: message_jpn,
+                               `{uname}`:   uname,
+                               `{price}`:   strconv.Itoa(price),
+                               `{message}`: message,
                        },
                })
        }
-       if message != message_jpn && message_jpn != "" {
-               fmt.Println(message_jpn)
-               // Gui_show(message_jpn.(string))
-               sh = append(sh, message_jpn)
-               logg = append(logg, message_jpn)
+       if message != "" {
+               fmt.Println(message)
+               sh = append(sh, message)
+               logg = append(logg, message)
        }
        fmt.Print("====\n")
 
        { //额外
                Assf(fmt.Sprintln(sh...))
-               // Gui_show("====\n")
                Gui_show(Itos(sh), "0superchat")
                //直播流服务弹幕
                SendStreamWs(Danmu_item{
diff --git a/Reply/ws_msg/SUPER_CHAT_MESSAGE.go b/Reply/ws_msg/SUPER_CHAT_MESSAGE.go
new file mode 100644 (file)
index 0000000..928dcaf
--- /dev/null
@@ -0,0 +1,66 @@
+package part
+
+type SUPER_CHAT_MESSAGE struct {
+       Cmd  string `json:"cmd"`
+       Data struct {
+               BackgroundBottomColor string  `json:"background_bottom_color"`
+               BackgroundColor       string  `json:"background_color"`
+               BackgroundColorEnd    string  `json:"background_color_end"`
+               BackgroundColorStart  string  `json:"background_color_start"`
+               BackgroundIcon        string  `json:"background_icon"`
+               BackgroundImage       string  `json:"background_image"`
+               BackgroundPriceColor  string  `json:"background_price_color"`
+               ColorPoint            float64 `json:"color_point"`
+               Dmscore               int     `json:"dmscore"`
+               EndTime               int     `json:"end_time"`
+               Gift                  struct {
+                       GiftID   int    `json:"gift_id"`
+                       GiftName string `json:"gift_name"`
+                       Num      int    `json:"num"`
+               } `json:"gift"`
+               ID          int `json:"id"`
+               IsRanked    int `json:"is_ranked"`
+               IsSendAudit int `json:"is_send_audit"`
+               MedalInfo   struct {
+                       AnchorRoomid     int    `json:"anchor_roomid"`
+                       AnchorUname      string `json:"anchor_uname"`
+                       GuardLevel       int    `json:"guard_level"`
+                       IconID           int    `json:"icon_id"`
+                       IsLighted        int    `json:"is_lighted"`
+                       MedalColor       string `json:"medal_color"`
+                       MedalColorBorder int    `json:"medal_color_border"`
+                       MedalColorEnd    int    `json:"medal_color_end"`
+                       MedalColorStart  int    `json:"medal_color_start"`
+                       MedalLevel       int    `json:"medal_level"`
+                       MedalName        string `json:"medal_name"`
+                       Special          string `json:"special"`
+                       TargetID         int    `json:"target_id"`
+               } `json:"medal_info"`
+               Message          string `json:"message"`
+               MessageFontColor string `json:"message_font_color"`
+               MessageTrans     string `json:"message_trans"`
+               Price            int    `json:"price"`
+               Rate             int    `json:"rate"`
+               StartTime        int    `json:"start_time"`
+               Time             int    `json:"time"`
+               Token            string `json:"token"`
+               TransMark        int    `json:"trans_mark"`
+               Ts               int    `json:"ts"`
+               UID              int    `json:"uid"`
+               UserInfo         struct {
+                       Face       string `json:"face"`
+                       FaceFrame  string `json:"face_frame"`
+                       GuardLevel int    `json:"guard_level"`
+                       IsMainVip  int    `json:"is_main_vip"`
+                       IsSvip     int    `json:"is_svip"`
+                       IsVip      int    `json:"is_vip"`
+                       LevelColor string `json:"level_color"`
+                       Manager    int    `json:"manager"`
+                       NameColor  string `json:"name_color"`
+                       Title      string `json:"title"`
+                       Uname      string `json:"uname"`
+                       UserLevel  int    `json:"user_level"`
+               } `json:"user_info"`
+       } `json:"data"`
+       Roomid int `json:"roomid"`
+}