]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
屏蔽不需要的消息
authorqydysky <qydysky@foxmail.com>
Thu, 17 Dec 2020 07:37:18 +0000 (15:37 +0800)
committerqydysky <qydysky@foxmail.com>
Thu, 17 Dec 2020 07:37:18 +0000 (15:37 +0800)
Reply/Msg.go
Reply/gtk.go
demo/config/config_disable_msg.json [new file with mode: 0644]
demo/config/config_tts.json

index d138e887c34f41ef45eb1411016062b5e482e682..e3d06b6c5c1bd21ca144bbc702d0935d2e2c4023 100644 (file)
@@ -2,6 +2,7 @@ package reply
 
 import (
        p "github.com/qydysky/part"
+       s "github.com/qydysky/part/buf"
 )
 
 /*
@@ -71,6 +72,17 @@ var Msg_map = map[string]func(replyF, string) {
        "ROOM_REAL_TIME_MESSAGE_UPDATE":nil,//replyF.roominfo,//粉丝数
 }
 
+//屏蔽不需要的消息
+func init(){
+       {//加载不需要的消息
+               buf := s.New()
+               buf.Load("config/config_disable_msg.json")
+               for k,v := range buf.B {
+                       if able,ok := v.(bool);ok && !able {Msg_map[k] = nil}
+               }
+       }
+}
+
 //Msg类型数据处理方法挑选
 //识别cmd字段类型,查找上述map中设置的方法,并将json转为字符串型传入
 func Msg(b []byte) {
index b676869a6f6b5ae8846e342caf6bce86be0a9d13..2641fe77e61a0fe613ac984186df708e7b3277ef 100644 (file)
@@ -448,7 +448,7 @@ func Gtk_danmu() {
 
                                step := 0.1 * (max - cu)
                                if step > 0.5 {
-                                       if step > 50 {step = 50}//限制最大滚动速度
+                                       if step > 10 {step = 10}//限制最大滚动速度
                                        tmp.SetValue(step + cu)
                                } else {
                                        in_smooth_roll = false
diff --git a/demo/config/config_disable_msg.json b/demo/config/config_disable_msg.json
new file mode 100644 (file)
index 0000000..ece8479
--- /dev/null
@@ -0,0 +1,5 @@
+{
+    "help":"禁用指定消息类型",
+    "PK_BATTLE_PRE":false,
+    "DANMU_MSG":true
+}
\ No newline at end of file
index baac642d0d831e0ec2cd574238a998fea2d81e84..52b02c8e8eb8277c898a3e9b4884802fbf8aa415 100644 (file)
@@ -2,5 +2,5 @@
        "0buyguide":"感谢{D}",
        "0gift":"感谢{D}",
     "0superchat":"感谢{D}",
-    "0multi":"{D}"
+    "0multi":"观众:{D}"
 }
\ No newline at end of file