mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 18:20:27 +00:00
群管增加翻牌,修复计时器空指针错误
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user