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

This commit is contained in:
fumiama 2021-06-16 23:40:04 +08:00
parent 16b91d4e9d
commit 85dc473821
4 changed files with 17 additions and 3 deletions

View File

@ -49,6 +49,7 @@
- [x] 在[月份]月[每周or周几]的[小时]点[分钟]分时(用[url])提醒大家[消息] - [x] 在[月份]月[每周or周几]的[小时]点[分钟]分时(用[url])提醒大家[消息]
- [x] 取消在[月份]月[日期]日的[小时]点[分钟]分的提醒 - [x] 取消在[月份]月[日期]日的[小时]点[分钟]分的提醒
- [x] 取消在[月份]月[每周or周几]的[小时]点[分钟]分的提醒 - [x] 取消在[月份]月[每周or周几]的[小时]点[分钟]分的提醒
- [x] 翻牌
- [ ] 同意入群请求 - [ ] 同意入群请求
- [ ] 同意好友请求 - [ ] 同意好友请求
- [ ] 撤回[@xxx] [xxx] - [ ] 撤回[@xxx] [xxx]

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.15
require ( require (
github.com/antchfx/htmlquery v1.2.3 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/mattn/go-sqlite3 v1.14.7
github.com/sirupsen/logrus v1.8.1 github.com/sirupsen/logrus v1.8.1
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816

6
go.sum
View File

@ -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-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 h1:sP3NFDneHx2stfNXCKbhHFo8XgNjCACnU/4AO5gWz6M=
github.com/antchfx/htmlquery v1.2.3/go.mod h1:B0ABL+F5irhhMWg54ymEZinzMSi0Kt3I2if0BLYa3V0= github.com/antchfx/htmlquery v1.2.3/go.mod h1:B0ABL+F5irhhMWg54ymEZinzMSi0Kt3I2if0BLYa3V0=
github.com/antchfx/xpath v1.1.6/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= 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/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/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-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-20210606075146-09f50acdb4de/go.mod h1:vG2ODqgJYFQobphBnhhmNv3TO+j/ZNYvN6FjUP/zkmA=
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-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-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 h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=

View File

@ -1,6 +1,8 @@
package manager package manager
import ( import (
"fmt"
"math/rand"
"strconv" "strconv"
"strings" "strings"
@ -262,6 +264,15 @@ func init() { // 插件主体
} }
return 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). zero.OnNotice().SetBlock(false).SetPriority(40).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {