From b4d07821f39633f93451560bfc186d919ed4958e Mon Sep 17 00:00:00 2001 From: null31 Date: Sat, 14 Sep 2024 03:11:52 +0200 Subject: [PATCH] Make debug mode available as option of true/false --- config.json.example | 3 ++- main.go | 2 +- utils/config.go | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.json.example b/config.json.example index d105aa4..225163e 100644 --- a/config.json.example +++ b/config.json.example @@ -2,5 +2,6 @@ "bot_token": "ID:Secret", "chat_id": "USER_OR_CHAT_ID", "geoip_city": "geolite2-city.mmdb", - "geoip_asn": "geolite2-asn.mmdb" + "geoip_asn": "geolite2-asn.mmdb", + "debug": false } diff --git a/main.go b/main.go index c04645e..bb75a31 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ func main() { log.Fatalf("Failed to create bot: %v", err) } - bot.Debug = true + bot.Debug = config.Debug log.Printf("Authorized on account %s", bot.Self.UserName) // Set up an update config to filter messages from the chat diff --git a/utils/config.go b/utils/config.go index 2eb0df2..951dab6 100644 --- a/utils/config.go +++ b/utils/config.go @@ -11,6 +11,7 @@ type Config struct { ChatID string `json:"chat_id"` GeoIP_City string `json:"geoip_city"` GeoIP_ASN string `json:"geoip_asn"` + Debug bool `json:"debug"` } func LoadConfig(file string) (Config, error) {