From 0a4d87024e0477d5a9aec9bf2884cb5ba8e4b672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E6=80=9D=E6=95=9B?= <55676105+shudorcl@users.noreply.github.com> Date: Fri, 28 Jan 2022 01:55:30 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9C=A8=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E5=91=BD=E4=BB=A4=E4=B8=AD=E4=BD=BF=E7=94=A8=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E5=88=86=E9=9A=94=E7=9A=84=E4=BD=93=E9=AA=8C=20-=20fo?= =?UTF-8?q?rtune=E7=9A=84=E8=AE=BE=E7=BD=AE=E5=BA=95=E5=9B=BE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20-=20b14=E7=9A=84=E5=8A=A0=E5=AF=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_b14/main.go | 5 +++-- plugin_fortune/fortune.go | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin_b14/main.go b/plugin_b14/main.go index fe60cab2ab..a9fe449a98 100644 --- a/plugin_b14/main.go +++ b/plugin_b14/main.go @@ -2,6 +2,7 @@ package b14coder import ( + "strings" "unsafe" control "github.com/FloatTech/zbputils/control" @@ -22,7 +23,7 @@ func init() { }) en.OnRegex(`^加密(.*)`).SetBlock(true). Handle(func(ctx *zero.Ctx) { - str := ctx.State["regex_matched"].([]string)[1] + str := strings.Trim(ctx.State["regex_matched"].([]string)[1], " ") es, err := base14.UTF16be2utf8(base14.EncodeString(str)) if err == nil { ctx.SendChain(message.Text(helper.BytesToString(es))) @@ -42,7 +43,7 @@ func init() { }) en.OnRegex(`^用(.*)加密(.*)`).SetBlock(true). Handle(func(ctx *zero.Ctx) { - key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2] + key, str := ctx.State["regex_matched"].([]string)[1], strings.Trim(ctx.State["regex_matched"].([]string)[2], " ") t := getea(key) es, err := base14.UTF16be2utf8(base14.Encode(t.Encrypt(helper.StringToBytes(str)))) if err == nil { diff --git a/plugin_fortune/fortune.go b/plugin_fortune/fortune.go index cddf14d849..61a306b1b7 100644 --- a/plugin_fortune/fortune.go +++ b/plugin_fortune/fortune.go @@ -11,6 +11,7 @@ import ( "math/rand" "os" "strconv" + "strings" "time" "github.com/fogleman/gg" // 注册了 jpg png gif @@ -89,7 +90,7 @@ func init() { // 个人用户设为负数 gid = -ctx.Event.UserID } - i, ok := index[ctx.State["regex_matched"].([]string)[1]] + i, ok := index[strings.Trim(ctx.State["regex_matched"].([]string)[1], " ")] if ok { c, ok := control.Lookup("fortune") if ok { From 3eee43e497c858f5d1ab9b2d24b732edbb3c6a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E6=80=9D=E6=95=9B?= <55676105+shudorcl@users.noreply.github.com> Date: Fri, 28 Jan 2022 12:35:13 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=9B=E4=B8=AA?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E4=B8=AD=E4=BD=BF=E7=94=A8=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E5=88=86=E9=9A=94=E7=9A=84=E4=BD=93=E9=AA=8C=20-=20=E5=8A=A0?= =?UTF-8?q?=E5=AF=86=20-=20=E5=93=94=E5=93=A9=E5=93=94=E5=93=A9=E6=8E=A8?= =?UTF-8?q?=E9=80=81=20-=20=E8=97=8F=E5=A4=B4=E8=AF=97=20-=20=E8=BF=90?= =?UTF-8?q?=E5=8A=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_b14/main.go | 19 ++++++++++++------- plugin_bilibili_push/bilibili_push.go | 8 ++++---- plugin_cangtoushi/cangtoushi.go | 9 +++++++-- plugin_fortune/fortune.go | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/plugin_b14/main.go b/plugin_b14/main.go index a9fe449a98..6aab60293c 100644 --- a/plugin_b14/main.go +++ b/plugin_b14/main.go @@ -2,7 +2,7 @@ package b14coder import ( - "strings" + "regexp" "unsafe" control "github.com/FloatTech/zbputils/control" @@ -21,9 +21,9 @@ func init() { Help: "base16384加解密\n" + "- 加密xxx\n- 解密xxx\n- 用yyy加密xxx\n- 用yyy解密xxx", }) - en.OnRegex(`^加密(.*)`).SetBlock(true). + en.OnRegex(`^加密\s?(.*)`).SetBlock(true). Handle(func(ctx *zero.Ctx) { - str := strings.Trim(ctx.State["regex_matched"].([]string)[1], " ") + str := ctx.State["regex_matched"].([]string)[1] es, err := base14.UTF16be2utf8(base14.EncodeString(str)) if err == nil { ctx.SendChain(message.Text(helper.BytesToString(es))) @@ -31,9 +31,12 @@ func init() { ctx.SendChain(message.Text("加密失败!")) } }) - en.OnRegex("^解密([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$").SetBlock(true). + en.OnRegex(`^解密\s?(.*)`).SetBlock(true). Handle(func(ctx *zero.Ctx) { + re := regexp.MustCompile("^([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$") str := ctx.State["regex_matched"].([]string)[1] + str = re.FindAllString(str, -1)[0] + ctx.SendChain(message.Text(str)) es, err := base14.UTF82utf16be(helper.StringToBytes(str)) if err == nil { ctx.SendChain(message.Text(base14.DecodeString(es))) @@ -41,9 +44,9 @@ func init() { ctx.SendChain(message.Text("解密失败!")) } }) - en.OnRegex(`^用(.*)加密(.*)`).SetBlock(true). + en.OnRegex(`^用(.*)加密\s?(.*)`).SetBlock(true). Handle(func(ctx *zero.Ctx) { - key, str := ctx.State["regex_matched"].([]string)[1], strings.Trim(ctx.State["regex_matched"].([]string)[2], " ") + key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2] t := getea(key) es, err := base14.UTF16be2utf8(base14.Encode(t.Encrypt(helper.StringToBytes(str)))) if err == nil { @@ -52,9 +55,11 @@ func init() { ctx.SendChain(message.Text("加密失败!")) } }) - en.OnRegex("^用(.*)解密([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$").SetBlock(true). + en.OnRegex(`^用(.*)解密\s?(.*)`).SetBlock(true). Handle(func(ctx *zero.Ctx) { + re := regexp.MustCompile("^([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$") key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2] + str = re.FindAllString(str, -1)[0] t := getea(key) es, err := base14.UTF82utf16be(helper.StringToBytes(str)) if err == nil { diff --git a/plugin_bilibili_push/bilibili_push.go b/plugin_bilibili_push/bilibili_push.go index 233211afe0..1d0b0f2797 100644 --- a/plugin_bilibili_push/bilibili_push.go +++ b/plugin_bilibili_push/bilibili_push.go @@ -67,7 +67,7 @@ func init() { "- 推送列表", }) - en.OnRegex(`^添加订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`^添加订阅\s(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) var name string var ok bool @@ -93,7 +93,7 @@ func init() { ctx.SendChain(message.Text("已添加" + name + "的订阅")) } }) - en.OnRegex(`^取消订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`^取消订阅\s(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) var name string var ok bool @@ -119,7 +119,7 @@ func init() { ctx.SendChain(message.Text("已取消" + name + "的订阅")) } }) - en.OnRegex(`^取消动态订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`^取消动态订阅\s(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) var name string var ok bool @@ -145,7 +145,7 @@ func init() { ctx.SendChain(message.Text("已取消" + name + "的动态订阅")) } }) - en.OnRegex(`^取消直播订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`^取消直播订阅\s(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) var name string var ok bool diff --git a/plugin_cangtoushi/cangtoushi.go b/plugin_cangtoushi/cangtoushi.go index ab28330d1e..c19b751652 100644 --- a/plugin_cangtoushi/cangtoushi.go +++ b/plugin_cangtoushi/cangtoushi.go @@ -7,6 +7,7 @@ import ( "net/http" "net/http/cookiejar" "net/url" + "regexp" "strings" control "github.com/FloatTech/zbputils/control" @@ -37,8 +38,10 @@ func init() { Help: "藏头诗\n" + "- 藏头诗[xxx]\n- 藏尾诗[xxx]", }) - engine.OnRegex("藏头诗([\u4E00-\u9FA5]{3,10})").SetBlock(true).Handle(func(ctx *zero.Ctx) { + engine.OnRegex(`藏头诗\s?(.*)`).SetBlock(true).Handle(func(ctx *zero.Ctx) { + re := regexp.MustCompile("^([\u4E00-\u9FA5]{3,10})$") kw := ctx.State["regex_matched"].([]string)[1] + kw = re.FindAllString(kw, -1)[0] login() data, err := search(kw, "7", "0") if err != nil { @@ -48,8 +51,10 @@ func init() { ctx.SendChain(message.Text(text)) }) - engine.OnRegex("藏尾诗([\u4E00-\u9FA5]{3,10})").SetBlock(true).Handle(func(ctx *zero.Ctx) { + engine.OnRegex(`藏尾诗\s?(.*)`).SetBlock(true).Handle(func(ctx *zero.Ctx) { + re := regexp.MustCompile("^([\u4E00-\u9FA5]{3,10})$") kw := ctx.State["regex_matched"].([]string)[1] + kw = re.FindAllString(kw, -1)[0] login() data, err := search(kw, "7", "2") if err != nil { diff --git a/plugin_fortune/fortune.go b/plugin_fortune/fortune.go index 61a306b1b7..4d50796ad8 100644 --- a/plugin_fortune/fortune.go +++ b/plugin_fortune/fortune.go @@ -83,7 +83,7 @@ func init() { "- 运势 | 抽签\n" + "- 设置底图[车万 | DC4 | 爱因斯坦 | 星空列车 | 樱云之恋 | 富婆妹 | 李清歌 | 公主连结 | 原神 | 明日方舟 | 碧蓝航线 | 碧蓝幻想 | 战双 | 阴阳师 | 赛马娘]", }) - en.OnRegex(`^设置底图(.*)`).SetBlock(true). + en.OnRegex(`^设置底图\s(.*)`).SetBlock(true). Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID if gid <= 0 { From 9c6943df43f84753cc1fbf9b3f0a9afa296046a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E6=80=9D=E6=95=9B?= <55676105+shudorcl@users.noreply.github.com> Date: Fri, 28 Jan 2022 20:36:15 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E4=BA=86=E4=B8=8A=E4=B8=80=E4=B8=AAcommit=20-=20?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E4=BA=86=E5=9B=A0=E4=B8=BA=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E7=B2=98=E8=B4=B4=E7=96=8F=E5=BF=BD=E5=8F=88=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=B3=A8=E6=84=8F=E6=B5=8B=E8=AF=95=E9=81=97=E6=BC=8F=E7=9A=84?= =?UTF-8?q?`=3F`=20-=20=E8=B0=83=E6=95=B4=E8=97=8F=E5=A4=B4=E8=AF=97?= =?UTF-8?q?=E5=92=8C=E5=8A=A0=E5=AF=86=E7=9A=84=E6=AD=A3=E5=88=99=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=EF=BC=8C=E4=BD=BF=E5=85=B6=E4=B8=8D=E5=BF=85=E5=A4=9A?= =?UTF-8?q?=E6=AD=A4=E4=B8=80=E4=B8=BE=20-=20=E5=88=A0=E5=8E=BB=E4=BA=86?= =?UTF-8?q?=E6=9C=AA=E8=A2=AB=E5=8F=91=E7=8E=B0=E7=9A=84=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_b14/main.go | 10 ++-------- plugin_bilibili_push/bilibili_push.go | 8 ++++---- plugin_cangtoushi/cangtoushi.go | 9 ++------- plugin_fortune/fortune.go | 2 +- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/plugin_b14/main.go b/plugin_b14/main.go index 6aab60293c..24475efc0d 100644 --- a/plugin_b14/main.go +++ b/plugin_b14/main.go @@ -2,7 +2,6 @@ package b14coder import ( - "regexp" "unsafe" control "github.com/FloatTech/zbputils/control" @@ -31,12 +30,9 @@ func init() { ctx.SendChain(message.Text("加密失败!")) } }) - en.OnRegex(`^解密\s?(.*)`).SetBlock(true). + en.OnRegex(`^解密\s?([一-踀]*[㴁-㴆]?)$`).SetBlock(true). Handle(func(ctx *zero.Ctx) { - re := regexp.MustCompile("^([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$") str := ctx.State["regex_matched"].([]string)[1] - str = re.FindAllString(str, -1)[0] - ctx.SendChain(message.Text(str)) es, err := base14.UTF82utf16be(helper.StringToBytes(str)) if err == nil { ctx.SendChain(message.Text(base14.DecodeString(es))) @@ -55,11 +51,9 @@ func init() { ctx.SendChain(message.Text("加密失败!")) } }) - en.OnRegex(`^用(.*)解密\s?(.*)`).SetBlock(true). + en.OnRegex(`^用(.*)解密\s?([一-踀]*[㴁-㴆]?)$`).SetBlock(true). Handle(func(ctx *zero.Ctx) { - re := regexp.MustCompile("^([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$") key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2] - str = re.FindAllString(str, -1)[0] t := getea(key) es, err := base14.UTF82utf16be(helper.StringToBytes(str)) if err == nil { diff --git a/plugin_bilibili_push/bilibili_push.go b/plugin_bilibili_push/bilibili_push.go index 1d0b0f2797..b985cdae30 100644 --- a/plugin_bilibili_push/bilibili_push.go +++ b/plugin_bilibili_push/bilibili_push.go @@ -67,7 +67,7 @@ func init() { "- 推送列表", }) - en.OnRegex(`^添加订阅\s(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`^添加订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) var name string var ok bool @@ -93,7 +93,7 @@ func init() { ctx.SendChain(message.Text("已添加" + name + "的订阅")) } }) - en.OnRegex(`^取消订阅\s(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`^取消订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) var name string var ok bool @@ -119,7 +119,7 @@ func init() { ctx.SendChain(message.Text("已取消" + name + "的订阅")) } }) - en.OnRegex(`^取消动态订阅\s(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`^取消动态订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) var name string var ok bool @@ -145,7 +145,7 @@ func init() { ctx.SendChain(message.Text("已取消" + name + "的动态订阅")) } }) - en.OnRegex(`^取消直播订阅\s(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`^取消直播订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) { buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) var name string var ok bool diff --git a/plugin_cangtoushi/cangtoushi.go b/plugin_cangtoushi/cangtoushi.go index c19b751652..bd4334886f 100644 --- a/plugin_cangtoushi/cangtoushi.go +++ b/plugin_cangtoushi/cangtoushi.go @@ -7,7 +7,6 @@ import ( "net/http" "net/http/cookiejar" "net/url" - "regexp" "strings" control "github.com/FloatTech/zbputils/control" @@ -38,10 +37,8 @@ func init() { Help: "藏头诗\n" + "- 藏头诗[xxx]\n- 藏尾诗[xxx]", }) - engine.OnRegex(`藏头诗\s?(.*)`).SetBlock(true).Handle(func(ctx *zero.Ctx) { - re := regexp.MustCompile("^([\u4E00-\u9FA5]{3,10})$") + engine.OnRegex(`藏头诗\s?([一-龥]{3,10})$`).SetBlock(true).Handle(func(ctx *zero.Ctx) { kw := ctx.State["regex_matched"].([]string)[1] - kw = re.FindAllString(kw, -1)[0] login() data, err := search(kw, "7", "0") if err != nil { @@ -51,10 +48,8 @@ func init() { ctx.SendChain(message.Text(text)) }) - engine.OnRegex(`藏尾诗\s?(.*)`).SetBlock(true).Handle(func(ctx *zero.Ctx) { - re := regexp.MustCompile("^([\u4E00-\u9FA5]{3,10})$") + engine.OnRegex(`藏尾诗\s?([一-龥]{3,10})$`).SetBlock(true).Handle(func(ctx *zero.Ctx) { kw := ctx.State["regex_matched"].([]string)[1] - kw = re.FindAllString(kw, -1)[0] login() data, err := search(kw, "7", "2") if err != nil { diff --git a/plugin_fortune/fortune.go b/plugin_fortune/fortune.go index 4d50796ad8..4bdbb60bcf 100644 --- a/plugin_fortune/fortune.go +++ b/plugin_fortune/fortune.go @@ -83,7 +83,7 @@ func init() { "- 运势 | 抽签\n" + "- 设置底图[车万 | DC4 | 爱因斯坦 | 星空列车 | 樱云之恋 | 富婆妹 | 李清歌 | 公主连结 | 原神 | 明日方舟 | 碧蓝航线 | 碧蓝幻想 | 战双 | 阴阳师 | 赛马娘]", }) - en.OnRegex(`^设置底图\s(.*)`).SetBlock(true). + en.OnRegex(`^设置底图\s?(.*)`).SetBlock(true). Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID if gid <= 0 { From 3e3b8f178ccfd9c249b37d93e3f2272e43840bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E6=80=9D=E6=95=9B?= <55676105+shudorcl@users.noreply.github.com> Date: Fri, 28 Jan 2022 20:37:23 +0800 Subject: [PATCH 4/5] =?UTF-8?q?-=20=E5=88=A0=E5=8E=BB=E4=BA=86=E9=81=97?= =?UTF-8?q?=E6=BC=8F=E7=9A=84Trim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_fortune/fortune.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin_fortune/fortune.go b/plugin_fortune/fortune.go index 4bdbb60bcf..3e2b652648 100644 --- a/plugin_fortune/fortune.go +++ b/plugin_fortune/fortune.go @@ -11,7 +11,6 @@ import ( "math/rand" "os" "strconv" - "strings" "time" "github.com/fogleman/gg" // 注册了 jpg png gif @@ -90,7 +89,7 @@ func init() { // 个人用户设为负数 gid = -ctx.Event.UserID } - i, ok := index[strings.Trim(ctx.State["regex_matched"].([]string)[1], " ")] + i, ok := index[ctx.State["regex_matched"].([]string)[1]] if ok { c, ok := control.Lookup("fortune") if ok { From 66674023205109994a3da394d3453394340b6e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E6=80=9D=E6=95=9B?= <55676105+shudorcl@users.noreply.github.com> Date: Thu, 3 Feb 2022 11:48:27 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E6=8F=92=E4=BB=B6=E4=B8=AD=E4=BD=BF=E7=94=A8=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E7=9A=84=E4=BD=93=E9=AA=8C=20-=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=86music=20bilibili=20image=5Ffinder=20=E4=B8=AD=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=A9=BA=E6=A0=BC=E7=9A=84=E4=BD=93=E9=AA=8C=20-=20?= =?UTF-8?q?=E8=A1=A5=E4=B8=8A=E4=BA=86plugin=5Fbilibili=E4=B8=AD=E6=9C=AA?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=9A=84vup=E5=BC=80=E5=A4=B4=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=20-=20=E4=B8=BAplugin=5Fbilibili=5Fparse=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E7=9A=84=E6=B6=88=E6=81=AF=E5=8A=A0=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=8D=A2=E8=A1=8C=E7=AC=A6=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=8E=92=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_bilibili/info.go | 2 +- plugin_bilibili_parse/bilibili_parse.go | 2 +- plugin_image_finder/keyword.go | 2 +- plugin_music/selecter.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin_bilibili/info.go b/plugin_bilibili/info.go index 02c416cc47..a825407786 100644 --- a/plugin_bilibili/info.go +++ b/plugin_bilibili/info.go @@ -22,7 +22,7 @@ var engine = control.Register("bilibili", order.PrioBilibili, &control.Options{ // 查成分的 func init() { - engine.OnRegex(`^>user info\s(.{1,25})$`).SetBlock(true). + engine.OnRegex(`^>(?:user|vup)\s?info\s?(.{1,25})$`).SetBlock(true). Handle(func(ctx *zero.Ctx) { keyword := ctx.State["regex_matched"].([]string)[1] rest, err := uid(keyword) diff --git a/plugin_bilibili_parse/bilibili_parse.go b/plugin_bilibili_parse/bilibili_parse.go index 8f86f23325..761a2a9f46 100644 --- a/plugin_bilibili_parse/bilibili_parse.go +++ b/plugin_bilibili_parse/bilibili_parse.go @@ -57,7 +57,7 @@ func parseURL(bilibiliURL string) (m message.Message) { m = append(m, message.Image(image)) like := htmlquery.FindOne(doc, "//*[@id='arc_toolbar_report']/div[1]/span[@class='like']/text()").Data coin := htmlquery.FindOne(doc, "//*[@id='arc_toolbar_report']/div[1]/span[@class='coin']/text()").Data - m = append(m, message.Text("点赞:", strings.TrimSpace(like)+"投币:", strings.TrimSpace(coin)+"\n")) + m = append(m, message.Text("\n点赞:", strings.TrimSpace(like)+"投币:", strings.TrimSpace(coin)+"\n")) collect := htmlquery.FindOne(doc, "//*[@id='arc_toolbar_report']/div[1]/span[@class='collect']/text()").Data share := htmlquery.FindOne(doc, "//*[@id='arc_toolbar_report']/div[1]/span[@class='share']/text()").Data m = append(m, message.Text("收藏:", strings.TrimSpace(collect)+"分享:", strings.TrimSpace(share)+"\n")) diff --git a/plugin_image_finder/keyword.go b/plugin_image_finder/keyword.go index 5f9afb1539..89a698f5b0 100644 --- a/plugin_image_finder/keyword.go +++ b/plugin_image_finder/keyword.go @@ -69,7 +69,7 @@ func init() { DisableOnDefault: false, Help: "关键字搜图\n" + "- 来张 [xxx]", - }).OnRegex(`^来张 (.*)$`, zero.AdminPermission).SetBlock(true). + }).OnRegex(`^来张\s?(.*)$`, zero.AdminPermission).SetBlock(true). Handle(func(ctx *zero.Ctx) { keyword := ctx.State["regex_matched"].([]string)[1] soutujson := soutuapi(keyword) diff --git a/plugin_music/selecter.go b/plugin_music/selecter.go index ab0c3c298e..723bd788cb 100644 --- a/plugin_music/selecter.go +++ b/plugin_music/selecter.go @@ -30,7 +30,7 @@ func init() { "- 网易点歌[xxx]\n" + "- 酷我点歌[xxx]\n" + "- 酷狗点歌[xxx]", - }).OnRegex("^(.{0,2})点歌(.{1,25})$").SetBlock(true). + }).OnRegex(`^(.{0,2})点歌\s?(.{1,25})$`).SetBlock(true). Handle(func(ctx *zero.Ctx) { if !limit.Load(ctx.Event.UserID).Acquire() { ctx.SendChain(message.Text("请稍后重试0x0..."))