Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature gui 20230219 #597

Merged
merged 15 commits into from
Mar 7, 2023
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,18 @@

> 如果您对开发插件感兴趣,欢迎加入[ZeroBot-Plugin-Playground](https://github.com/FloatTech/ZeroBot-Plugin-Playground)

> webui持续开发中, 环境加入[ZeroBot-Plugin-Webui](https://github.com/guohuiyuan/ZeroBot-Plugin-Webui)
fumiama marked this conversation as resolved.
Show resolved Hide resolved

## 命令行参数
> `[]`代表是可选参数
```bash
zerobot [-h] [-n nickname] [-t token] [-u url] [-p prefix] [-d|w] [-c|s config.json] [-l latency] [-r ringlen] [-x max process time] [qq1 qq2 qq3 ...] [&]
zerobot [-h] [-n nickname] [-t token] [-u url] [-g url] [-p prefix] [-d|w] [-c|s config.json] [-l latency] [-r ringlen] [-x max process time] [qq1 qq2 qq3 ...] [&]
```
- **-h**: 显示帮助
- **-n nickname**: 设置默认昵称,默认为`椛椛`
- **-t token**: 设置`AccessToken`,默认为空
- **-u url**: 设置`Url`,默认为`ws://127.0.0.1:6700`
- **-g url**: 设置`webuiUrl`,默认为`127.0.0.1:3000`
fumiama marked this conversation as resolved.
Show resolved Hide resolved
- **-p prefix**: 设置命令前缀,默认为`/`
- **-d|w**: 开启 debug | warning 级别及以上日志输出
- **-c config.json**: 从`config.json`加载`bot`配置
Expand Down Expand Up @@ -132,6 +135,12 @@ zerobot [-h] [-n nickname] [-t token] [-u url] [-p prefix] [-d|w] [-c|s config.j

- [x] /设置服务列表显示行数 xx

- [x] /设置webui用户名 zerobot 密码 123456

- [x] /webui启动

- [x] /webui停止

默认值为9,该设置仅运行时有效,zbp重启后重置
- [x] @Bot 插件冲突检测 (会在本群发送一条消息并在约 1s 后撤回以检测其它同类 bot 中已启用的插件并禁用)

Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/console" // 更改控制台属性

"github.com/FloatTech/ZeroBot-Plugin/kanban" // 打印 banner
webctrl "github.com/FloatTech/zbputils/control/web"
fumiama marked this conversation as resolved.
Show resolved Hide resolved

// ---------以下插件均可通过前面加 // 注释,注释后停用并不加载插件--------- //
// ----------------------插件优先级按顺序从高到低---------------------- //
Expand Down Expand Up @@ -209,6 +210,7 @@ func init() {
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.")
g := flag.String("g", "127.0.0.1:3000", "Set Url of webui.")
fumiama marked this conversation as resolved.
Show resolved Hide resolved
// 直接写死 AccessToken 时,请更改下面第二个参数
token := flag.String("t", "", "Set AccessToken of WSClient.")
// 直接写死 URL 时,请更改下面第二个参数
Expand Down Expand Up @@ -245,6 +247,9 @@ func init() {
sus = append(sus, i)
}

// 启用 gui
go webctrl.RunGui(*g)

// 通过代码写死的方式添加主人账号
// sus = append(sus, 12345678)
// sus = append(sus, 87654321)
Expand Down