feat: Debug mode
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"debug": false,
|
||||||
"disconnect_duration": 5,
|
"disconnect_duration": 5,
|
||||||
"cat_bot_url": "",
|
"cat_bot_url": "",
|
||||||
"cat_bot_key": "",
|
"cat_bot_key": "",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
Debug bool `json:"debug"`
|
||||||
DisconnectDuration int `json:"disconnect_duration"` // Hours
|
DisconnectDuration int `json:"disconnect_duration"` // Hours
|
||||||
CatBotUrl string `json:"cat_bot_url"`
|
CatBotUrl string `json:"cat_bot_url"`
|
||||||
CatBotKey string `json:"cat_bot_key"`
|
CatBotKey string `json:"cat_bot_key"`
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("获取配置文件失败: %v", err)
|
log.Printf("获取配置文件失败: %v", err)
|
||||||
}
|
}
|
||||||
duration = time.Duration(config.DisconnectDuration) * time.Second
|
if config.Debug {
|
||||||
|
duration = time.Duration(config.DisconnectDuration) * time.Second
|
||||||
|
} else {
|
||||||
|
duration = time.Duration(config.DisconnectDuration) * time.Hour
|
||||||
|
}
|
||||||
timer = time.NewTimer(duration)
|
timer = time.NewTimer(duration)
|
||||||
go func() {
|
go func() {
|
||||||
<-timer.C
|
<-timer.C
|
||||||
|
|||||||
Reference in New Issue
Block a user