feat: Debug mode

This commit is contained in:
mei
2025-10-06 17:18:44 +08:00
parent 6c14ad207f
commit 73cf96a3c4
3 changed files with 7 additions and 1 deletions
+1
View File
@@ -1,4 +1,5 @@
{
"debug": false,
"disconnect_duration": 5,
"cat_bot_url": "",
"cat_bot_key": "",
+1
View File
@@ -6,6 +6,7 @@ import (
)
type Config struct {
Debug bool `json:"debug"`
DisconnectDuration int `json:"disconnect_duration"` // Hours
CatBotUrl string `json:"cat_bot_url"`
CatBotKey string `json:"cat_bot_key"`
+5 -1
View File
@@ -17,7 +17,11 @@ func init() {
if err != nil {
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)
go func() {
<-timer.C