From 8e00b3b284e72743d6c1a4f0ffb5d23f65e8ac10 Mon Sep 17 00:00:00 2001 From: vatebur Date: Thu, 5 Sep 2024 09:51:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9niuniu=E6=8F=92=E4=BB=B6a?= =?UTF-8?q?t=E5=8A=9F=E8=83=BD=E6=AD=A3=E5=88=99=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E9=AB=98=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/niuniu/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 53f82865be..008143aebc 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -220,7 +220,7 @@ func init() { ctx.SendChain(message.Reply(ctx.Event.GroupID), message.Text("注册成功,你的牛牛现在有", u.Length, "cm")) }) - en.OnRegex(`jj\[CQ:at,qq=(\d+),name=[\s\S]*\]$`, getdb, + en.OnRegex(`^jj\s?(\[CQ:at,(?:\S*,)?qq=(\d+)(?:,\S*)?\]|(\d+))$`, getdb, zero.OnlyGroup).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { lt := jjLimiter.Load(fmt.Sprintf("%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) ctx.State["jj_last_touch"] = lt.LastTouch() @@ -235,7 +235,8 @@ func init() { }))) }, ).Handle(func(ctx *zero.Ctx) { - adduser, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) + fiancee := ctx.State["regex_matched"].([]string) + adduser, err := strconv.ParseInt(fiancee[2]+fiancee[3], 10, 64) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return