Skip to content

Commit

Permalink
Merge remote-tracking branch 'upsteram/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiang-Red committed Jun 11, 2022
2 parents e5183e5 + 621fd61 commit bb66229
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 25 deletions.
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**: 显示帮助
Expand All @@ -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`下有效

Expand Down Expand Up @@ -122,16 +121,6 @@ zerobot [-c config.json] [-h] [-s config.json] [-t token] [-u url] [-n nickname]
</details>

### *高优先级*
<details>
<summary>web管理</summary>

`import _ "github.com/FloatTech/zbputils/control/web"`

- 开启后可执行文件大约增加 5M ,默认注释不开启。如需开启请自行编辑`main.go`取消注释

- 需要配合 [webgui](https://github.com/FloatTech/bot-manager) 使用

</details>
<details>
<summary>聊天</summary>

Expand Down
9 changes: 1 addition & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ import (
// vvvvvvvvvvvvvv //
// vvvv //

// webctrl "github.com/FloatTech/zbputils/control/web" // web 后端控制

// 高优先级自定义插件
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/custom" // 自杀(bushi
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/delreply" // 回复撤回
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 事件

_ "github.com/FloatTech/ZeroBot-Plugin/plugin/chat" // 基础词库

_ "github.com/FloatTech/ZeroBot-Plugin/plugin/sleep_manage" // 统计睡眠时间
Expand Down Expand Up @@ -183,8 +181,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.")
Expand Down Expand Up @@ -226,9 +222,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 {
Expand Down
8 changes: 4 additions & 4 deletions plugin/b14/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plugin/image_finder/keyword.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit bb66229

Please sign in to comment.