Skip to content

Commit 13ef54e

Browse files
authored
fix:修改niuniu插件at功能正则,提高兼容性 (#973)
1 parent 6ec3dff commit 13ef54e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugin/niuniu/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func init() {
220220
ctx.SendChain(message.Reply(ctx.Event.GroupID),
221221
message.Text("注册成功,你的牛牛现在有", u.Length, "cm"))
222222
})
223-
en.OnRegex(`jj\[CQ:at,qq=(\d+),name=[\s\S]*\]$`, getdb,
223+
en.OnRegex(`^jj\s?(\[CQ:at,(?:\S*,)?qq=(\d+)(?:,\S*)?\]|(\d+))$`, getdb,
224224
zero.OnlyGroup).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter {
225225
lt := jjLimiter.Load(fmt.Sprintf("%d_%d", ctx.Event.GroupID, ctx.Event.UserID))
226226
ctx.State["jj_last_touch"] = lt.LastTouch()
@@ -235,7 +235,8 @@ func init() {
235235
})))
236236
},
237237
).Handle(func(ctx *zero.Ctx) {
238-
adduser, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
238+
fiancee := ctx.State["regex_matched"].([]string)
239+
adduser, err := strconv.ParseInt(fiancee[2]+fiancee[3], 10, 64)
239240
if err != nil {
240241
ctx.SendChain(message.Text("ERROR:", err))
241242
return

0 commit comments

Comments
 (0)