新增 本地 setu 插件

This commit is contained in:
fumiama
2021-11-29 15:33:15 +08:00
parent d8a41a5ee1
commit 89121cfc57
9 changed files with 221 additions and 21 deletions

16
utils/rule/extension.go Normal file
View File

@@ -0,0 +1,16 @@
package rule
import zero "github.com/wdvxdr1123/ZeroBot"
// FirstValueInList 判断正则匹配的第一个参数是否在列表中
func FirstValueInList(list []string) zero.Rule {
return func(ctx *zero.Ctx) bool {
first := ctx.State["regex_matched"].([]string)[1]
for i := range list {
if first == list[i] {
return true
}
}
return false
}
}