From 987b505d322a5a7e9396af70af53cf122e439691 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?=
<41315874+fumiama@users.noreply.github.com>
Date: Sat, 11 Jun 2022 16:27:09 +0800
Subject: [PATCH 1/4] fix regex
---
plugin/bilibili_parse/bilibili_parse.go | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/plugin/bilibili_parse/bilibili_parse.go b/plugin/bilibili_parse/bilibili_parse.go
index 72ba98d67d..0a2742b22d 100644
--- a/plugin/bilibili_parse/bilibili_parse.go
+++ b/plugin/bilibili_parse/bilibili_parse.go
@@ -6,6 +6,7 @@ import (
"net/http"
"regexp"
"strconv"
+ "strings"
"time"
ctrl "github.com/FloatTech/zbpctrl"
@@ -76,8 +77,11 @@ func init() {
Help: "b站视频链接解析\n" +
"- https://www.bilibili.com/video/BV1xx411c7BF | https://www.bilibili.com/video/av1605 | https://b23.tv/I8uzWCA | https://www.bilibili.com/video/bv1xx411c7BF",
})
- en.OnRegex(`(?
Date: Sat, 11 Jun 2022 17:00:22 +0800
Subject: [PATCH 2/4] drop webgui
---
README.md | 13 +------------
main.go | 7 -------
2 files changed, 1 insertion(+), 19 deletions(-)
diff --git a/README.md b/README.md
index 1e917f54ef..cb97955277 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@
## 命令行参数
> `[]`代表是可选参数
```bash
-zerobot [-c config.json] [-h] [-s config.json] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地址:端口] [qq1 qq2 qq3 ...] [&]
+zerobot [-c config.json] [-h] [-s config.json] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [qq1 qq2 qq3 ...] [&]
```
- **-c config.json**: 从`config.json`加载`bot`配置
- **-h**: 显示帮助
@@ -46,7 +46,6 @@ zerobot [-c config.json] [-h] [-s config.json] [-t token] [-u url] [-n nickname]
- **-n nickname**: 设置默认昵称,默认为`椛椛`
- **-p prefix**: 设置命令前缀,默认为`/`
- **-d|w**: 开启 debug | warning 级别及以上日志输出
-- **-g 监听地址:端口**: 在 http://监听地址:端口 上开启 [webgui](https://github.com/FloatTech/bot-manager)
- **qqs**: superusers 的 qq 号
- **&**: 驻留在后台,必须放在最后,仅`Linux`下有效
@@ -122,16 +121,6 @@ zerobot [-c config.json] [-h] [-s config.json] [-t token] [-u url] [-n nickname]
### *高优先级*
-
- web管理
-
- `import _ "github.com/FloatTech/zbputils/control/web"`
-
- - 开启后可执行文件大约增加 5M ,默认注释不开启。如需开启请自行编辑`main.go`取消注释
-
- - 需要配合 [webgui](https://github.com/FloatTech/bot-manager) 使用
-
-
聊天
diff --git a/main.go b/main.go
index b7dffb4f0d..715e3bd78a 100644
--- a/main.go
+++ b/main.go
@@ -25,8 +25,6 @@ import (
// vvvvvvvvvvvvvv //
// vvvv //
- // webctrl "github.com/FloatTech/zbputils/control/web" // web 后端控制
-
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/chat" // 基础词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/sleep_manage" // 统计睡眠时间
@@ -165,8 +163,6 @@ import (
func init() {
sus := make([]int64, 0, 16)
// 解析命令行参数
- // 输入 `-g 监听地址:端口` 指定 gui 访问地址,默认 127.0.0.1:3000
- // g := flag.String("g", "127.0.0.1:3000", "Set web gui listening address.")
d := flag.Bool("d", false, "Enable debug level log and higher.")
w := flag.Bool("w", false, "Enable warning level log and higher.")
h := flag.Bool("h", false, "Display this help.")
@@ -208,9 +204,6 @@ func init() {
// sus = append(sus, 12345678)
// sus = append(sus, 87654321)
- // 启用 gui
- // webctrl.InitGui(*g)
-
if *runcfg != "" {
f, err := os.Open(*runcfg)
if err != nil {
From be3e7c892cbdfef428f1dd17898c6b6369b5b3fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?=
<41315874+fumiama@users.noreply.github.com>
Date: Sat, 11 Jun 2022 18:27:26 +0800
Subject: [PATCH 3/4] fix b14
---
plugin/b14/main.go | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/plugin/b14/main.go b/plugin/b14/main.go
index a147934e31..b321c0fb34 100644
--- a/plugin/b14/main.go
+++ b/plugin/b14/main.go
@@ -19,7 +19,7 @@ func init() {
Help: "base16384加解密\n" +
"- 加密xxx\n- 解密xxx\n- 用yyy加密xxx\n- 用yyy解密xxx",
})
- en.OnRegex(`^加密\s?(.*)`).SetBlock(true).
+ en.OnRegex(`^加密\s*(.*)`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[1]
es := base14.EncodeString(str)
@@ -29,7 +29,7 @@ func init() {
ctx.SendChain(message.Text("加密失败!"))
}
})
- en.OnRegex(`^解密\s?([一-踀]*[㴁-㴆]?)$`).SetBlock(true).
+ en.OnRegex(`^解密\s*([一-踀]*[㴁-㴆]?)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[1]
es := base14.DecodeString(str)
@@ -39,7 +39,7 @@ func init() {
ctx.SendChain(message.Text("解密失败!"))
}
})
- en.OnRegex(`^用(.*)加密\s?(.*)`).SetBlock(true).
+ en.OnRegex(`^用(.*)加密\s*(.*)`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := getea(key)
@@ -50,7 +50,7 @@ func init() {
ctx.SendChain(message.Text("加密失败!"))
}
})
- en.OnRegex(`^用(.*)解密\s?([一-踀]*[㴁-㴆]?)$`).SetBlock(true).
+ en.OnRegex(`^用(.*)解密\s*([一-踀]*[㴁-㴆]?)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := getea(key)
From 621fd614ea3b44216bd6c7ba1cc388d9c2e915c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?=
<41315874+fumiama@users.noreply.github.com>
Date: Sat, 11 Jun 2022 21:06:08 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=92=A9=F0=9F=91=8C=20make=20lint=20ha?=
=?UTF-8?q?ppy?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
plugin/image_finder/keyword.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugin/image_finder/keyword.go b/plugin/image_finder/keyword.go
index c3d35f3e9d..75e61d7d6e 100644
--- a/plugin/image_finder/keyword.go
+++ b/plugin/image_finder/keyword.go
@@ -130,7 +130,7 @@ func printtags(r reflect.Value) string {
tags := r.Elem()
s := binary.BytesToString(binary.NewWriterF(func(w *binary.Writer) {
for i := 0; i < tags.Len(); i++ {
- w.WriteByte('\n')
+ _ = w.WriteByte('\n')
tag := tags.Index(i)
_ = w.WriteByte('#')
w.WriteString(tag.Field(0).String())