Make debug mode available as option of true/false
This commit is contained in:
parent
c48c9f2e30
commit
b4d07821f3
|
@ -2,5 +2,6 @@
|
||||||
"bot_token": "ID:Secret",
|
"bot_token": "ID:Secret",
|
||||||
"chat_id": "USER_OR_CHAT_ID",
|
"chat_id": "USER_OR_CHAT_ID",
|
||||||
"geoip_city": "geolite2-city.mmdb",
|
"geoip_city": "geolite2-city.mmdb",
|
||||||
"geoip_asn": "geolite2-asn.mmdb"
|
"geoip_asn": "geolite2-asn.mmdb",
|
||||||
|
"debug": false
|
||||||
}
|
}
|
||||||
|
|
2
main.go
2
main.go
|
@ -24,7 +24,7 @@ func main() {
|
||||||
log.Fatalf("Failed to create bot: %v", err)
|
log.Fatalf("Failed to create bot: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
bot.Debug = true
|
bot.Debug = config.Debug
|
||||||
log.Printf("Authorized on account %s", bot.Self.UserName)
|
log.Printf("Authorized on account %s", bot.Self.UserName)
|
||||||
|
|
||||||
// Set up an update config to filter messages from the chat
|
// Set up an update config to filter messages from the chat
|
||||||
|
|
|
@ -11,6 +11,7 @@ type Config struct {
|
||||||
ChatID string `json:"chat_id"`
|
ChatID string `json:"chat_id"`
|
||||||
GeoIP_City string `json:"geoip_city"`
|
GeoIP_City string `json:"geoip_city"`
|
||||||
GeoIP_ASN string `json:"geoip_asn"`
|
GeoIP_ASN string `json:"geoip_asn"`
|
||||||
|
Debug bool `json:"debug"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadConfig(file string) (Config, error) {
|
func LoadConfig(file string) (Config, error) {
|
||||||
|
|
Loading…
Reference in New Issue