mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 13:59:39 +08:00
✨ 增加-u参数
This commit is contained in:
parent
2fb445746e
commit
4677d789f2
@ -20,9 +20,11 @@
|
|||||||
|
|
||||||
## 命令行参数
|
## 命令行参数
|
||||||
```bash
|
```bash
|
||||||
zerobot -h [-d|w] [-g] qq1 qq2 qq3 ...
|
zerobot -h -t token -u url [-d|w] [-g] qq1 qq2 qq3 ...
|
||||||
```
|
```
|
||||||
- **-h**: 显示帮助
|
- **-h**: 显示帮助
|
||||||
|
- **-t token**: 设置`AccessToken`
|
||||||
|
- **-u url**: 设置`Url`
|
||||||
- **-d|w**: 开启 debug | warning 级别及以上日志输出
|
- **-d|w**: 开启 debug | warning 级别及以上日志输出
|
||||||
- **-g**: 开启 [webgui](https://github.com/FloatTech/bot-manager)
|
- **-g**: 开启 [webgui](https://github.com/FloatTech/bot-manager)
|
||||||
- **qqs**: superusers 的 qq 号
|
- **qqs**: superusers 的 qq 号
|
||||||
|
|||||||
12
main.go
12
main.go
@ -61,13 +61,19 @@ var (
|
|||||||
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
|
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
|
||||||
}
|
}
|
||||||
banner = strings.Join(contents, "\n")
|
banner = strings.Join(contents, "\n")
|
||||||
|
token *string
|
||||||
|
url *string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// 解析命令行参数,输入 `-d` 即可开启 debug log
|
// 解析命令行参数
|
||||||
d := flag.Bool("d", false, "Enable debug level log and higher.")
|
d := flag.Bool("d", false, "Enable debug level log and higher.")
|
||||||
w := flag.Bool("w", false, "Enable warning level log and higher.")
|
w := flag.Bool("w", false, "Enable warning level log and higher.")
|
||||||
h := flag.Bool("h", false, "Display this help.")
|
h := flag.Bool("h", false, "Display this help.")
|
||||||
|
// 直接写死 AccessToken 时,请更改下面第二个参数
|
||||||
|
token = flag.String("t", "", "Set AccessToken of WSClient.")
|
||||||
|
// 直接写死 URL 时,请更改下面第二个参数
|
||||||
|
url = flag.String("u", "ws://127.0.0.1:6700", "Set Url of WSClient.")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if *h {
|
if *h {
|
||||||
printBanner()
|
printBanner()
|
||||||
@ -106,8 +112,8 @@ func main() {
|
|||||||
Driver: []zero.Driver{
|
Driver: []zero.Driver{
|
||||||
&driver.WSClient{
|
&driver.WSClient{
|
||||||
// OneBot 正向WS 默认使用 6700 端口
|
// OneBot 正向WS 默认使用 6700 端口
|
||||||
Url: "ws://127.0.0.1:6700",
|
Url: *url,
|
||||||
AccessToken: "",
|
AccessToken: *token,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user