From: qydysky Date: Thu, 17 Dec 2020 07:37:18 +0000 (+0800) Subject: 屏蔽不需要的消息 X-Git-Tag: v0.5.4~1^2~1 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=04764fc70905df54dcc06e05a82330a39851eaa6;p=bili_danmu%2F.git 屏蔽不需要的消息 --- diff --git a/Reply/Msg.go b/Reply/Msg.go index d138e88..e3d06b6 100644 --- a/Reply/Msg.go +++ b/Reply/Msg.go @@ -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) { diff --git a/Reply/gtk.go b/Reply/gtk.go index b676869..2641fe7 100644 --- a/Reply/gtk.go +++ b/Reply/gtk.go @@ -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 index 0000000..ece8479 --- /dev/null +++ b/demo/config/config_disable_msg.json @@ -0,0 +1,5 @@ +{ + "help":"禁用指定消息类型", + "PK_BATTLE_PRE":false, + "DANMU_MSG":true +} \ No newline at end of file diff --git a/demo/config/config_tts.json b/demo/config/config_tts.json index baac642..52b02c8 100644 --- a/demo/config/config_tts.json +++ b/demo/config/config_tts.json @@ -2,5 +2,5 @@ "0buyguide":"感谢{D}", "0gift":"感谢{D}", "0superchat":"感谢{D}", - "0multi":"{D}" + "0multi":"观众:{D}" } \ No newline at end of file