From ccee8ac77a13c108c3f8b7c3b06e66e267733c75 Mon Sep 17 00:00:00 2001 From: sam01101 Date: Fri, 29 Jan 2021 15:13:39 +0800 Subject: [PATCH 1/2] isFastStart setting appiled to config.hjson gen --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index a9c00bf..0b65eeb 100644 --- a/main.go +++ b/main.go @@ -139,7 +139,9 @@ func main() { if conf.Uin == 0 || (conf.Password == "" && conf.PasswordEncrypted == "") { log.Warnf("请修改 config.hjson 以添加账号密码.") - time.Sleep(time.Second * 5) + if (!isFastStart) { + time.Sleep(time.Second * 5) + } return } @@ -467,7 +469,9 @@ func getConfig() *global.JSONConfig { return nil } log.Infof("默认配置文件已生成, 请编辑 config.hjson 后重启程序.") - time.Sleep(time.Second * 5) + if (!isFastStart) { + time.Sleep(time.Second * 5) + } return nil } return conf From 96a036201db207d3774dd9874895b754a88cc9af Mon Sep 17 00:00:00 2001 From: sam01101 Date: Fri, 29 Jan 2021 15:16:31 +0800 Subject: [PATCH 2/2] Move isFastStart outside --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 0b65eeb..c40110e 100644 --- a/main.go +++ b/main.go @@ -36,6 +36,7 @@ import ( var json = jsoniter.ConfigCompatibleWithStandardLibrary var conf *global.JSONConfig +var isFastStart = false func init() { if global.PathExists("cqhttp.json") { @@ -115,7 +116,6 @@ func init() { func main() { var byteKey []byte - var isFastStart = false arg := os.Args if len(arg) > 1 { for i := range arg {