From 04764fc70905df54dcc06e05a82330a39851eaa6 Mon Sep 17 00:00:00 2001 From: qydysky Date: Thu, 17 Dec 2020 15:37:18 +0800 Subject: [PATCH] =?utf8?q?=E5=B1=8F=E8=94=BD=E4=B8=8D=E9=9C=80=E8=A6=81?= =?utf8?q?=E7=9A=84=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/Msg.go | 12 ++++++++++++ Reply/gtk.go | 2 +- demo/config/config_disable_msg.json | 5 +++++ demo/config/config_tts.json | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 demo/config/config_disable_msg.json 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 -- 2.39.2