mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
避免伪随机
This commit is contained in:
parent
4bd2d8f8c5
commit
3d3da9a495
@ -5,6 +5,7 @@ import (
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
timer "github.com/fumiama/ZeroBot-Plugin-Timer"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
@ -269,6 +270,7 @@ func init() { // 插件主体
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if ctx.Event.GroupID > 0 {
|
||||
list := ctx.GetGroupMemberList(ctx.Event.GroupID)
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
rand_index := fmt.Sprint(rand.Intn(int(list.Get("#").Int())))
|
||||
random_card := list.Get(rand_index + ".card").String()
|
||||
if random_card == "" {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user