From 1d1af3de29521f5db7b721b9e92a87d80c22e216 Mon Sep 17 00:00:00 2001 From: qydysky Date: Mon, 4 Jan 2021 01:44:17 +0800 Subject: [PATCH] =?utf8?q?=E5=8F=8D=E5=B0=84=E5=BC=B9=E5=B9=95=E6=9C=BA?= =?utf8?q?=E9=85=8D=E7=BD=AE=E5=88=86=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/F.go | 15 ++++++++++++--- demo/config/config_auto_reply.json | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 demo/config/config_auto_reply.json diff --git a/Reply/F.go b/Reply/F.go index 641a537..d869162 100644 --- a/Reply/F.go +++ b/Reply/F.go @@ -14,6 +14,7 @@ import ( F "github.com/qydysky/bili_danmu/F" "github.com/christopher-dG/go-obs-websocket" p "github.com/qydysky/part" + b "github.com/qydysky/part/buf" s "github.com/qydysky/part/signal" ) @@ -459,7 +460,7 @@ func Autobanf(s string) bool { } type Danmuji struct { - buf map[string]string + Buf map[string]string Inuse_auto bool mute bool @@ -467,14 +468,22 @@ type Danmuji struct { var danmuji = Danmuji{ Inuse_auto:IsOn("Danmuji_auto"), - buf:map[string]string{ + Buf:map[string]string{ "弹幕机在么":"在", }, } +func init(){//初始化反射型弹幕机 + buf := b.New() + buf.Load("config/config_auto_reply.json") + for k,v := range buf.B { + danmuji.Buf[k] = v.(string) + } +} + func Danmujif(s string) { if !IsOn("Danmuji") {return} - if v, ok := danmuji.buf[s]; ok { + if v, ok := danmuji.Buf[s]; ok { Msg_senddanmu(v) } } diff --git a/demo/config/config_auto_reply.json b/demo/config/config_auto_reply.json new file mode 100644 index 0000000..6464597 --- /dev/null +++ b/demo/config/config_auto_reply.json @@ -0,0 +1,3 @@ +{ + "弹幕机在么":"在" +} \ No newline at end of file -- 2.39.2