添加run功能

This commit is contained in:
Yiwen-Chan 2021-03-22 13:08:20 +08:00
parent 184b12628f
commit f95838ff28

17
run/runner.go Normal file
View File

@ -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)
})
}