mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
fix typo.
This commit is contained in:
parent
dc18944a98
commit
ae806c53bb
@ -277,8 +277,8 @@ func DefaultConfig() *JSONConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load 加载配置文件
|
//LoadConfig 加载配置文件
|
||||||
func Load(p string) *JSONConfig {
|
func LoadConfig(p string) *JSONConfig {
|
||||||
if !PathExists(p) {
|
if !PathExists(p) {
|
||||||
log.Warnf("尝试加载配置文件 %v 失败: 文件不存在", p)
|
log.Warnf("尝试加载配置文件 %v 失败: 文件不存在", p)
|
||||||
return nil
|
return nil
|
||||||
|
4
main.go
4
main.go
@ -469,7 +469,7 @@ func restart(Args []string) {
|
|||||||
func getConfig() *global.JSONConfig {
|
func getConfig() *global.JSONConfig {
|
||||||
var conf *global.JSONConfig
|
var conf *global.JSONConfig
|
||||||
if global.PathExists("config.json") {
|
if global.PathExists("config.json") {
|
||||||
conf = global.Load("config.json")
|
conf = global.LoadConfig("config.json")
|
||||||
_ = conf.Save("config.hjson")
|
_ = conf.Save("config.hjson")
|
||||||
_ = os.Remove("config.json")
|
_ = os.Remove("config.json")
|
||||||
} else if os.Getenv("UIN") != "" {
|
} else if os.Getenv("UIN") != "" {
|
||||||
@ -498,7 +498,7 @@ func getConfig() *global.JSONConfig {
|
|||||||
conf.HTTPConfig.PostUrls[post] = os.Getenv("HTTP_SECRET")
|
conf.HTTPConfig.PostUrls[post] = os.Getenv("HTTP_SECRET")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
conf = global.Load("config.hjson")
|
conf = global.LoadConfig("config.hjson")
|
||||||
}
|
}
|
||||||
if conf == nil {
|
if conf == nil {
|
||||||
err := global.WriteAllText("config.hjson", global.DefaultConfigWithComments)
|
err := global.WriteAllText("config.hjson", global.DefaultConfigWithComments)
|
||||||
|
@ -333,7 +333,7 @@ func GetConf() *global.JSONConfig {
|
|||||||
if JSONConfig != nil {
|
if JSONConfig != nil {
|
||||||
return JSONConfig
|
return JSONConfig
|
||||||
}
|
}
|
||||||
conf := global.Load("config.hjson")
|
conf := global.LoadConfig("config.hjson")
|
||||||
return conf
|
return conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user