✏️ 修正正则与cd认证

This commit is contained in:
fumiama 2021-10-29 12:48:56 +08:00
parent 9608d1e736
commit f9ce439e56
2 changed files with 15 additions and 14 deletions

View File

@ -30,10 +30,9 @@ func init() {
ctx.DeleteMessage(id) ctx.DeleteMessage(id)
}) })
zero.OnRegex("^●cd([\u4e00-\u9fa5]{4})$", zero.OnlyGroup).SetBlock(true).FirstPriority(). zero.OnRegex("^●cd([\u4e00-\u8e00]{4})$", zero.OnlyGroup).SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
tok := ctx.State["regex_matched"].([]string)[1] if isValidToken(ctx.State["regex_matched"].([]string)[1]) {
if isValidToken(tok) && time.Now().Unix()-startTime < 10 {
msg := "" msg := ""
gid := ctx.Event.GroupID gid := ctx.Event.GroupID
ForEach(func(key string, manager *Control) bool { ForEach(func(key string, manager *Control) bool {
@ -54,8 +53,9 @@ func init() {
} }
}) })
zero.OnRegex("^●cd●(.*)", zero.OnlyGroup).SetBlock(true).FirstPriority(). zero.OnRegex("^●cd●(([\u4e00-\u8e00]*[\u3d01-\u3d06]?))", zero.OnlyGroup).SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
if time.Now().Unix()-startTime < 10 {
msg, err := b14.UTF82utf16be(helper.StringToBytes(ctx.State["regex_matched"].([]string)[1])) msg, err := b14.UTF82utf16be(helper.StringToBytes(ctx.State["regex_matched"].([]string)[1]))
if err == nil { if err == nil {
gid := ctx.Event.GroupID gid := ctx.Event.GroupID
@ -68,6 +68,7 @@ func init() {
} }
} }
} }
}
}) })
} }

View File

@ -25,7 +25,7 @@ func init() {
ctx.SendChain(message.Text("加密失败!")) ctx.SendChain(message.Text("加密失败!"))
} }
}) })
en.OnRegex("^解密([\u4e00-\u9fa5]*[\u3d01-\u3d06]?)$").SetBlock(true).ThirdPriority(). en.OnRegex("^解密([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$").SetBlock(true).ThirdPriority().
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[1] str := ctx.State["regex_matched"].([]string)[1]
es, err := base14.UTF82utf16be(helper.StringToBytes(str)) es, err := base14.UTF82utf16be(helper.StringToBytes(str))