From 051b7dd1821082f0ef3af78647cf962c8aaa184a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sun, 6 Mar 2022 22:46:12 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E5=AE=9A=E6=97=B6=E6=8C=87?= =?UTF-8?q?=E4=BB=A4=E8=A7=A6=E5=8F=91=E5=99=A8=E6=8F=92=E4=BB=B6=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E9=9D=9E=E7=AE=A1=E7=90=86=E7=A7=81=E8=81=8A=E4=BD=BF?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/job/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin/job/main.go b/plugin/job/main.go index 77d03b34..a2b2dada 100644 --- a/plugin/job/main.go +++ b/plugin/job/main.go @@ -10,6 +10,7 @@ import ( "github.com/FloatTech/zbputils/binary" "github.com/FloatTech/zbputils/control" "github.com/FloatTech/zbputils/control/order" + "github.com/FloatTech/zbputils/ctxext" "github.com/FloatTech/zbputils/process" "github.com/FloatTech/zbputils/vevent" "github.com/fumiama/cron" @@ -64,7 +65,7 @@ func init() { logrus.Infoln("[job]本地环回初始化完成") process.GlobalInitMutex.Unlock() }() - en.OnRegex(`^记录在"(.*)"触发的指令$`, zero.AdminPermission, islonotnil, func(ctx *zero.Ctx) bool { + en.OnRegex(`^记录在"(.*)"触发的指令$`, ctxext.UserOrGrpAdmin, islonotnil, func(ctx *zero.Ctx) bool { ctx.SendChain(message.Text("您的下一条指令将被记录,在", ctx.State["regex_matched"].([]string)[1], "时触发")) select { case <-time.After(time.Second * 120): @@ -89,7 +90,7 @@ func init() { } ctx.SendChain(message.Text("成功!")) }) - en.OnRegex(`^取消在"(.*)"触发的指令$`, zero.AdminPermission, islonotnil).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`^取消在"(.*)"触发的指令$`, ctxext.UserOrGrpAdmin, islonotnil).SetBlock(true).Handle(func(ctx *zero.Ctx) { cron := ctx.State["regex_matched"].([]string)[1] err := rmcmd(ctx.Event.SelfID, cron) if err != nil {