群管增加翻牌,修复计时器空指针错误

This commit is contained in:
fumiama
2021-06-16 23:40:04 +08:00
parent 940b70f61a
commit 48cd620fc1
4 changed files with 17 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
package manager
import (
"fmt"
"math/rand"
"strconv"
"strings"
@@ -262,6 +264,15 @@ func init() { // 插件主体
}
return
})
// 随机点名
zero.OnFullMatchGroup([]string{"翻牌"}, zero.AdminPermission).SetBlock(true).SetPriority(24).
Handle(func(ctx *zero.Ctx) {
list := ctx.GetGroupMemberList(ctx.Event.GroupID)
path := fmt.Sprint(rand.Intn(int(list.Get("#").Int()))) + ".user_id"
random_user_id := list.Get(path).Int()
ctx.SendChain(message.At(random_user_id), message.Text("就是你啦!"))
return
})
// 入群欢迎
zero.OnNotice().SetBlock(false).SetPriority(40).
Handle(func(ctx *zero.Ctx) {