mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
✨ add more limiter (#241)
This commit is contained in:
parent
c8072171f0
commit
cb1b7d5da7
@ -105,7 +105,7 @@ func init() {
|
||||
}
|
||||
return true
|
||||
},
|
||||
)).SetBlock(true).
|
||||
)).Limit(ctxext.LimitByGroup).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
// 获取该群背景类型,默认车万
|
||||
kind := "车万"
|
||||
|
||||
@ -35,7 +35,7 @@ func init() {
|
||||
"- 来份萝莉\n" +
|
||||
"- 设置随机图片地址[http...]",
|
||||
}).ApplySingle(ctxext.DefaultSingle)
|
||||
en.OnFullMatch("来份萝莉").SetBlock(true).
|
||||
en.OnFullMatch("来份萝莉").Limit(ctxext.LimitByGroup).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
go func() {
|
||||
for i := 0; i < math.Min(cap(queue)-len(queue), 2); i++ {
|
||||
|
||||
@ -158,7 +158,7 @@ func init() {
|
||||
"--------------------------------\n以下技能每人只能二选一\n CD24H,不跨天刷新\n--------------------------------\n" +
|
||||
"- (娶|嫁)@对方QQ\n- 当[对方Q号|@对方QQ]的小三\n",
|
||||
})
|
||||
engine.OnFullMatch("娶群友", zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByUser).
|
||||
engine.OnFullMatch("娶群友", zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByGroup).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if time.Now().Day() != lastdate.Day() {
|
||||
民政局.重置()
|
||||
@ -315,7 +315,7 @@ func init() {
|
||||
),
|
||||
)
|
||||
})
|
||||
engine.OnFullMatch("群老婆列表", zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByUser).
|
||||
engine.OnFullMatch("群老婆列表", zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByGroup).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if !民政局.有登记(ctx.Event.GroupID) {
|
||||
ctx.SendChain(message.Text("你群并没有任何的CP额"))
|
||||
|
||||
@ -16,6 +16,7 @@ import (
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/img"
|
||||
"github.com/FloatTech/zbputils/img/text"
|
||||
@ -49,7 +50,7 @@ func init() {
|
||||
}
|
||||
sdb = initialize(engine.DataFolder() + "score.db")
|
||||
}()
|
||||
engine.OnFullMatch("签到", zero.OnlyGroup).SetBlock(true).
|
||||
engine.OnFullMatch("签到", zero.OnlyGroup).Limit(ctxext.LimitByGroup).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
uid := ctx.Event.UserID
|
||||
now := time.Now()
|
||||
@ -158,7 +159,7 @@ func init() {
|
||||
}
|
||||
ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + drawedFile))
|
||||
})
|
||||
engine.OnPrefix("获得签到背景", zero.OnlyGroup).SetBlock(true).
|
||||
engine.OnPrefix("获得签到背景", zero.OnlyGroup).Limit(ctxext.LimitByGroup).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
param := ctx.State["args"].(string)
|
||||
var uidStr string
|
||||
@ -174,7 +175,7 @@ func init() {
|
||||
}
|
||||
ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + picFile))
|
||||
})
|
||||
engine.OnFullMatch("查看分数排名", zero.OnlyGroup).SetBlock(true).
|
||||
engine.OnFullMatch("查看分数排名", zero.OnlyGroup).Limit(ctxext.LimitByGroup).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
today := time.Now().Format("20060102")
|
||||
drawedFile := cachePath + today + "scoreRank.png"
|
||||
|
||||
@ -58,7 +58,7 @@ func init() {
|
||||
logrus.Infof("[tarot]读取%d张塔罗牌", len(cardMap))
|
||||
return true
|
||||
},
|
||||
)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
|
||||
)).SetBlock(true).Limit(ctxext.LimitByGroup).Handle(func(ctx *zero.Ctx) {
|
||||
match := ctx.State["regex_matched"].([]string)[1]
|
||||
n := 1
|
||||
reasons := [...]string{"您抽到的是~\n", "锵锵锵,塔罗牌的预言是~\n", "诶,让我看看您抽到了~\n"}
|
||||
@ -148,7 +148,7 @@ func init() {
|
||||
}
|
||||
return true
|
||||
},
|
||||
)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
|
||||
)).SetBlock(true).Limit(ctxext.LimitByGroup).Handle(func(ctx *zero.Ctx) {
|
||||
match := ctx.State["regex_matched"].([]string)[1]
|
||||
info, ok := infoMap[match]
|
||||
if ok {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user