Skip to content

Commit

Permalink
改个小bug
Browse files Browse the repository at this point in the history
忘了上传utils包,依赖了其中一个随机函数,现在直接把随机函数搬过来放这里一起
  • Loading branch information
Suika99 authored Jun 26, 2021
1 parent d29105f commit 66d43f2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions bing/bing.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func init() {
// 随机发送一篇上面的小作文
zero.OnFullMatch("/小作文").
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(utils.RandText(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))
})

// 逆天
Expand All @@ -48,8 +48,19 @@ func init() {
zero.OnFullMatch("随机函数测试", zero.OnlyToMe, zero.AdminPermission).
Handle(func(ctx *zero.Ctx) {
for i:=1; i<1000; i++ {
ctx.Send(utils.Suiji())
ctx.Send(Suiji())
time.Sleep(300 * time.Millisecond)
}
})
}

func RandText(text ...[]string) message.MessageSegment {
length := len(text)
rand.Seed(time.Now().UnixNano())
return message.Text(text[rand.Intn(length)])
}

func Suiji() int {
rand.Seed(time.Now().UnixNano())
return rand.Intn(30)
}

0 comments on commit 66d43f2

Please sign in to comment.