From b3c75809325ebf51c0a876a65bc96b9660b23396 Mon Sep 17 00:00:00 2001 From: Suika <290760339@qq.com> Date: Sun, 27 Jun 2021 03:27:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=8C=85=E5=AF=BC=E5=8C=85~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 天呐,忘了导包 --- bing/bing.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bing/bing.go b/bing/bing.go index 0bb49d38..38edef7a 100644 --- a/bing/bing.go +++ b/bing/bing.go @@ -1,8 +1,9 @@ package bing import ( - "ZeroBotPlugin/utils" zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" + "math/rand" "time" ) @@ -35,7 +36,7 @@ func init() { // 随机发送一篇上面的小作文 zero.OnFullMatch("/小作文"). Handle(func(ctx *zero.Ctx) { - ctx.SendChain(Randtt(txt1,txt2,txt3,txt4,txt5,txt6,txt7,txt8,txt9,txt11,txt12,txt13,txt14,txt15,txt16,txt17,txt18,txt19,txt20,txt21,txt22)) + ctx.SendChain(RandText(txt1,txt2,txt3,txt4,txt5,txt6,txt7,txt8,txt9,txt11,txt12,txt13,txt14,txt15,txt16,txt17,txt18,txt19,txt20,txt21,txt22)) }) // 逆天 @@ -54,7 +55,7 @@ func init() { }) } -func Randtt(text ...[]string) message.MessageSegment { +func RandText(text ...[]string) message.MessageSegment { length := len(text) rand.Seed(time.Now().UnixNano()) return message.Text(text[rand.Intn(length)])