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"
|
"math/rand"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
timer "github.com/fumiama/ZeroBot-Plugin-Timer"
|
timer "github.com/fumiama/ZeroBot-Plugin-Timer"
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
@ -269,6 +270,7 @@ func init() { // 插件主体
|
|||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
if ctx.Event.GroupID > 0 {
|
if ctx.Event.GroupID > 0 {
|
||||||
list := ctx.GetGroupMemberList(ctx.Event.GroupID)
|
list := ctx.GetGroupMemberList(ctx.Event.GroupID)
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
rand_index := fmt.Sprint(rand.Intn(int(list.Get("#").Int())))
|
rand_index := fmt.Sprint(rand.Intn(int(list.Get("#").Int())))
|
||||||
random_card := list.Get(rand_index + ".card").String()
|
random_card := list.Get(rand_index + ".card").String()
|
||||||
if random_card == "" {
|
if random_card == "" {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user