mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
解决无群名片时为空
This commit is contained in:
parent
0d3dbbc8eb
commit
4bd2d8f8c5
@ -269,8 +269,11 @@ 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)
|
||||||
path := fmt.Sprint(rand.Intn(int(list.Get("#").Int()))) + ".card"
|
rand_index := fmt.Sprint(rand.Intn(int(list.Get("#").Int())))
|
||||||
random_card := list.Get(path).String()
|
random_card := list.Get(rand_index + ".card").String()
|
||||||
|
if random_card == "" {
|
||||||
|
random_card = list.Get(rand_index + ".nickname").String()
|
||||||
|
}
|
||||||
ctx.Send(random_card + ",就是你啦!")
|
ctx.Send(random_card + ",就是你啦!")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user