diff --git a/README.md b/README.md index 652961fe..f70c078d 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ - [x] 在[月份]月[每周or周几]的[小时]点[分钟]分时(用[url])提醒大家[消息] - [x] 取消在[月份]月[日期]日的[小时]点[分钟]分的提醒 - [x] 取消在[月份]月[每周or周几]的[小时]点[分钟]分的提醒 + - [x] 翻牌 - [ ] 同意入群请求 - [ ] 同意好友请求 - [ ] 撤回[@xxx] [xxx] diff --git a/go.mod b/go.mod index a575552e..6e42b857 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( github.com/antchfx/htmlquery v1.2.3 - github.com/fumiama/ZeroBot-Plugin-Timer v0.0.0-20210609104507-70d574d5761d + github.com/fumiama/ZeroBot-Plugin-Timer v0.0.0-20210609110318-3c8ef99e3c6c github.com/mattn/go-sqlite3 v1.14.7 github.com/sirupsen/logrus v1.8.1 github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 diff --git a/go.sum b/go.sum index e53396ba..71f02a93 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,5 @@ github.com/Yiwen-Chan/ZeroBot-Plugin v0.0.0-20210606065432-ce326ce97753/go.mod h1:54LOXRTKW0iR0BcKwRSUK46KfLPz7hiLcGMD5GGtL0k= +github.com/Yiwen-Chan/ZeroBot-Plugin v0.0.0-20210606082630-29be1bd5eca6/go.mod h1:UfFAgNpRzp1N9HFmYoUlBJ4nvJOMJC9fMBBHQoaHmf8= github.com/antchfx/htmlquery v1.2.3 h1:sP3NFDneHx2stfNXCKbhHFo8XgNjCACnU/4AO5gWz6M= github.com/antchfx/htmlquery v1.2.3/go.mod h1:B0ABL+F5irhhMWg54ymEZinzMSi0Kt3I2if0BLYa3V0= github.com/antchfx/xpath v1.1.6/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= @@ -9,8 +10,9 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fumiama/ZeroBot-Plugin-Timer v0.0.0-20210606064339-d55b94d71eee/go.mod h1:RN0gCtafWRu2d7lMg9/5UfZDhtsPgdeUovsyuSwl+oQ= -github.com/fumiama/ZeroBot-Plugin-Timer v0.0.0-20210609104507-70d574d5761d h1:p67VMUDiZUhwKjUD6Xsur6FJc96hsikoXI0cm90IGSQ= -github.com/fumiama/ZeroBot-Plugin-Timer v0.0.0-20210609104507-70d574d5761d/go.mod h1:vG2ODqgJYFQobphBnhhmNv3TO+j/ZNYvN6FjUP/zkmA= +github.com/fumiama/ZeroBot-Plugin-Timer v0.0.0-20210606075146-09f50acdb4de/go.mod h1:vG2ODqgJYFQobphBnhhmNv3TO+j/ZNYvN6FjUP/zkmA= +github.com/fumiama/ZeroBot-Plugin-Timer v0.0.0-20210609110318-3c8ef99e3c6c h1:M98iR1Em9EzfaduyhaO/I9Az3CVC0YS3pVbUihoPlM8= +github.com/fumiama/ZeroBot-Plugin-Timer v0.0.0-20210609110318-3c8ef99e3c6c/go.mod h1:/Tv1kgOdp76gvr1VoVmMG2Xu4c76vXngy6P8NFE4pA0= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= diff --git a/manager/manager.go b/manager/manager.go index d71df744..fb7b8171 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -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) {