From bbc96a83d7711a3310e1ef3efde7c1419655c95d Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 8 Sep 2021 13:48:13 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=20=E5=A2=9E=E5=8A=A0=20Di?= =?UTF-8?q?ana=20=E6=8F=92=E4=BB=B6=E4=BF=9D=E5=AD=98=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_diana/bing.go | 8 ++++---- plugin_diana/data/text.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin_diana/bing.go b/plugin_diana/bing.go index 026017b7..dac15b97 100644 --- a/plugin_diana/bing.go +++ b/plugin_diana/bing.go @@ -6,10 +6,8 @@ import ( "math/rand" "time" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/message" - "github.com/FloatTech/ZeroBot-Plugin/plugin_diana/data" + zero "github.com/wdvxdr1123/ZeroBot" ) func init() { @@ -18,7 +16,7 @@ func init() { Handle(func(ctx *zero.Ctx) { rand.Seed(time.Now().UnixNano()) // 绕过第一行发病 - ctx.SendChain(message.Text((*data.Array)[rand.Intn(len(*data.Array)-1)+1])) + ctx.Send((*data.Array)[rand.Intn(len(*data.Array)-1)+1]) }) // 逆天 zero.OnFullMatch("发大病", zero.OnlyToMe). @@ -32,6 +30,8 @@ func init() { err := data.AddText(ctx.State["regex_matched"].([]string)[1]) if err != nil { ctx.Send(fmt.Sprintf("ERROR: %v", err)) + } else { + ctx.Send("记住啦!") } }) } diff --git a/plugin_diana/data/text.go b/plugin_diana/data/text.go index 3b6afbc2..12cccd39 100644 --- a/plugin_diana/data/text.go +++ b/plugin_diana/data/text.go @@ -95,7 +95,7 @@ func AddText(txt string) error { if txt != "" && !isin(sum) { compo.Array = append(compo.Array, txt) md5s = append(md5s, sum) - savecompo() + return savecompo() } return nil }