From 73cf96a3c443efb535baae8f28e69932b6ccf37d Mon Sep 17 00:00:00 2001 From: mei Date: Mon, 6 Oct 2025 17:18:44 +0800 Subject: [PATCH] feat: Debug mode --- config.example.json | 1 + configs/config.go | 1 + main.go | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config.example.json b/config.example.json index fbf332b..b8c502b 100644 --- a/config.example.json +++ b/config.example.json @@ -1,4 +1,5 @@ { + "debug": false, "disconnect_duration": 5, "cat_bot_url": "", "cat_bot_key": "", diff --git a/configs/config.go b/configs/config.go index ced29b2..348b735 100644 --- a/configs/config.go +++ b/configs/config.go @@ -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"` diff --git a/main.go b/main.go index d4dd557..8091a05 100644 --- a/main.go +++ b/main.go @@ -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