From f95838ff2816f98fa14d140d4bf40c6aa50fbcbe Mon Sep 17 00:00:00 2001 From: Yiwen-Chan Date: Mon, 22 Mar 2021 13:08:20 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0run=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run/runner.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 run/runner.go diff --git a/run/runner.go b/run/runner.go new file mode 100644 index 00000000..da28e33b --- /dev/null +++ b/run/runner.go @@ -0,0 +1,17 @@ +package runner + +import ( + "strings" + + zero "github.com/wdvxdr1123/ZeroBot" +) + +func init() { // 插件主体 + zero.OnRegex(`^run(.*)$`, zero.SuperUserPermission).SetBlock(true).SetPriority(0). + Handle(func(ctx *zero.Ctx) { + var cmd = ctx.State["regex_matched"].([]string)[1] + cmd = strings.ReplaceAll(cmd, "[", "[") + cmd = strings.ReplaceAll(cmd, "]", "]") + ctx.Send(cmd) + }) +}